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
15369269
Commit
15369269
authored
Mar 21, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: allow the master to change our node id
This is not used currently.
parent
e8473a23
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
13 deletions
+28
-13
neo/storage/database/importer.py
neo/storage/database/importer.py
+7
-0
neo/storage/database/manager.py
neo/storage/database/manager.py
+21
-13
No files found.
neo/storage/database/importer.py
View file @
15369269
...
...
@@ -399,6 +399,13 @@ class ImporterDatabaseManager(DatabaseManager):
def
_updateReadable
(
self
):
raise
AssertionError
def
setUUID
(
self
,
nid
):
old_nid
=
self
.
getUUID
()
if
old_nid
:
assert
old_nid
==
nid
,
(
old_nid
,
nid
)
else
:
self
.
setConfiguration
(
'nid'
,
str
(
nid
))
def
changePartitionTable
(
self
,
*
args
,
**
kw
):
self
.
db
.
changePartitionTable
(
*
args
,
**
kw
)
if
self
.
_writeback
:
...
...
neo/storage/database/manager.py
View file @
15369269
...
...
@@ -271,6 +271,18 @@ class DatabaseManager(object):
def
_setConfiguration
(
self
,
key
,
value
):
""""""
def
_changePartitionTable
(
self
,
cell_list
,
reset
=
False
):
"""Change a part of a partition table. The list of cells is
a tuple of tuples, each of which consists of an offset (row ID),
the NID of a storage node, and a cell state. If reset is True,
existing data is first thrown away.
"""
def
_getPartitionTable
(
self
):
"""Return a whole partition table as a sequence of rows. Each row
is again a tuple of an offset (row ID), the NID of a storage
node, and a cell state."""
def
getUUID
(
self
):
"""
Load a NID from a database.
...
...
@@ -279,10 +291,18 @@ class DatabaseManager(object):
if
nid
is
not
None
:
return
int
(
nid
)
@
requires
(
_changePartitionTable
,
_getPartitionTable
)
def
setUUID
(
self
,
nid
):
"""
Store a NID into a database.
"""
old_nid
=
self
.
getUUID
()
if
nid
!=
old_nid
:
if
old_nid
:
self
.
_changePartitionTable
((
offset
,
x
,
tid
)
for
offset
,
x
,
tid
in
self
.
_getPartitionTable
()
if
x
==
old_nid
for
x
,
tid
in
((
x
,
None
),
(
nid
,
tid
)))
self
.
setConfiguration
(
'nid'
,
str
(
nid
))
def
getNumPartitions
(
self
):
...
...
@@ -511,11 +531,6 @@ class DatabaseManager(object):
return
(
util
.
p64
(
serial
),
compression
,
checksum
,
data
,
None
if
data_serial
is
None
else
util
.
p64
(
data_serial
))
def
_getPartitionTable
(
self
):
"""Return a whole partition table as a sequence of rows. Each row
is again a tuple of an offset (row ID), the NID of a storage
node, and a cell state."""
@
requires
(
_getPartitionTable
)
def
_iterAssignedCells
(
self
):
my_nid
=
self
.
getUUID
()
...
...
@@ -537,13 +552,6 @@ class DatabaseManager(object):
finally
:
readable_set
.
remove
(
offset
)
def
_changePartitionTable
(
self
,
cell_list
,
reset
=
False
):
"""Change a part of a partition table. The list of cells is
a tuple of tuples, each of which consists of an offset (row ID),
the NID of a storage node, and a cell state. If reset is True,
existing data is first thrown away.
"""
def
_getDataLastId
(
self
,
partition
):
"""
"""
...
...
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