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
Xavier Thompson
neoppod
Commits
be839e92
Commit
be839e92
authored
Dec 05, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
storage: speed up replication by not getting object next_serial for nothing
parent
c25e68bc
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
3 deletions
+42
-3
neo/storage/database/manager.py
neo/storage/database/manager.py
+14
-0
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+15
-0
neo/storage/database/sqlite.py
neo/storage/database/sqlite.py
+11
-0
neo/storage/handlers/storage.py
neo/storage/handlers/storage.py
+2
-3
No files found.
neo/storage/database/manager.py
View file @
be839e92
...
...
@@ -435,6 +435,20 @@ class DatabaseManager(object):
compression
,
checksum
,
data
,
None
if
data_serial
is
None
else
util
.
p64
(
data_serial
))
@
fallback
def
_fetchObject
(
self
,
oid
,
tid
):
r
=
self
.
_getObject
(
oid
,
tid
)
if
r
:
return
r
[:
1
]
+
r
[
2
:]
def
fetchObject
(
self
,
oid
,
tid
):
u64
=
util
.
u64
r
=
self
.
_fetchObject
(
u64
(
oid
),
u64
(
tid
))
if
r
:
serial
,
compression
,
checksum
,
data
,
data_serial
=
r
return
(
util
.
p64
(
serial
),
compression
,
checksum
,
data
,
None
if
data_serial
is
None
else
util
.
p64
(
data_serial
))
@
contextmanager
def
replicated
(
self
,
offset
):
readable_set
=
self
.
_readable_set
...
...
neo/storage/database/mysqldb.py
View file @
be839e92
...
...
@@ -698,6 +698,21 @@ class MySQLDatabaseManager(DatabaseManager):
if
r
:
return
[(
p64
(
tid
),
length
or
0
)
for
tid
,
length
in
r
]
def
_fetchObject
(
self
,
oid
,
tid
):
r
=
self
.
query
(
'SELECT tid, compression, data.hash, value, value_tid'
' FROM obj FORCE INDEX(`partition`)'
' LEFT JOIN data ON (obj.data_id = data.id)'
' WHERE `partition` = %d AND oid = %d AND tid = %d'
%
(
self
.
_getReadablePartition
(
oid
),
oid
,
tid
))
if
r
:
r
=
r
[
0
]
compression
=
r
[
1
]
if
compression
and
compression
&
0x80
:
return
(
r
[
0
],
compression
&
0x7f
,
r
[
2
],
''
.
join
(
self
.
_bigData
(
data
)),
r
[
4
])
return
r
def
getReplicationObjectList
(
self
,
min_tid
,
max_tid
,
length
,
partition
,
min_oid
):
u64
=
util
.
u64
...
...
neo/storage/database/sqlite.py
View file @
be839e92
...
...
@@ -532,6 +532,17 @@ class SQLiteDatabaseManager(DatabaseManager):
self
.
_getPackTID
(),
offset
,
length
))
]
or
None
def
_fetchObject
(
self
,
oid
,
tid
):
for
serial
,
compression
,
checksum
,
data
,
value_serial
in
self
.
query
(
'SELECT tid, compression, data.hash, value, value_tid'
' FROM obj LEFT JOIN data ON obj.data_id = data.id'
' WHERE partition=? AND oid=? AND tid=?'
,
(
self
.
_getReadablePartition
(
oid
),
oid
,
tid
)):
if
checksum
:
checksum
=
str
(
checksum
)
data
=
str
(
data
)
return
serial
,
compression
,
checksum
,
data
,
value_serial
def
getReplicationObjectList
(
self
,
min_tid
,
max_tid
,
length
,
partition
,
min_oid
):
u64
=
util
.
u64
...
...
neo/storage/handlers/storage.py
View file @
be839e92
...
...
@@ -255,15 +255,14 @@ class StorageOperationHandler(EventHandler):
if
not
oid_set
:
del
object_dict
[
serial
]
continue
object
=
dm
.
get
Object
(
oid
,
serial
)
object
=
dm
.
fetch
Object
(
oid
,
serial
)
if
not
object
:
conn
.
send
(
Errors
.
ReplicationError
(
"partition %u dropped or truncated"
%
partition
),
msg_id
)
return
# Same as in askFetchTransactions.
conn
.
send
(
Packets
.
AddObject
(
oid
,
serial
,
*
object
[
2
:]),
msg_id
)
conn
.
send
(
Packets
.
AddObject
(
oid
,
*
object
),
msg_id
)
yield
conn
.
buffering
conn
.
send
(
Packets
.
AnswerFetchObjects
(
pack_tid
,
next_tid
,
next_oid
,
object_dict
),
msg_id
)
...
...
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