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
Vincent Pelletier
neoppod
Commits
00ea89c3
Commit
00ea89c3
authored
Jan 04, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qa: do more checks on the partition table in testReplicationBlockedByUnfinished
parent
d3cb8888
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
12 deletions
+21
-12
neo/lib/pt.py
neo/lib/pt.py
+13
-9
neo/tests/threaded/__init__.py
neo/tests/threaded/__init__.py
+3
-0
neo/tests/threaded/testReplication.py
neo/tests/threaded/testReplication.py
+5
-3
No files found.
neo/lib/pt.py
View file @
00ea89c3
...
@@ -258,30 +258,34 @@ class PartitionTable(object):
...
@@ -258,30 +258,34 @@ class PartitionTable(object):
partition on the line (here, line length is 11 to keep the docstring
partition on the line (here, line length is 11 to keep the docstring
width under 80 column).
width under 80 column).
"""
"""
node_list
=
sorted
(
self
.
count_dict
)
result
=
[
'pt: node %u: %s, %s'
%
(
i
,
uuid_str
(
node
.
getUUID
()),
result
=
[
'pt: node %u: %s, %s'
%
(
i
,
uuid_str
(
node
.
getUUID
()),
protocol
.
node_state_prefix_dict
[
node
.
getState
()])
protocol
.
node_state_prefix_dict
[
node
.
getState
()])
for
i
,
node
in
enumerate
(
node_list
)]
for
i
,
node
in
enumerate
(
sorted
(
self
.
count_dict
)
)]
append
=
result
.
append
append
=
result
.
append
line
=
[]
line
=
[]
max_line_len
=
20
# XXX: hardcoded number of partitions per line
max_line_len
=
20
# XXX: hardcoded number of partitions per line
cell_state_dict
=
protocol
.
cell_state_prefix_dict
prefix
=
0
prefix
=
0
prefix_len
=
int
(
math
.
ceil
(
math
.
log10
(
self
.
np
)))
prefix_len
=
int
(
math
.
ceil
(
math
.
log10
(
self
.
np
)))
for
offset
,
row
in
enumerate
(
self
.
partition_list
):
for
offset
,
row
in
enumerate
(
self
.
formatRows
()
):
if
len
(
line
)
==
max_line_len
:
if
len
(
line
)
==
max_line_len
:
append
(
'pt: %0*u: %s'
%
(
prefix_len
,
prefix
,
'|'
.
join
(
line
)))
append
(
'pt: %0*u: %s'
%
(
prefix_len
,
prefix
,
'|'
.
join
(
line
)))
line
=
[]
line
=
[]
prefix
=
offset
prefix
=
offset
line
.
append
(
row
)
if
line
:
append
(
'pt: %0*u: %s'
%
(
prefix_len
,
prefix
,
'|'
.
join
(
line
)))
return
result
def
formatRows
(
self
):
node_list
=
sorted
(
self
.
count_dict
)
cell_state_dict
=
protocol
.
cell_state_prefix_dict
for
row
in
self
.
partition_list
:
if
row
is
None
:
if
row
is
None
:
line
.
append
(
'X'
*
len
(
node_list
)
)
yield
'X'
*
len
(
node_list
)
else
:
else
:
cell_dict
=
{
x
.
getNode
():
cell_state_dict
[
x
.
getState
()]
cell_dict
=
{
x
.
getNode
():
cell_state_dict
[
x
.
getState
()]
for
x
in
row
}
for
x
in
row
}
line
.
append
(
''
.
join
(
cell_dict
.
get
(
x
,
'.'
)
for
x
in
node_list
))
yield
''
.
join
(
cell_dict
.
get
(
x
,
'.'
)
for
x
in
node_list
)
if
line
:
append
(
'pt: %0*u: %s'
%
(
prefix_len
,
prefix
,
'|'
.
join
(
line
)))
return
result
def
operational
(
self
):
def
operational
(
self
):
if
not
self
.
filled
():
if
not
self
.
filled
():
...
...
neo/tests/threaded/__init__.py
View file @
00ea89c3
...
@@ -929,6 +929,9 @@ class NEOThreadedTest(NeoTestBase):
...
@@ -929,6 +929,9 @@ class NEOThreadedTest(NeoTestBase):
with
Patch
(
client
,
_getFinalTID
=
lambda
*
_
:
None
):
with
Patch
(
client
,
_getFinalTID
=
lambda
*
_
:
None
):
self
.
assertRaises
(
ConnectionClosed
,
txn
.
commit
)
self
.
assertRaises
(
ConnectionClosed
,
txn
.
commit
)
def
assertPartitionTable
(
self
,
cluster
,
stats
):
self
.
assertEqual
(
stats
,
'|'
.
join
(
cluster
.
admin
.
pt
.
formatRows
()))
def
predictable_random
(
seed
=
None
):
def
predictable_random
(
seed
=
None
):
# Because we have 2 running threads when client works, we can't
# Because we have 2 running threads when client works, we can't
...
...
neo/tests/threaded/testReplication.py
View file @
00ea89c3
...
@@ -502,6 +502,7 @@ class ReplicationTests(NEOThreadedTest):
...
@@ -502,6 +502,7 @@ class ReplicationTests(NEOThreadedTest):
storage
=
cluster
.
getZODBStorage
()
storage
=
cluster
.
getZODBStorage
()
oid
=
storage
.
new_oid
()
oid
=
storage
.
new_oid
()
tid
=
None
tid
=
None
expected
=
'UO'
for
n
in
1
,
0
:
for
n
in
1
,
0
:
# On first iteration, the transaction will block replication
# On first iteration, the transaction will block replication
# until tpc_finish.
# until tpc_finish.
...
@@ -517,12 +518,13 @@ class ReplicationTests(NEOThreadedTest):
...
@@ -517,12 +518,13 @@ class ReplicationTests(NEOThreadedTest):
cluster
.
enableStorageList
((
s1
,))
cluster
.
enableStorageList
((
s1
,))
cluster
.
neoctl
.
tweakPartitionTable
()
cluster
.
neoctl
.
tweakPartitionTable
()
self
.
tic
()
self
.
tic
()
self
.
assert
Equal
(
n
,
len
(
cluster
.
getOutdatedCells
())
)
self
.
assert
PartitionTable
(
cluster
,
expected
)
storage
.
tpc_vote
(
txn
)
storage
.
tpc_vote
(
txn
)
self
.
assert
Equal
(
n
,
len
(
cluster
.
getOutdatedCells
())
)
self
.
assert
PartitionTable
(
cluster
,
expected
)
tid
=
storage
.
tpc_finish
(
txn
)
tid
=
storage
.
tpc_finish
(
txn
)
self
.
tic
()
# replication resumes and ends
self
.
tic
()
# replication resumes and ends
self
.
assertFalse
(
cluster
.
getOutdatedCells
())
expected
=
'UU'
self
.
assertPartitionTable
(
cluster
,
expected
)
self
.
assertEqual
(
cluster
.
neoctl
.
getClusterState
(),
self
.
assertEqual
(
cluster
.
neoctl
.
getClusterState
(),
ClusterStates
.
RUNNING
)
ClusterStates
.
RUNNING
)
finally
:
finally
:
...
...
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