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
Levin Zimmermann
neoppod
Commits
ad81d3fd
Commit
ad81d3fd
authored
Nov 09, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Some code cleanup
parent
20964f4f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
21 additions
and
25 deletions
+21
-25
neo/client/app.py
neo/client/app.py
+0
-1
neo/lib/event.py
neo/lib/event.py
+12
-14
neo/master/app.py
neo/master/app.py
+1
-1
neo/master/pt.py
neo/master/pt.py
+0
-1
neo/master/transactions.py
neo/master/transactions.py
+1
-1
neo/tests/master/testTransactions.py
neo/tests/master/testTransactions.py
+7
-7
No files found.
neo/client/app.py
View file @
ad81d3fd
...
...
@@ -330,7 +330,6 @@ class Application(object):
neo
.
lib
.
logging
.
error
(
'Connection to %s lost'
,
self
.
trying_master_node
)
self
.
primary_master_node
=
None
continue
neo
.
lib
.
logging
.
info
(
"Connected and ready"
)
return
conn
...
...
neo/lib/event.py
View file @
ad81d3fd
...
...
@@ -143,13 +143,12 @@ class EpollEventManager(object):
try
:
conn
=
self
.
connection_dict
[
fd
]
except
KeyError
:
pass
else
:
conn
.
lock
()
try
:
conn
.
writable
()
finally
:
conn
.
unlock
()
continue
conn
.
lock
()
try
:
conn
.
writable
()
finally
:
conn
.
unlock
()
for
fd
in
elist
:
# This can fail, if a connection is closed in previous calls to
...
...
@@ -157,13 +156,12 @@ class EpollEventManager(object):
try
:
conn
=
self
.
connection_dict
[
fd
]
except
KeyError
:
pass
else
:
conn
.
lock
()
try
:
conn
.
readable
()
finally
:
conn
.
unlock
()
continue
conn
.
lock
()
try
:
conn
.
readable
()
finally
:
conn
.
unlock
()
if
conn
.
hasPendingMessages
():
self
.
_addPendingConnection
(
conn
)
...
...
neo/master/app.py
View file @
ad81d3fd
...
...
@@ -55,7 +55,7 @@ class Application(object):
self
.
storage_readiness
=
set
()
master_addresses
,
connector_name
=
config
.
getMasters
()
self
.
connector_handler
=
getConnectorHandler
(
connector_name
)
for
master_address
in
master_addresses
:
for
master_address
in
master_addresses
:
self
.
nm
.
createMaster
(
address
=
master_address
)
neo
.
lib
.
logging
.
debug
(
'IP address is %s, port is %d'
,
*
(
self
.
server
))
...
...
neo/master/pt.py
View file @
ad81d3fd
...
...
@@ -140,7 +140,6 @@ class PartitionTable(PartitionTable):
# update the partition table
cell_list
=
[
self
.
setCell
(
offset
,
node
,
CellStates
.
UP_TO_DATE
)]
cell_list
=
[(
offset
,
uuid
,
CellStates
.
UP_TO_DATE
)]
# If the partition contains a feeding cell, drop it now.
for
feeding_cell
in
self
.
getCellList
(
offset
):
...
...
neo/master/transactions.py
View file @
ad81d3fd
...
...
@@ -357,7 +357,7 @@ class TransactionManager(object):
# will be finished
for
txn
in
self
.
_ttid_dict
.
itervalues
():
txn
.
registerForNotification
(
uuid
)
return
se
t
(
self
.
_ttid_dict
)
return
se
lf
.
_ttid_dict
.
keys
(
)
def
begin
(
self
,
node
,
tid
=
None
):
"""
...
...
neo/tests/master/testTransactions.py
View file @
ad81d3fd
...
...
@@ -70,7 +70,7 @@ class testTransactionManager(NeoUnitTestBase):
callback
=
Mock
()
txnman
=
TransactionManager
(
on_commit
=
callback
)
self
.
assertFalse
(
txnman
.
hasPending
())
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
set
()
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
[]
)
# begin the transaction
ttid
=
txnman
.
begin
(
node
)
self
.
assertTrue
(
ttid
is
not
None
)
...
...
@@ -79,7 +79,7 @@ class testTransactionManager(NeoUnitTestBase):
# prepare the transaction
tid
=
txnman
.
prepare
(
ttid
,
1
,
oid_list
,
uuid_list
,
msg_id
)
self
.
assertTrue
(
txnman
.
hasPending
())
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
set
([
ttid
])
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
[
ttid
]
)
txn
=
txnman
[
ttid
]
self
.
assertEqual
(
txn
.
getTID
(),
tid
)
self
.
assertEqual
(
txn
.
getUUIDList
(),
list
(
uuid_list
))
...
...
@@ -91,7 +91,7 @@ class testTransactionManager(NeoUnitTestBase):
self
.
assertEqual
(
len
(
callback
.
getNamedCalls
(
'__call__'
)),
1
)
# transaction finished
txnman
.
remove
(
client_uuid
,
ttid
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
set
()
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
[]
)
def
testAbortFor
(
self
):
oid_list
=
[
self
.
makeOID
(
1
),
]
...
...
@@ -100,18 +100,18 @@ class testTransactionManager(NeoUnitTestBase):
client_uuid
,
client
=
self
.
makeNode
(
3
)
txnman
=
TransactionManager
(
lambda
tid
,
txn
:
None
)
# register 4 transactions made by two nodes
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
set
()
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
[]
)
ttid1
=
txnman
.
begin
(
client
)
tid1
=
txnman
.
prepare
(
ttid1
,
1
,
oid_list
,
[
storage_1_uuid
],
1
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
set
([
ttid1
])
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
[
ttid1
]
)
# abort transactions of another node, transaction stays
txnman
.
abortFor
(
node2
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
set
([
ttid1
])
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
[
ttid1
]
)
# abort transactions of requesting node, transaction is not removed
# because the transaction is prepared and must remains until the end of
# the 2PC
txnman
.
abortFor
(
node1
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
set
([
ttid1
])
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
[
ttid1
]
)
self
.
assertTrue
(
txnman
.
hasPending
())
# ...and the lock is available
txnman
.
begin
(
client
,
self
.
getNextTID
())
...
...
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