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
Carlos Ramos Carreño
neoppod
Commits
51995dde
Commit
51995dde
authored
Apr 16, 2024
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wip
parent
d9200f28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
10 deletions
+14
-10
neo/storage/database/mysql.py
neo/storage/database/mysql.py
+6
-4
neo/storage/database/sqlite.py
neo/storage/database/sqlite.py
+8
-6
No files found.
neo/storage/database/mysql.py
View file @
51995dde
...
...
@@ -623,13 +623,15 @@ class MySQLDatabaseManager(MVCCDatabaseManager):
sql
=
[
"REPLACE INTO %s VALUES "
%
obj_table
]
values_max
=
self
.
_max_allowed_packet
-
len
(
sql
[
0
])
values_size
=
0
row_list
=
[]
for
oid
,
data_id
,
value_serial
in
object_list
:
oid
=
u64
(
oid
)
partition
=
self
.
_getPartition
(
oid
)
value
=
"(%s,%s,%s,%s,%s),"
%
(
partition
,
oid
,
tid
,
row_list
.
append
((
self
.
_getPartition
(
oid
),
oid
,
'NULL'
if
data_id
is
None
else
data_id
,
u64
(
value_serial
)
if
value_serial
else
'NULL'
)
u64
(
value_serial
)
if
value_serial
else
'NULL'
))
row_list
.
sort
()
row_list
=
map
((
"(%%s,%%s,%s,%%s,%%s),"
%
tid
).
__mod__
,
row_list
)
for
value
in
row_list
:
values_size
+=
len
(
value
)
# actually: max_values < values_size + EXTRA - len(final comma)
# (test_max_allowed_packet checks that EXTRA == 2)
...
...
neo/storage/database/sqlite.py
View file @
51995dde
...
...
@@ -488,21 +488,23 @@ class SQLiteDatabaseManager(DatabaseManager):
T
=
't'
if
temporary
else
''
obj_sql
=
"INSERT OR FAIL INTO %sobj VALUES (?,?,?,?,?)"
%
T
q
=
self
.
query
row_list
=
[]
for
oid
,
data_id
,
value_serial
in
object_list
:
oid
=
u64
(
oid
)
partition
=
self
.
_getPartition
(
oid
)
if
value_serial
:
value_serial
=
u64
(
value_serial
)
row_list
.
append
((
self
.
_getPartition
(
oid
),
oid
,
tid
,
data_id
,
value_serial
and
u64
(
value_serial
)))
row_list
.
sort
()
for
row
in
row_list
:
try
:
q
(
obj_sql
,
(
partition
,
oid
,
tid
,
data_id
,
value_serial
)
)
q
(
obj_sql
,
row
)
except
sqlite3
.
IntegrityError
:
# This may happen if a previous replication of 'obj' was
# interrupted.
if
not
T
:
r
,
=
q
(
"SELECT data_id, value_tid FROM obj"
" WHERE partition=? AND oid=? AND tid=?"
,
(
partition
,
oid
,
tid
)
)
if
r
==
(
data_id
,
value_serial
)
:
row
[:
3
]
)
if
r
==
row
[
3
:]
:
continue
raise
if
transaction
:
...
...
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