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
Iliya Manolov
neoppod
Commits
2c170443
Commit
2c170443
authored
Aug 23, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: fix undoLog() not asking storages with only FEEDING cells
parent
a10c4183
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
27 deletions
+13
-27
neo/client/app.py
neo/client/app.py
+1
-3
neo/lib/pt.py
neo/lib/pt.py
+0
-9
neo/tests/client/testClientApp.py
neo/tests/client/testClientApp.py
+1
-1
neo/tests/master/testMasterPT.py
neo/tests/master/testMasterPT.py
+3
-2
neo/tests/storage/testStorageApp.py
neo/tests/storage/testStorageApp.py
+5
-5
neo/tests/testPT.py
neo/tests/testPT.py
+3
-7
No files found.
neo/client/app.py
View file @
2c170443
...
@@ -898,12 +898,10 @@ class Application(object):
...
@@ -898,12 +898,10 @@ class Application(object):
# Each storage node will return TIDs only for UP_TO_DATE state and
# Each storage node will return TIDs only for UP_TO_DATE state and
# FEEDING state cells
# FEEDING state cells
pt
=
self
.
getPartitionTable
()
pt
=
self
.
getPartitionTable
()
storage_node_list
=
pt
.
getNodeList
()
queue
=
self
.
_getThreadQueue
()
queue
=
self
.
_getThreadQueue
()
packet
=
Packets
.
AskTIDs
(
first
,
last
,
INVALID_PARTITION
)
packet
=
Packets
.
AskTIDs
(
first
,
last
,
INVALID_PARTITION
)
tid_set
=
set
()
tid_set
=
set
()
for
storage_node
in
storage_node_list
:
for
storage_node
in
pt
.
getNodeSet
(
True
)
:
conn
=
self
.
cp
.
getConnForNode
(
storage_node
)
conn
=
self
.
cp
.
getConnForNode
(
storage_node
)
if
conn
is
None
:
if
conn
is
None
:
continue
continue
...
...
neo/lib/pt.py
View file @
2c170443
...
@@ -136,11 +136,6 @@ class PartitionTable(object):
...
@@ -136,11 +136,6 @@ class PartitionTable(object):
def
getConnectedNodeList
(
self
):
def
getConnectedNodeList
(
self
):
return
[
node
for
node
in
self
.
getNodeSet
()
if
node
.
isConnected
()]
return
[
node
for
node
in
self
.
getNodeSet
()
if
node
.
isConnected
()]
def
getNodeList
(
self
):
"""Return all used nodes."""
return
[
node
for
node
,
count
in
self
.
count_dict
.
iteritems
()
\
if
count
>
0
]
def
getCellList
(
self
,
offset
,
readable
=
False
):
def
getCellList
(
self
,
offset
,
readable
=
False
):
if
readable
:
if
readable
:
return
filter
(
Cell
.
isReadable
,
self
.
partition_list
[
offset
])
return
filter
(
Cell
.
isReadable
,
self
.
partition_list
[
offset
])
...
@@ -344,7 +339,3 @@ class MTPartitionTable(PartitionTable):
...
@@ -344,7 +339,3 @@ class MTPartitionTable(PartitionTable):
@
thread_safe
@
thread_safe
def
operational
(
self
,
*
args
,
**
kwargs
):
def
operational
(
self
,
*
args
,
**
kwargs
):
return
PartitionTable
.
operational
(
self
,
*
args
,
**
kwargs
)
return
PartitionTable
.
operational
(
self
,
*
args
,
**
kwargs
)
@
thread_safe
def
getNodeList
(
self
,
*
args
,
**
kwargs
):
return
PartitionTable
.
getNodeList
(
self
,
*
args
,
**
kwargs
)
neo/tests/client/testClientApp.py
View file @
2c170443
...
@@ -725,7 +725,7 @@ class ClientApplicationTests(NeoUnitTestBase):
...
@@ -725,7 +725,7 @@ class ClientApplicationTests(NeoUnitTestBase):
return
conn
return
conn
app
.
dispatcher
=
Dispatcher
()
app
.
dispatcher
=
Dispatcher
()
app
.
pt
=
Mock
({
app
.
pt
=
Mock
({
'getNode
Lis
t'
:
(
Mock
(),
Mock
()),
'getNode
Se
t'
:
(
Mock
(),
Mock
()),
})
})
app
.
cp
=
Mock
({
app
.
cp
=
Mock
({
'getConnForNode'
:
ReturnValues
(
answerTIDs
(
p1
),
answerTIDs
(
p2
)),
'getConnForNode'
:
ReturnValues
(
answerTIDs
(
p1
),
answerTIDs
(
p2
)),
...
...
neo/tests/master/testMasterPT.py
View file @
2c170443
...
@@ -40,7 +40,7 @@ class MasterPartitionTableTests(NeoUnitTestBase):
...
@@ -40,7 +40,7 @@ class MasterPartitionTableTests(NeoUnitTestBase):
self
.
assertEqual
(
len
(
part
),
0
)
self
.
assertEqual
(
len
(
part
),
0
)
self
.
assertEqual
(
len
(
pt
.
count_dict
),
0
)
self
.
assertEqual
(
len
(
pt
.
count_dict
),
0
)
# no nodes or cells for now
# no nodes or cells for now
self
.
assert
Equal
(
len
(
pt
.
getNodeList
()),
0
)
self
.
assert
False
(
pt
.
getNodeSet
()
)
for
x
in
xrange
(
num_partitions
):
for
x
in
xrange
(
num_partitions
):
self
.
assertEqual
(
len
(
pt
.
getCellList
(
x
)),
0
)
self
.
assertEqual
(
len
(
pt
.
getCellList
(
x
)),
0
)
self
.
assertEqual
(
len
(
pt
.
getCellList
(
x
,
True
)),
0
)
self
.
assertEqual
(
len
(
pt
.
getCellList
(
x
,
True
)),
0
)
...
@@ -209,7 +209,8 @@ class MasterPartitionTableTests(NeoUnitTestBase):
...
@@ -209,7 +209,8 @@ class MasterPartitionTableTests(NeoUnitTestBase):
def
checkPT
(
self
,
pt
,
exclude_empty
=
False
):
def
checkPT
(
self
,
pt
,
exclude_empty
=
False
):
new_pt
=
PartitionTable
(
pt
.
np
,
pt
.
nr
)
new_pt
=
PartitionTable
(
pt
.
np
,
pt
.
nr
)
new_pt
.
make
(
pt
.
getNodeList
()
if
exclude_empty
else
pt
.
count_dict
)
new_pt
.
make
(
node
for
node
,
count
in
pt
.
count_dict
.
iteritems
()
if
count
or
not
exclude_empty
)
self
.
assertEqual
(
self
.
_pt_states
(
pt
),
self
.
_pt_states
(
new_pt
))
self
.
assertEqual
(
self
.
_pt_states
(
pt
),
self
.
_pt_states
(
new_pt
))
def
update
(
self
,
pt
,
change_list
=
None
):
def
update
(
self
,
pt
,
change_list
=
None
):
...
...
neo/tests/storage/testStorageApp.py
View file @
2c170443
...
@@ -47,14 +47,14 @@ class StorageAppTests(NeoUnitTestBase):
...
@@ -47,14 +47,14 @@ class StorageAppTests(NeoUnitTestBase):
num_partitions
=
3
num_partitions
=
3
num_replicas
=
2
num_replicas
=
2
self
.
app
.
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
self
.
app
.
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
self
.
assert
Equal
(
self
.
app
.
pt
.
getNodeList
(),
[]
)
self
.
assert
False
(
self
.
app
.
pt
.
getNodeSet
()
)
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
for
x
in
xrange
(
num_partitions
):
for
x
in
xrange
(
num_partitions
):
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
# load an empty table
# load an empty table
self
.
app
.
loadPartitionTable
()
self
.
app
.
loadPartitionTable
()
self
.
assert
Equal
(
self
.
app
.
pt
.
getNodeList
(),
[]
)
self
.
assert
False
(
self
.
app
.
pt
.
getNodeSet
()
)
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
for
x
in
xrange
(
num_partitions
):
for
x
in
xrange
(
num_partitions
):
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
...
@@ -68,7 +68,7 @@ class StorageAppTests(NeoUnitTestBase):
...
@@ -68,7 +68,7 @@ class StorageAppTests(NeoUnitTestBase):
self
.
app
.
pt
.
setCell
(
0
,
master
,
CellStates
.
UP_TO_DATE
)
self
.
app
.
pt
.
setCell
(
0
,
master
,
CellStates
.
UP_TO_DATE
)
self
.
app
.
pt
.
setCell
(
0
,
storage
,
CellStates
.
UP_TO_DATE
)
self
.
app
.
pt
.
setCell
(
0
,
storage
,
CellStates
.
UP_TO_DATE
)
self
.
assertEqual
(
len
(
self
.
app
.
pt
.
getNode
Lis
t
()),
2
)
self
.
assertEqual
(
len
(
self
.
app
.
pt
.
getNode
Se
t
()),
2
)
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
for
x
in
xrange
(
num_partitions
):
for
x
in
xrange
(
num_partitions
):
if
x
==
0
:
if
x
==
0
:
...
@@ -77,7 +77,7 @@ class StorageAppTests(NeoUnitTestBase):
...
@@ -77,7 +77,7 @@ class StorageAppTests(NeoUnitTestBase):
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
# load an empty table, everything removed
# load an empty table, everything removed
self
.
app
.
loadPartitionTable
()
self
.
app
.
loadPartitionTable
()
self
.
assert
Equal
(
self
.
app
.
pt
.
getNodeList
(),
[]
)
self
.
assert
False
(
self
.
app
.
pt
.
getNodeSet
()
)
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
for
x
in
xrange
(
num_partitions
):
for
x
in
xrange
(
num_partitions
):
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
self
.
assertFalse
(
self
.
app
.
pt
.
hasOffset
(
x
))
...
@@ -85,7 +85,7 @@ class StorageAppTests(NeoUnitTestBase):
...
@@ -85,7 +85,7 @@ class StorageAppTests(NeoUnitTestBase):
# add some node
# add some node
self
.
app
.
pt
.
setCell
(
0
,
master
,
CellStates
.
UP_TO_DATE
)
self
.
app
.
pt
.
setCell
(
0
,
master
,
CellStates
.
UP_TO_DATE
)
self
.
app
.
pt
.
setCell
(
0
,
storage
,
CellStates
.
UP_TO_DATE
)
self
.
app
.
pt
.
setCell
(
0
,
storage
,
CellStates
.
UP_TO_DATE
)
self
.
assertEqual
(
len
(
self
.
app
.
pt
.
getNode
Lis
t
()),
2
)
self
.
assertEqual
(
len
(
self
.
app
.
pt
.
getNode
Se
t
()),
2
)
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
self
.
assertFalse
(
self
.
app
.
pt
.
filled
())
for
x
in
xrange
(
num_partitions
):
for
x
in
xrange
(
num_partitions
):
if
x
==
0
:
if
x
==
0
:
...
...
neo/tests/testPT.py
View file @
2c170443
...
@@ -240,7 +240,7 @@ class PartitionTableTests(NeoUnitTestBase):
...
@@ -240,7 +240,7 @@ class PartitionTableTests(NeoUnitTestBase):
self
.
assertEqual
(
len
(
part
),
0
)
self
.
assertEqual
(
len
(
part
),
0
)
self
.
assertEqual
(
len
(
pt
.
count_dict
),
0
)
self
.
assertEqual
(
len
(
pt
.
count_dict
),
0
)
def
test_07_getNode
Lis
t
(
self
):
def
test_07_getNode
Se
t
(
self
):
num_partitions
=
5
num_partitions
=
5
num_replicas
=
2
num_replicas
=
2
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
pt
=
PartitionTable
(
num_partitions
,
num_replicas
)
...
@@ -263,12 +263,8 @@ class PartitionTableTests(NeoUnitTestBase):
...
@@ -263,12 +263,8 @@ class PartitionTableTests(NeoUnitTestBase):
pt
.
setCell
(
0
,
sn4
,
CellStates
.
DISCARDED
)
# won't be added
pt
.
setCell
(
0
,
sn4
,
CellStates
.
DISCARDED
)
# won't be added
# must get only two node as feeding and discarded not taken
# must get only two node as feeding and discarded not taken
# into account
# into account
self
.
assertEqual
(
len
(
pt
.
getNodeList
()),
2
)
self
.
assertEqual
(
pt
.
getNodeSet
(
True
),
set
((
sn1
,
sn3
)))
nodes
=
pt
.
getNodeList
()
self
.
assertEqual
(
len
(
pt
.
getNodeSet
()),
3
)
self
.
assertTrue
(
sn1
in
nodes
)
self
.
assertTrue
(
sn2
in
nodes
)
self
.
assertTrue
(
sn3
not
in
nodes
)
self
.
assertTrue
(
sn4
not
in
nodes
)
def
test_08_filled
(
self
):
def
test_08_filled
(
self
):
num_partitions
=
5
num_partitions
=
5
...
...
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