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
Ivan Tyagov
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
Show 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):
...
@@ -330,7 +330,6 @@ class Application(object):
neo
.
lib
.
logging
.
error
(
'Connection to %s lost'
,
neo
.
lib
.
logging
.
error
(
'Connection to %s lost'
,
self
.
trying_master_node
)
self
.
trying_master_node
)
self
.
primary_master_node
=
None
self
.
primary_master_node
=
None
continue
neo
.
lib
.
logging
.
info
(
"Connected and ready"
)
neo
.
lib
.
logging
.
info
(
"Connected and ready"
)
return
conn
return
conn
...
...
neo/lib/event.py
View file @
ad81d3fd
...
@@ -143,8 +143,7 @@ class EpollEventManager(object):
...
@@ -143,8 +143,7 @@ class EpollEventManager(object):
try
:
try
:
conn
=
self
.
connection_dict
[
fd
]
conn
=
self
.
connection_dict
[
fd
]
except
KeyError
:
except
KeyError
:
pass
continue
else
:
conn
.
lock
()
conn
.
lock
()
try
:
try
:
conn
.
writable
()
conn
.
writable
()
...
@@ -157,8 +156,7 @@ class EpollEventManager(object):
...
@@ -157,8 +156,7 @@ class EpollEventManager(object):
try
:
try
:
conn
=
self
.
connection_dict
[
fd
]
conn
=
self
.
connection_dict
[
fd
]
except
KeyError
:
except
KeyError
:
pass
continue
else
:
conn
.
lock
()
conn
.
lock
()
try
:
try
:
conn
.
readable
()
conn
.
readable
()
...
...
neo/master/app.py
View file @
ad81d3fd
...
@@ -55,7 +55,7 @@ class Application(object):
...
@@ -55,7 +55,7 @@ class Application(object):
self
.
storage_readiness
=
set
()
self
.
storage_readiness
=
set
()
master_addresses
,
connector_name
=
config
.
getMasters
()
master_addresses
,
connector_name
=
config
.
getMasters
()
self
.
connector_handler
=
getConnectorHandler
(
connector_name
)
self
.
connector_handler
=
getConnectorHandler
(
connector_name
)
for
master_address
in
master_addresses
:
for
master_address
in
master_addresses
:
self
.
nm
.
createMaster
(
address
=
master_address
)
self
.
nm
.
createMaster
(
address
=
master_address
)
neo
.
lib
.
logging
.
debug
(
'IP address is %s, port is %d'
,
*
(
self
.
server
))
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):
...
@@ -140,7 +140,6 @@ class PartitionTable(PartitionTable):
# update the partition table
# update the partition table
cell_list
=
[
self
.
setCell
(
offset
,
node
,
CellStates
.
UP_TO_DATE
)]
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.
# If the partition contains a feeding cell, drop it now.
for
feeding_cell
in
self
.
getCellList
(
offset
):
for
feeding_cell
in
self
.
getCellList
(
offset
):
...
...
neo/master/transactions.py
View file @
ad81d3fd
...
@@ -357,7 +357,7 @@ class TransactionManager(object):
...
@@ -357,7 +357,7 @@ class TransactionManager(object):
# will be finished
# will be finished
for
txn
in
self
.
_ttid_dict
.
itervalues
():
for
txn
in
self
.
_ttid_dict
.
itervalues
():
txn
.
registerForNotification
(
uuid
)
txn
.
registerForNotification
(
uuid
)
return
se
t
(
self
.
_ttid_dict
)
return
se
lf
.
_ttid_dict
.
keys
(
)
def
begin
(
self
,
node
,
tid
=
None
):
def
begin
(
self
,
node
,
tid
=
None
):
"""
"""
...
...
neo/tests/master/testTransactions.py
View file @
ad81d3fd
...
@@ -70,7 +70,7 @@ class testTransactionManager(NeoUnitTestBase):
...
@@ -70,7 +70,7 @@ class testTransactionManager(NeoUnitTestBase):
callback
=
Mock
()
callback
=
Mock
()
txnman
=
TransactionManager
(
on_commit
=
callback
)
txnman
=
TransactionManager
(
on_commit
=
callback
)
self
.
assertFalse
(
txnman
.
hasPending
())
self
.
assertFalse
(
txnman
.
hasPending
())
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
set
()
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
[]
)
# begin the transaction
# begin the transaction
ttid
=
txnman
.
begin
(
node
)
ttid
=
txnman
.
begin
(
node
)
self
.
assertTrue
(
ttid
is
not
None
)
self
.
assertTrue
(
ttid
is
not
None
)
...
@@ -79,7 +79,7 @@ class testTransactionManager(NeoUnitTestBase):
...
@@ -79,7 +79,7 @@ class testTransactionManager(NeoUnitTestBase):
# prepare the transaction
# prepare the transaction
tid
=
txnman
.
prepare
(
ttid
,
1
,
oid_list
,
uuid_list
,
msg_id
)
tid
=
txnman
.
prepare
(
ttid
,
1
,
oid_list
,
uuid_list
,
msg_id
)
self
.
assertTrue
(
txnman
.
hasPending
())
self
.
assertTrue
(
txnman
.
hasPending
())
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
set
([
ttid
])
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
[
ttid
]
)
txn
=
txnman
[
ttid
]
txn
=
txnman
[
ttid
]
self
.
assertEqual
(
txn
.
getTID
(),
tid
)
self
.
assertEqual
(
txn
.
getTID
(),
tid
)
self
.
assertEqual
(
txn
.
getUUIDList
(),
list
(
uuid_list
))
self
.
assertEqual
(
txn
.
getUUIDList
(),
list
(
uuid_list
))
...
@@ -91,7 +91,7 @@ class testTransactionManager(NeoUnitTestBase):
...
@@ -91,7 +91,7 @@ class testTransactionManager(NeoUnitTestBase):
self
.
assertEqual
(
len
(
callback
.
getNamedCalls
(
'__call__'
)),
1
)
self
.
assertEqual
(
len
(
callback
.
getNamedCalls
(
'__call__'
)),
1
)
# transaction finished
# transaction finished
txnman
.
remove
(
client_uuid
,
ttid
)
txnman
.
remove
(
client_uuid
,
ttid
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
set
()
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
uuid1
),
[]
)
def
testAbortFor
(
self
):
def
testAbortFor
(
self
):
oid_list
=
[
self
.
makeOID
(
1
),
]
oid_list
=
[
self
.
makeOID
(
1
),
]
...
@@ -100,18 +100,18 @@ class testTransactionManager(NeoUnitTestBase):
...
@@ -100,18 +100,18 @@ class testTransactionManager(NeoUnitTestBase):
client_uuid
,
client
=
self
.
makeNode
(
3
)
client_uuid
,
client
=
self
.
makeNode
(
3
)
txnman
=
TransactionManager
(
lambda
tid
,
txn
:
None
)
txnman
=
TransactionManager
(
lambda
tid
,
txn
:
None
)
# register 4 transactions made by two nodes
# 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
)
ttid1
=
txnman
.
begin
(
client
)
tid1
=
txnman
.
prepare
(
ttid1
,
1
,
oid_list
,
[
storage_1_uuid
],
1
)
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
# abort transactions of another node, transaction stays
txnman
.
abortFor
(
node2
)
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
# abort transactions of requesting node, transaction is not removed
# because the transaction is prepared and must remains until the end of
# because the transaction is prepared and must remains until the end of
# the 2PC
# the 2PC
txnman
.
abortFor
(
node1
)
txnman
.
abortFor
(
node1
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
set
([
ttid1
])
)
self
.
assertEqual
(
txnman
.
registerForNotification
(
storage_1_uuid
),
[
ttid1
]
)
self
.
assertTrue
(
txnman
.
hasPending
())
self
.
assertTrue
(
txnman
.
hasPending
())
# ...and the lock is available
# ...and the lock is available
txnman
.
begin
(
client
,
self
.
getNextTID
())
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