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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
87c1de3b
Commit
87c1de3b
authored
Apr 17, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mysql: specify column families for RocksDB
parent
aa7b654f
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
18 deletions
+29
-18
neo/storage/database/mysqldb.py
neo/storage/database/mysqldb.py
+29
-18
No files found.
neo/storage/database/mysqldb.py
View file @
87c1de3b
...
@@ -295,6 +295,12 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -295,6 +295,12 @@ class MySQLDatabaseManager(DatabaseManager):
p
+=
""" PARTITION BY LIST (`partition`) (
p
+=
""" PARTITION BY LIST (`partition`) (
PARTITION dummy VALUES IN (NULL))"""
PARTITION dummy VALUES IN (NULL))"""
if
engine
==
"RocksDB"
:
cf
=
lambda
name
,
rev
=
False
:
" COMMENT '%scf_neo_%s'"
%
(
'rev:'
if
rev
else
''
,
name
)
else
:
cf
=
lambda
*
_
:
''
# The table "trans" stores information on committed transactions.
# The table "trans" stores information on committed transactions.
schema_dict
[
'trans'
]
=
"""CREATE TABLE %s (
schema_dict
[
'trans'
]
=
"""CREATE TABLE %s (
`partition` SMALLINT UNSIGNED NOT NULL,
`partition` SMALLINT UNSIGNED NOT NULL,
...
@@ -305,8 +311,8 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -305,8 +311,8 @@ class MySQLDatabaseManager(DatabaseManager):
description BLOB NOT NULL,
description BLOB NOT NULL,
ext BLOB NOT NULL,
ext BLOB NOT NULL,
ttid BIGINT UNSIGNED NOT NULL,
ttid BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`partition`, tid)
PRIMARY KEY (`partition`, tid)
{}
) ENGINE=
"""
+
p
) ENGINE=
{}"""
.
format
(
cf
(
'append_meta'
),
p
)
# The table "obj" stores committed object metadata.
# The table "obj" stores committed object metadata.
schema_dict
[
'obj'
]
=
"""CREATE TABLE %s (
schema_dict
[
'obj'
]
=
"""CREATE TABLE %s (
...
@@ -315,10 +321,11 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -315,10 +321,11 @@ class MySQLDatabaseManager(DatabaseManager):
tid BIGINT UNSIGNED NOT NULL,
tid BIGINT UNSIGNED NOT NULL,
data_id BIGINT UNSIGNED NULL,
data_id BIGINT UNSIGNED NULL,
value_tid BIGINT UNSIGNED NULL,
value_tid BIGINT UNSIGNED NULL,
PRIMARY KEY (`partition`, oid, tid),
PRIMARY KEY (`partition`, oid, tid){},
KEY tid (`partition`, tid, oid),
KEY tid (`partition`, tid, oid){},
KEY (data_id)
KEY (data_id){}
) ENGINE="""
+
p
) ENGINE={}"""
.
format
(
cf
(
'obj_pk'
,
True
),
cf
(
'append_meta'
),
cf
(
'append_meta'
),
p
)
if
engine
==
"TokuDB"
:
if
engine
==
"TokuDB"
:
engine
+=
" compression='tokudb_uncompressed'"
engine
+=
" compression='tokudb_uncompressed'"
...
@@ -326,18 +333,21 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -326,18 +333,21 @@ class MySQLDatabaseManager(DatabaseManager):
# The table "data" stores object data.
# The table "data" stores object data.
# We'd like to have partial index on 'hash' column (e.g. hash(4))
# We'd like to have partial index on 'hash' column (e.g. hash(4))
# but 'UNIQUE' constraint would not work as expected.
# but 'UNIQUE' constraint would not work as expected.
schema_dict
[
'data'
]
=
"""CREATE TABLE %
%
s (
schema_dict
[
'data'
]
=
"""CREATE TABLE %s (
id BIGINT UNSIGNED NOT NULL
PRIMARY KEY
,
id BIGINT UNSIGNED NOT NULL,
hash BINARY(20) NOT NULL,
hash BINARY(20) NOT NULL,
compression TINYINT UNSIGNED NULL,
compression TINYINT UNSIGNED NULL,
value MEDIUMBLOB NOT NULL%s
value MEDIUMBLOB NOT NULL,
) ENGINE=%s"""
%
(
""",
PRIMARY KEY (id){}{}
UNIQUE (hash, compression)"""
if
dedup
else
""
,
engine
)
) ENGINE={}"""
.
format
(
cf
(
'append'
),
""",
UNIQUE (hash, compression)"""
+
cf
(
'no_comp'
)
if
dedup
else
""
,
engine
)
schema_dict
[
'bigdata'
]
=
"""CREATE TABLE %s (
schema_dict
[
'bigdata'
]
=
"""CREATE TABLE %s (
id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
value MEDIUMBLOB NOT NULL
value MEDIUMBLOB NOT NULL,
) ENGINE="""
+
engine
PRIMARY KEY (id){}
) ENGINE={}"""
.
format
(
cf
(
'append'
),
p
)
# The table "ttrans" stores information on uncommitted transactions.
# The table "ttrans" stores information on uncommitted transactions.
schema_dict
[
'ttrans'
]
=
"""CREATE TABLE %s (
schema_dict
[
'ttrans'
]
=
"""CREATE TABLE %s (
...
@@ -348,8 +358,9 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -348,8 +358,9 @@ class MySQLDatabaseManager(DatabaseManager):
user BLOB NOT NULL,
user BLOB NOT NULL,
description BLOB NOT NULL,
description BLOB NOT NULL,
ext BLOB NOT NULL,
ext BLOB NOT NULL,
ttid BIGINT UNSIGNED NOT NULL
ttid BIGINT UNSIGNED NOT NULL,
) ENGINE="""
+
engine
PRIMARY KEY (ttid){}
) ENGINE={}"""
.
format
(
cf
(
'no_comp'
),
p
)
# The table "tobj" stores uncommitted object metadata.
# The table "tobj" stores uncommitted object metadata.
schema_dict
[
'tobj'
]
=
"""CREATE TABLE %s (
schema_dict
[
'tobj'
]
=
"""CREATE TABLE %s (
...
@@ -358,8 +369,8 @@ class MySQLDatabaseManager(DatabaseManager):
...
@@ -358,8 +369,8 @@ class MySQLDatabaseManager(DatabaseManager):
tid BIGINT UNSIGNED NOT NULL,
tid BIGINT UNSIGNED NOT NULL,
data_id BIGINT UNSIGNED NULL,
data_id BIGINT UNSIGNED NULL,
value_tid BIGINT UNSIGNED NULL,
value_tid BIGINT UNSIGNED NULL,
PRIMARY KEY (tid, oid)
PRIMARY KEY (tid, oid)
{}
) ENGINE=
"""
+
engine
) ENGINE=
{}"""
.
format
(
cf
(
'no_comp'
),
p
)
if
self
.
nonempty
(
'config'
)
is
None
:
if
self
.
nonempty
(
'config'
)
is
None
:
q
(
schema_dict
.
pop
(
'config'
)
%
'config'
)
q
(
schema_dict
.
pop
(
'config'
)
%
'config'
)
...
...
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