Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Carlos Ramos Carreño
neoppod
Commits
bd5ba87a
Commit
bd5ba87a
authored
May 07, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix undo of transactions during which readCurrent() was used
parent
1a72a60f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
22 deletions
+20
-22
neo/client/app.py
neo/client/app.py
+10
-15
neo/storage/database/manager.py
neo/storage/database/manager.py
+3
-2
neo/storage/handlers/client.py
neo/storage/handlers/client.py
+6
-5
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+1
-0
No files found.
neo/client/app.py
View file @
bd5ba87a
...
...
@@ -17,6 +17,7 @@
import
heapq
import
random
import
time
from
collections
import
defaultdict
try
:
from
ZODB._compat
import
dumps
,
loads
,
_protocol
...
...
@@ -776,17 +777,11 @@ class Application(ThreadedApplication):
def
undo
(
self
,
undone_tid
,
txn
):
txn_context
=
self
.
_txn_container
.
get
(
txn
)
txn_info
,
txn_ext
=
self
.
_getTransactionInformation
(
undone_tid
)
txn_oid_list
=
txn_info
[
'oids'
]
# Regroup objects per partition, to ask a minimum set of storage.
partition_oid_dict
=
{}
for
oid
in
txn_oid_list
:
partition
=
self
.
pt
.
getPartition
(
oid
)
try
:
oid_list
=
partition_oid_dict
[
partition
]
except
KeyError
:
oid_list
=
partition_oid_dict
[
partition
]
=
[]
oid_list
.
append
(
oid
)
partition_oid_dict
=
defaultdict
(
list
)
for
oid
in
txn_info
[
'oids'
]:
partition_oid_dict
[
self
.
pt
.
getPartition
(
oid
)].
append
(
oid
)
# Ask storage the undo serial (serial at which object's previous data
# is)
...
...
@@ -828,8 +823,8 @@ class Application(ThreadedApplication):
raise
UndoError
(
'non-undoable transaction'
)
# Send undo data to all storage nodes.
for
oid
in
txn_oid_list
:
current_serial
,
undo_serial
,
is_current
=
undo_object_tid_dict
[
oid
]
for
oid
,
(
current_serial
,
undo_serial
,
is_current
)
in
\
undo_object_tid_dict
.
iteritems
():
if
is_current
:
data
=
None
else
:
...
...
@@ -863,7 +858,7 @@ class Application(ThreadedApplication):
self
.
_store
(
txn_context
,
oid
,
current_serial
,
data
,
undo_serial
)
self
.
waitStoreResponses
(
txn_context
)
return
None
,
txn_oid_list
return
None
,
list
(
undo_object_tid_dict
)
def
_getTransactionInformation
(
self
,
tid
):
return
self
.
_askStorageForRead
(
tid
,
...
...
@@ -944,9 +939,9 @@ class Application(ThreadedApplication):
for
serial
,
size
in
self
.
_askStorageForRead
(
oid
,
packet
):
txn_info
,
txn_ext
=
self
.
_getTransactionInformation
(
serial
)
# create history dict
txn_info
.
pop
(
'id'
)
txn_info
.
pop
(
'oids'
)
txn_info
.
pop
(
'packed'
)
del
txn_info
[
'id'
]
del
txn_info
[
'oids'
]
del
txn_info
[
'packed'
]
txn_info
[
'tid'
]
=
serial
txn_info
[
'version'
]
=
''
txn_info
[
'size'
]
=
size
...
...
neo/storage/database/manager.py
View file @
bd5ba87a
...
...
@@ -796,6 +796,9 @@ class DatabaseManager(object):
oid
,
current_tid
)
return
current_tid
,
current_tid
return
current_tid
,
tid
found_undone_tid
,
undone_data_tid
=
getDataTID
(
tid
=
undone_tid
)
if
found_undone_tid
is
None
:
return
if
transaction_object
:
try
:
current_tid
=
current_data_tid
=
u64
(
transaction_object
[
2
])
...
...
@@ -805,8 +808,6 @@ class DatabaseManager(object):
current_tid
,
current_data_tid
=
getDataTID
(
before_tid
=
ltid
)
if
current_tid
is
None
:
return
None
,
None
,
False
found_undone_tid
,
undone_data_tid
=
getDataTID
(
tid
=
undone_tid
)
assert
found_undone_tid
is
not
None
,
(
oid
,
undone_tid
)
is_current
=
undone_data_tid
in
(
current_data_tid
,
tid
)
# Load object data as it was before given transaction.
# It can be None, in which case it means we are undoing object
...
...
neo/storage/handlers/client.py
View file @
bd5ba87a
...
...
@@ -183,12 +183,13 @@ class ClientOperationHandler(BaseHandler):
getObjectFromTransaction
=
app
.
tm
.
getObjectFromTransaction
object_tid_dict
=
{}
for
oid
in
oid_list
:
current_serial
,
undo_serial
,
is_current
=
findUndoTID
(
oid
,
ttid
,
r
=
findUndoTID
(
oid
,
ttid
,
ltid
,
undone_tid
,
getObjectFromTransaction
(
ttid
,
oid
))
if
current_serial
is
None
:
if
r
:
if
not
r
[
0
]:
p
=
Errors
.
OidNotFound
(
dump
(
oid
))
break
object_tid_dict
[
oid
]
=
(
current_serial
,
undo_serial
,
is_current
)
object_tid_dict
[
oid
]
=
r
else
:
p
=
Packets
.
AnswerObjectUndoSerial
(
object_tid_dict
)
conn
.
answer
(
p
)
...
...
neo/tests/threaded/test.py
View file @
bd5ba87a
...
...
@@ -149,6 +149,7 @@ class Test(NEOThreadedTest):
c
.
root
()[
0
]
=
ob
=
PCounterWithResolution
()
t
.
commit
()
tids
=
[]
c
.
readCurrent
(
c
.
root
())
for
x
in
inc
:
ob
.
value
+=
x
t
.
commit
()
...
...
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