Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
7aecdada
Commit
7aecdada
authored
Mar 21, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: fix crash when a client disconnects just after it requested to finish a transaction
parent
b05b961b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
neo/storage/transactions.py
neo/storage/transactions.py
+9
-2
No files found.
neo/storage/transactions.py
View file @
7aecdada
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
from
time
import
time
from
time
import
time
from
neo.lib
import
logging
from
neo.lib
import
logging
from
neo.lib.util
import
dump
from
neo.lib.util
import
dump
from
neo.lib.protocol
import
uuid_str
,
ZERO_TID
from
neo.lib.protocol
import
ProtocolError
,
uuid_str
,
ZERO_TID
class
ConflictError
(
Exception
):
class
ConflictError
(
Exception
):
"""
"""
...
@@ -183,7 +183,10 @@ class TransactionManager(object):
...
@@ -183,7 +183,10 @@ class TransactionManager(object):
Lock a transaction
Lock a transaction
"""
"""
logging
.
debug
(
'Lock TXN %s (ttid=%s)'
,
dump
(
tid
),
dump
(
ttid
))
logging
.
debug
(
'Lock TXN %s (ttid=%s)'
,
dump
(
tid
),
dump
(
ttid
))
try
:
transaction
=
self
.
_transaction_dict
[
ttid
]
transaction
=
self
.
_transaction_dict
[
ttid
]
except
KeyError
:
raise
ProtocolError
(
"unknown ttid %s"
%
dump
(
ttid
))
# remember that the transaction has been locked
# remember that the transaction has been locked
transaction
.
lock
()
transaction
.
lock
()
self
.
_load_lock_dict
.
update
(
self
.
_load_lock_dict
.
update
(
...
@@ -339,6 +342,10 @@ class TransactionManager(object):
...
@@ -339,6 +342,10 @@ class TransactionManager(object):
Abort any non-locked transaction of a node
Abort any non-locked transaction of a node
"""
"""
logging
.
debug
(
'Abort for %s'
,
uuid_str
(
uuid
))
logging
.
debug
(
'Abort for %s'
,
uuid_str
(
uuid
))
# BUG: Discarding voted transactions must only be a decision of the
# master, and for this, we'll need to review how transactions are
# aborted. As a workaround, we rely on the fact that lock() will
# disconnect from the master in case of LockInformation.
# abort any non-locked transaction of this node
# abort any non-locked transaction of this node
for
ttid
in
[
x
.
getTTID
()
for
x
in
self
.
_uuid_dict
.
get
(
uuid
,
[])]:
for
ttid
in
[
x
.
getTTID
()
for
x
in
self
.
_uuid_dict
.
get
(
uuid
,
[])]:
self
.
abort
(
ttid
)
self
.
abort
(
ttid
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment