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
Xavier Thompson
neoppod
Commits
9ed4c4f2
Commit
9ed4c4f2
authored
Aug 23, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: wait no tid is locked in the range being checked
parent
1cdf18b6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
19 deletions
+32
-19
neo/storage/app.py
neo/storage/app.py
+11
-10
neo/storage/checker.py
neo/storage/checker.py
+10
-5
neo/storage/handlers/storage.py
neo/storage/handlers/storage.py
+11
-4
No files found.
neo/storage/app.py
View file @
9ed4c4f2
...
...
@@ -338,9 +338,9 @@ class Application(object):
if
not
node
.
isHidden
():
break
def
queueEvent
(
self
,
some_callable
,
conn
,
args
,
key
=
None
,
def
queueEvent
(
self
,
some_callable
,
conn
=
None
,
args
=
()
,
key
=
None
,
raise_on_duplicate
=
True
):
msg_id
=
conn
.
getPeerId
()
msg_id
=
None
if
conn
is
None
else
conn
.
getPeerId
()
event_queue_dict
=
self
.
event_queue_dict
if
raise_on_duplicate
and
key
in
event_queue_dict
:
raise
AlreadyPendingError
()
...
...
@@ -362,14 +362,15 @@ class Application(object):
event_queue_dict
[
key
]
-=
1
if
event_queue_dict
[
key
]
==
0
:
del
event_queue_dict
[
key
]
if
conn
.
isClosed
():
continue
orig_msg_id
=
conn
.
getPeerId
()
try
:
conn
.
setPeerId
(
msg_id
)
some_callable
(
conn
,
*
args
)
finally
:
conn
.
setPeerId
(
orig_msg_id
)
if
conn
is
None
:
some_callable
(
*
args
)
elif
not
conn
.
isClosed
():
orig_msg_id
=
conn
.
getPeerId
()
try
:
conn
.
setPeerId
(
msg_id
)
some_callable
(
conn
,
*
args
)
finally
:
conn
.
setPeerId
(
orig_msg_id
)
def
logQueuedEvents
(
self
):
if
self
.
event_queue
is
None
:
...
...
neo/storage/checker.py
View file @
9ed4c4f2
...
...
@@ -104,11 +104,16 @@ class Checker(object):
self
.
next_oid
=
None
self
.
partition
=
partition
self
.
source
=
source
args
=
partition
,
CHECK_COUNT
,
min_tid
,
max_tid
p
=
Packets
.
AskCheckTIDRange
(
*
args
)
for
conn
,
identified
in
self
.
conn_dict
.
items
():
self
.
conn_dict
[
conn
]
=
conn
.
ask
(
p
)
if
identified
else
None
self
.
conn_dict
[
None
]
=
app
.
dm
.
checkTIDRange
(
*
args
)
def
start
():
if
app
.
tm
.
isLockedTid
(
max_tid
):
app
.
queueEvent
(
start
)
return
args
=
partition
,
CHECK_COUNT
,
min_tid
,
max_tid
p
=
Packets
.
AskCheckTIDRange
(
*
args
)
for
conn
,
identified
in
self
.
conn_dict
.
items
():
self
.
conn_dict
[
conn
]
=
conn
.
ask
(
p
)
if
identified
else
None
self
.
conn_dict
[
None
]
=
app
.
dm
.
checkTIDRange
(
*
args
)
start
()
def
connected
(
self
,
node
):
conn
=
node
.
getConnection
()
...
...
neo/storage/handlers/storage.py
View file @
9ed4c4f2
...
...
@@ -144,29 +144,36 @@ class StorageOperationHandler(EventHandler):
@
checkFeedingConnection
(
check
=
True
)
def
askCheckTIDRange
(
self
,
conn
,
*
args
):
app
=
self
.
app
if
app
.
tm
.
isLockedTid
(
args
[
3
]):
# max_tid
app
.
queueEvent
(
self
.
askCheckTIDRange
,
conn
,
args
)
return
msg_id
=
conn
.
getPeerId
()
conn
=
weakref
.
proxy
(
conn
)
def
check
():
r
=
self
.
app
.
dm
.
checkTIDRange
(
*
args
)
r
=
app
.
dm
.
checkTIDRange
(
*
args
)
try
:
conn
.
answer
(
Packets
.
AnswerCheckTIDRange
(
*
r
),
msg_id
)
except
(
weakref
.
ReferenceError
,
ConnectorConnectionClosedException
):
pass
yield
self
.
app
.
newTask
(
check
())
app
.
newTask
(
check
())
@
checkFeedingConnection
(
check
=
True
)
def
askCheckSerialRange
(
self
,
conn
,
*
args
):
app
=
self
.
app
if
app
.
tm
.
isLockedTid
(
args
[
3
]):
# max_tid
raise
ProtocolError
(
"transactions must be checked before objects"
)
msg_id
=
conn
.
getPeerId
()
conn
=
weakref
.
proxy
(
conn
)
def
check
():
r
=
self
.
app
.
dm
.
checkSerialRange
(
*
args
)
r
=
app
.
dm
.
checkSerialRange
(
*
args
)
try
:
conn
.
answer
(
Packets
.
AnswerCheckSerialRange
(
*
r
),
msg_id
)
except
(
weakref
.
ReferenceError
,
ConnectorConnectionClosedException
):
pass
yield
self
.
app
.
newTask
(
check
())
app
.
newTask
(
check
())
@
checkFeedingConnection
(
check
=
False
)
def
askFetchTransactions
(
self
,
conn
,
partition
,
length
,
min_tid
,
max_tid
,
...
...
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