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
156da51c
Commit
156da51c
authored
Apr 19, 2018
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: do not full-scan for duplicates of big oids if deduplication is disabled
parent
a63b45fe
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
14 deletions
+30
-14
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+22
-11
neo/tests/threaded/test.py
neo/tests/threaded/test.py
+3
-3
neo/tests/threaded/testSSL.py
neo/tests/threaded/testSSL.py
+5
-0
No files found.
neo/storage/database/mysqldb.py
View file @
156da51c
...
...
@@ -164,6 +164,13 @@ class MySQLDatabaseManager(DatabaseManager):
" Minimal value must be %uk."
%
(
name
,
self
.
_max_allowed_packet
//
1024
))
self
.
_max_allowed_packet
=
int
(
value
)
try
:
self
.
_dedup
=
bool
(
query
(
"SHOW INDEX FROM data WHERE key_name='hash'"
))
except
ProgrammingError
as
e
:
if
e
.
args
[
0
]
!=
NO_SUCH_TABLE
:
raise
self
.
_dedup
=
None
_connect
=
auto_reconnect
(
_tryConnect
)
...
...
@@ -322,6 +329,9 @@ class MySQLDatabaseManager(DatabaseManager):
for
table
,
schema
in
schema_dict
.
iteritems
():
q
(
schema
%
(
'IF NOT EXISTS '
+
table
))
if
self
.
_dedup
is
None
:
self
.
_dedup
=
dedup
self
.
_uncommitted_data
.
update
(
q
(
"SELECT data_id, count(*)"
" FROM tobj WHERE data_id IS NOT NULL GROUP BY data_id"
))
...
...
@@ -608,6 +618,7 @@ class MySQLDatabaseManager(DatabaseManager):
if
0x1000000
<=
len
(
data
):
# 16M (MEDIUMBLOB limit)
compression
|=
0x80
q
=
self
.
query
if
self
.
_dedup
:
for
r
,
d
in
q
(
"SELECT id, value FROM data"
" WHERE hash='%s' AND compression=%s"
%
(
checksum
,
compression
)):
...
...
neo/tests/threaded/test.py
View file @
156da51c
...
...
@@ -60,9 +60,9 @@ class PCounterWithResolution(PCounter):
class
Test
(
NEOThreadedTest
):
@
with_cluster
()
def
testBasicStore
(
self
,
cluster
)
:
if
1
:
def
testBasicStore
(
self
,
dedup
=
False
):
with
NEOCluster
(
dedup
=
dedup
)
as
cluster
:
cluster
.
start
()
storage
=
cluster
.
getZODBStorage
()
storage
.
sync
()
storage
.
app
.
max_reconnection_to_master
=
0
...
...
neo/tests/threaded/testSSL.py
View file @
156da51c
...
...
@@ -37,6 +37,11 @@ class SSLTests(SSLMixin, test.Test):
testStorageDataLock2
=
None
testUndoConflictDuringStore
=
None
# With MySQL, this test is expensive.
# Let's check deduplication of big oids here.
def
testBasicStore
(
self
):
super
(
SSLTests
,
self
).
testBasicStore
(
True
)
def
testAbortConnection
(
self
,
after_handshake
=
1
):
with
self
.
getLoopbackConnection
()
as
conn
:
conn
.
ask
(
Packets
.
Ping
())
...
...
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