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
Jérome Perrin
neoppod
Commits
787586e6
Commit
787586e6
authored
Dec 27, 2016
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not ask storage to send oid/serial back on store/check
parent
3a93658b
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
27 deletions
+22
-27
neo/client/app.py
neo/client/app.py
+3
-2
neo/client/handlers/storage.py
neo/client/handlers/storage.py
+8
-8
neo/lib/protocol.py
neo/lib/protocol.py
+2
-8
neo/storage/handlers/client.py
neo/storage/handlers/client.py
+6
-6
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+3
-3
No files found.
neo/client/app.py
View file @
787586e6
...
...
@@ -460,7 +460,8 @@ class Application(ThreadedApplication):
checksum
,
compressed_data
,
data_serial
,
ttid
,
unlock
)
for
node
,
conn
in
self
.
cp
.
iterateForObject
(
oid
):
try
:
conn
.
ask
(
packet
,
on_timeout
=
on_timeout
,
queue
=
queue
)
conn
.
ask
(
packet
,
on_timeout
=
on_timeout
,
queue
=
queue
,
oid
=
oid
,
serial
=
serial
)
add_involved_nodes
(
node
)
except
ConnectionClosed
:
continue
...
...
@@ -1001,7 +1002,7 @@ class Application(ThreadedApplication):
packet
=
Packets
.
AskCheckCurrentSerial
(
ttid
,
serial
,
oid
)
for
node
,
conn
in
self
.
cp
.
iterateForObject
(
oid
):
try
:
conn
.
ask
(
packet
,
queue
=
queue
)
conn
.
ask
(
packet
,
queue
=
queue
,
oid
=
oid
,
serial
=
serial
)
except
ConnectionClosed
:
continue
checked_nodes
.
add
(
node
)
...
...
neo/client/handlers/storage.py
View file @
787586e6
...
...
@@ -62,28 +62,28 @@ class StorageAnswersHandler(AnswerBaseHandler):
def
answerObject
(
self
,
conn
,
oid
,
*
args
):
self
.
app
.
setHandlerData
(
args
)
def
answerStoreObject
(
self
,
conn
,
conflict
ing
,
oid
,
serial
):
def
answerStoreObject
(
self
,
conn
,
conflict
,
oid
,
serial
):
txn_context
=
self
.
app
.
getHandlerData
()
object_stored_counter_dict
=
txn_context
[
'object_stored_counter_dict'
][
oid
]
if
conflict
ing
:
if
conflict
:
# Warning: if a storage (S1) is much faster than another (S2), then
# we may process entirely a conflict with S1 (i.e. we received the
# answer to the store of the resolved object on S1) before we
# receive the conflict answer from the first store on S2.
logging
.
info
(
'%r report a conflict for %r with %r'
,
conn
,
dump
(
oid
),
dump
(
serial
))
conn
,
dump
(
oid
),
dump
(
conflict
))
# If this conflict is not already resolved, mark it for
# resolution.
if
serial
not
in
txn_context
[
if
conflict
not
in
txn_context
[
'resolved_conflict_serial_dict'
].
get
(
oid
,
()):
if
serial
in
object_stored_counter_dict
and
serial
!=
ZERO_TID
:
if
ZERO_TID
!=
conflict
in
object_stored_counter_dict
:
raise
NEOStorageError
(
'Storages %s accepted object %s'
' for serial %s but %s reports a conflict for it.'
%
(
map
(
dump
,
object_stored_counter_dict
[
serial
]),
dump
(
oid
),
dump
(
serial
),
dump
(
conn
.
getUUID
())))
map
(
dump
,
object_stored_counter_dict
[
conflict
]),
dump
(
oid
),
dump
(
conflict
),
dump
(
conn
.
getUUID
())))
conflict_serial_dict
=
txn_context
[
'conflict_serial_dict'
]
conflict_serial_dict
.
setdefault
(
oid
,
set
()).
add
(
serial
)
conflict_serial_dict
.
setdefault
(
oid
,
set
()).
add
(
conflict
)
else
:
uuid_set
=
object_stored_counter_dict
.
get
(
serial
)
if
uuid_set
is
None
:
# store to first storage node
...
...
neo/lib/protocol.py
View file @
787586e6
...
...
@@ -964,9 +964,7 @@ class StoreObject(Packet):
)
_answer
=
PStruct
(
'answer_store_object'
,
PBoolean
(
'conflicting'
),
POID
(
'oid'
),
PTID
(
'serial'
),
PTID
(
'conflict'
),
)
class
AbortTransaction
(
Packet
):
...
...
@@ -1274,11 +1272,7 @@ class CheckCurrentSerial(Packet):
POID
(
'oid'
),
)
_answer
=
PStruct
(
'answer_store_object'
,
PBoolean
(
'conflicting'
),
POID
(
'oid'
),
PTID
(
'serial'
),
)
_answer
=
StoreObject
.
_answer
class
Pack
(
Packet
):
"""
...
...
neo/storage/handlers/client.py
View file @
787586e6
...
...
@@ -77,7 +77,7 @@ class ClientOperationHandler(EventHandler):
checksum
,
data
,
data_serial
,
unlock
)
except
ConflictError
,
err
:
# resolvable or not
conn
.
answer
(
Packets
.
AnswerStoreObject
(
1
,
oid
,
err
.
tid
))
conn
.
answer
(
Packets
.
AnswerStoreObject
(
err
.
tid
))
except
DelayedError
:
# locked by a previous transaction, retry later
# If we are unlocking, we want queueEvent to raise
...
...
@@ -96,13 +96,13 @@ class ClientOperationHandler(EventHandler):
dump
(
oid
),
dump
(
serial
),
dump
(
ttid
),
dump
(
self
.
app
.
tm
.
getLockingTID
(
oid
)))
# send an answer as the client side is waiting for it
conn
.
answer
(
Packets
.
AnswerStoreObject
(
0
,
oid
,
serial
))
conn
.
answer
(
Packets
.
AnswerStoreObject
(
None
))
else
:
if
SLOW_STORE
is
not
None
:
duration
=
time
.
time
()
-
request_time
if
duration
>
SLOW_STORE
:
logging
.
info
(
'StoreObject delay: %.02fs'
,
duration
)
conn
.
answer
(
Packets
.
AnswerStoreObject
(
0
,
oid
,
serial
))
conn
.
answer
(
Packets
.
AnswerStoreObject
(
None
))
def
askStoreObject
(
self
,
conn
,
oid
,
serial
,
compression
,
checksum
,
data
,
data_serial
,
ttid
,
unlock
):
...
...
@@ -194,7 +194,7 @@ class ClientOperationHandler(EventHandler):
self
.
app
.
tm
.
checkCurrentSerial
(
ttid
,
serial
,
oid
)
except
ConflictError
,
err
:
# resolvable or not
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
1
,
oid
,
err
.
tid
))
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
err
.
tid
))
except
DelayedError
:
# locked by a previous transaction, retry later
try
:
...
...
@@ -208,13 +208,13 @@ class ClientOperationHandler(EventHandler):
dump
(
oid
),
dump
(
serial
),
dump
(
ttid
),
dump
(
self
.
app
.
tm
.
getLockingTID
(
oid
)))
# send an answer as the client side is waiting for it
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
0
,
oid
,
serial
))
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
None
))
else
:
if
SLOW_STORE
is
not
None
:
duration
=
time
.
time
()
-
request_time
if
duration
>
SLOW_STORE
:
logging
.
info
(
'CheckCurrentSerial delay: %.02fs'
,
duration
)
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
0
,
oid
,
serial
))
conn
.
answer
(
Packets
.
AnswerCheckCurrentSerial
(
None
))
# like ClientOperationHandler but read-only & only for tid <= backup_tid
...
...
neo/tests/threaded/test.py
View file @
787586e6
...
...
@@ -1340,11 +1340,11 @@ class Test(NEOThreadedTest):
reports a conflict after that this conflict was fully resolved with
another node.
"""
def
answerStoreObject
(
orig
,
conn
,
conflict
ing
,
*
args
):
if
not
conflict
ing
:
def
answerStoreObject
(
orig
,
conn
,
conflict
,
**
kw
):
if
not
conflict
:
p
.
revert
()
ll
()
orig
(
conn
,
conflict
ing
,
*
args
)
orig
(
conn
,
conflict
,
**
kw
)
if
1
:
s0
,
s1
=
cluster
.
storage_list
t1
,
c1
=
cluster
.
getTransaction
()
...
...
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