Merge lp:~stewart/drizzle/lsmtree into lp:drizzle

Proposed by Stewart Smith
Status: Merged
Merged at revision: 2636
Proposed branch: lp:~stewart/drizzle/lsmtree
Merge into: lp:drizzle
Diff against target: 299 lines (+131/-6)
10 files modified
drizzled/message.cc (+3/-0)
drizzled/message/statement_transform.cc (+3/-0)
drizzled/message/table.proto (+1/-0)
drizzled/sql_yacc.yy (+6/-3)
drizzled/symbol_hash.gperf (+1/-0)
plugin/tableprototester/tableprototester.cc (+85/-3)
plugin/tableprototester/tests/r/basic.result (+1/-0)
plugin/tableprototester/tests/r/lsmtree.result (+22/-0)
plugin/tableprototester/tests/t/lsmtree-master.opt (+1/-0)
plugin/tableprototester/tests/t/lsmtree.test (+8/-0)
To merge this branch: bzr merge lp:~stewart/drizzle/lsmtree
Reviewer Review Type Date Requested Status
Drizzle Trunk Pending
Review via email: mp+153282@code.launchpad.net

Description of the change

The WiredTiger engine (being worked on in another branch) can support Log Structured Merge Trees. We want to be able to create them using normal syntax.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'drizzled/message.cc'
--- drizzled/message.cc 2011-08-16 11:47:29 +0000
+++ drizzled/message.cc 2013-03-14 03:53:22 +0000
@@ -68,6 +68,7 @@
68static const std::string RTREE("RTREE");68static const std::string RTREE("RTREE");
69static const std::string HASH("HASH");69static const std::string HASH("HASH");
70static const std::string FULLTEXT("FULLTEXT");70static const std::string FULLTEXT("FULLTEXT");
71static const std::string LSMTREE("LSMTREE");
7172
72static const std::string MATCH_FULL("FULL");73static const std::string MATCH_FULL("FULL");
73static const std::string MATCH_PARTIAL("PARTIAL");74static const std::string MATCH_PARTIAL("PARTIAL");
@@ -227,6 +228,8 @@
227 return HASH;228 return HASH;
228 case message::Table::Index::FULLTEXT:229 case message::Table::Index::FULLTEXT:
229 return FULLTEXT;230 return FULLTEXT;
231 case message::Table::Index::LSMTREE:
232 return LSMTREE;
230 }233 }
231234
232 assert(0);235 assert(0);
233236
=== modified file 'drizzled/message/statement_transform.cc'
--- drizzled/message/statement_transform.cc 2011-08-16 11:47:29 +0000
+++ drizzled/message/statement_transform.cc 2013-03-14 03:53:22 +0000
@@ -1254,6 +1254,9 @@
1254 case Table::Index::FULLTEXT:1254 case Table::Index::FULLTEXT:
1255 destination.append(" USING FULLTEXT");1255 destination.append(" USING FULLTEXT");
1256 break;1256 break;
1257 case Table::Index::LSMTREE:
1258 destination.append(" USING LSMTREE");
1259 break;
1257 }1260 }
12581261
1259 if (index.has_comment())1262 if (index.has_comment())
12601263
=== modified file 'drizzled/message/table.proto'
--- drizzled/message/table.proto 2011-08-16 11:47:29 +0000
+++ drizzled/message/table.proto 2013-03-14 03:53:22 +0000
@@ -149,6 +149,7 @@
149 RTREE = 2;149 RTREE = 2;
150 HASH = 3;150 HASH = 3;
151 FULLTEXT = 4;151 FULLTEXT = 4;
152 LSMTREE = 5;
152 }153 }
153154
154 message IndexPart {155 message IndexPart {
155156
=== modified file 'drizzled/sql_yacc.yy'
--- drizzled/sql_yacc.yy 2013-03-03 01:46:08 +0000
+++ drizzled/sql_yacc.yy 2013-03-14 03:53:22 +0000
@@ -390,6 +390,7 @@
390%token LOGS_SYM390%token LOGS_SYM
391%token LONG_NUM391%token LONG_NUM
392%token LONG_SYM392%token LONG_SYM
393%token LSMTREE_SYM
393%token MATCH /* SQL-2003-R */394%token MATCH /* SQL-2003-R */
394%token MAX_SYM /* SQL-2003-N */395%token MAX_SYM /* SQL-2003-N */
395%token MAX_VALUE_SYM /* SQL-2003-N */396%token MAX_VALUE_SYM /* SQL-2003-N */
@@ -703,7 +704,7 @@
703 key_type opt_unique constraint_key_type704 key_type opt_unique constraint_key_type
704705
705%type <key_alg>706%type <key_alg>
706 btree_or_rtree707 index_algorithm
707708
708%type <string_list>709%type <string_list>
709 using_list710 using_list
@@ -1768,7 +1769,7 @@
1768 ;1769 ;
17691770
1770key_using_alg:1771key_using_alg:
1771 USING btree_or_rtree { ((statement::CreateTable *)Lex.statement)->key_create_info.algorithm= $2; }1772 USING index_algorithm { ((statement::CreateTable *)Lex.statement)->key_create_info.algorithm= $2; }
1772 ;1773 ;
17731774
1774key_opt:1775key_opt:
@@ -1779,9 +1780,10 @@
1779 { ((statement::CreateTable *)Lex.statement)->key_create_info.comment= $2; }1780 { ((statement::CreateTable *)Lex.statement)->key_create_info.comment= $2; }
1780 ;1781 ;
17811782
1782btree_or_rtree:1783index_algorithm:
1783 BTREE_SYM { $$= drizzled::message::Table::Index::BTREE; }1784 BTREE_SYM { $$= drizzled::message::Table::Index::BTREE; }
1784 | HASH_SYM { $$= drizzled::message::Table::Index::HASH; }1785 | HASH_SYM { $$= drizzled::message::Table::Index::HASH; }
1786 | LSMTREE_SYM { $$= drizzled::message::Table::Index::LSMTREE; }
1785 ;1787 ;
17861788
1787key_list:1789key_list:
@@ -5315,6 +5317,7 @@
5315 | LOCAL_SYM {}5317 | LOCAL_SYM {}
5316 | LOCKS_SYM {}5318 | LOCKS_SYM {}
5317 | LOGS_SYM {}5319 | LOGS_SYM {}
5320 | LSMTREE_SYM {}
5318 | MAX_VALUE_SYM {}5321 | MAX_VALUE_SYM {}
5319 | MEDIUM_SYM {}5322 | MEDIUM_SYM {}
5320 | MERGE_SYM {}5323 | MERGE_SYM {}
53215324
=== modified file 'drizzled/symbol_hash.gperf'
--- drizzled/symbol_hash.gperf 2012-01-29 11:21:19 +0000
+++ drizzled/symbol_hash.gperf 2013-03-14 03:53:22 +0000
@@ -233,6 +233,7 @@
233LONG, LONG_SYM233LONG, LONG_SYM
234LONGBLOB, BLOB_SYM234LONGBLOB, BLOB_SYM
235LONGTEXT, TEXT_SYM235LONGTEXT, TEXT_SYM
236LSMTREE, LSMTREE_SYM
236MATCH, MATCH237MATCH, MATCH
237MAXVALUE, MAX_VALUE_SYM238MAXVALUE, MAX_VALUE_SYM
238MEDIUM, MEDIUM_SYM239MEDIUM, MEDIUM_SYM
239240
=== modified file 'plugin/tableprototester/tableprototester.cc'
--- plugin/tableprototester/tableprototester.cc 2013-03-03 01:46:08 +0000
+++ plugin/tableprototester/tableprototester.cc 2013-03-14 03:53:22 +0000
@@ -113,6 +113,7 @@
113 set_of_identifiers.push_back(identifier::Table(schema_identifier, "t1"));113 set_of_identifiers.push_back(identifier::Table(schema_identifier, "t1"));
114 set_of_identifiers.push_back(identifier::Table(schema_identifier, "too_many_enum_values"));114 set_of_identifiers.push_back(identifier::Table(schema_identifier, "too_many_enum_values"));
115 set_of_identifiers.push_back(identifier::Table(schema_identifier, "invalid_table_collation"));115 set_of_identifiers.push_back(identifier::Table(schema_identifier, "invalid_table_collation"));
116 set_of_identifiers.push_back(identifier::Table(schema_identifier, "lsmtree"));
116 }117 }
117}118}
118119
@@ -124,6 +125,8 @@
124 return true;125 return true;
125 if (not identifier.getPath().compare("local/test/invalid_table_collation"))126 if (not identifier.getPath().compare("local/test/invalid_table_collation"))
126 return true;127 return true;
128 if (not identifier.getPath().compare("local/test/lsmtree"))
129 return true;
127130
128 return false;131 return false;
129}132}
@@ -145,9 +148,19 @@
145148
146int TableProtoTesterEngine::doCreateTable(Session&,149int TableProtoTesterEngine::doCreateTable(Session&,
147 Table&,150 Table&,
148 const drizzled::identifier::Table&,151 const drizzled::identifier::Table& identifier,
149 const drizzled::message::Table&)152 const drizzled::message::Table& create_proto)
150{153{
154 if (not identifier.getPath().compare("local/test/lsmtree_create"))
155 {
156 if (create_proto.indexes_size() < 1)
157 return -1;
158 if (create_proto.indexes(0).type() != message::Table::Index::LSMTREE)
159 return -2;
160
161 return 0;
162 }
163
151 return EEXIST;164 return EEXIST;
152}165}
153166
@@ -235,6 +248,64 @@
235248
236}249}
237250
251static void fill_lsmtree(message::Table &table)
252{
253 message::Table::Field *field;
254 message::Table::TableOptions *tableopts;
255
256 table.set_name("lsmtree");
257 table.set_schema("test");
258 table.set_type(message::Table::STANDARD);
259 message::Engine *engine= table.mutable_engine();
260 engine->set_name("TABLEPROTOTESTER");
261 table.set_creation_timestamp(0);
262 table.set_update_timestamp(0);
263
264 tableopts= table.mutable_options();
265 tableopts->set_comment("LSM Tree test");
266 tableopts->set_collation_id(my_charset_bin.number);
267 tableopts->set_collation(my_charset_bin.name);
268
269 {
270 field= table.add_field();
271 field->set_name("a");
272 field->set_type(message::Table::Field::INTEGER);
273 }
274 {
275 field= table.add_field();
276 field->set_name("b");
277 field->set_type(message::Table::Field::INTEGER);
278 }
279 {
280 field= table.add_field();
281 field->set_name("c");
282 field->set_type(message::Table::Field::INTEGER);
283 }
284
285 {
286 message::Table::Index *index= table.add_indexes();
287 index->set_name("PRIMARY");
288 index->set_is_primary(true);
289 index->set_is_unique(true);
290 index->set_type(message::Table::Index::BTREE);
291 index->set_key_length(sizeof(uint32_t));
292 message::Table::Index::IndexPart *part= index->add_index_part();
293 part->set_fieldnr(0);
294 part->set_compare_length(sizeof(uint32_t));
295 }
296
297 {
298 message::Table::Index *index= table.add_indexes();
299 index->set_name("mylsm");
300 index->set_type(message::Table::Index::LSMTREE);
301 index->set_key_length(sizeof(uint32_t));
302 message::Table::Index::IndexPart *part= index->add_index_part();
303 part->set_fieldnr(1);
304 part->set_compare_length(sizeof(uint32_t));
305 }
306
307}
308
238int TableProtoTesterEngine::doGetTableDefinition(Session&,309int TableProtoTesterEngine::doGetTableDefinition(Session&,
239 const drizzled::identifier::Table &identifier,310 const drizzled::identifier::Table &identifier,
240 drizzled::message::Table &table_proto)311 drizzled::message::Table &table_proto)
@@ -254,11 +325,22 @@
254 fill_table_invalid_table_collation(table_proto);325 fill_table_invalid_table_collation(table_proto);
255 return EEXIST;326 return EEXIST;
256 }327 }
328 else if (not identifier.getPath().compare("local/test/lsmtree"))
329 {
330 fill_lsmtree(table_proto);
331 return EEXIST;
332 }
257 return ENOENT;333 return ENOENT;
258}334}
259335
260const char *TableProtoTesterCursor::index_type(uint32_t)336const char *TableProtoTesterCursor::index_type(uint32_t idx)
261{337{
338 if (strcmp(getShare()->getTableName(), "lsmtree") == 0)
339 {
340 if (idx == 1)
341 return "LSMTREE";
342 }
343
262 return("BTREE");344 return("BTREE");
263}345}
264346
265347
=== modified file 'plugin/tableprototester/tests/r/basic.result'
--- plugin/tableprototester/tests/r/basic.result 2010-12-03 01:17:59 +0000
+++ plugin/tableprototester/tests/r/basic.result 2013-03-14 03:53:22 +0000
@@ -1,5 +1,6 @@
1SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="test" ORDER BY TABLE_NAME;1SELECT TABLE_SCHEMA, TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA="test" ORDER BY TABLE_NAME;
2TABLE_SCHEMA TABLE_NAME2TABLE_SCHEMA TABLE_NAME
3test invalid_table_collation3test invalid_table_collation
4test lsmtree
4test t15test t1
5test too_many_enum_values6test too_many_enum_values
67
=== added file 'plugin/tableprototester/tests/r/lsmtree.result'
--- plugin/tableprototester/tests/r/lsmtree.result 1970-01-01 00:00:00 +0000
+++ plugin/tableprototester/tests/r/lsmtree.result 2013-03-14 03:53:22 +0000
@@ -0,0 +1,22 @@
1use test;
2show tables like 'lsm%';
3Tables_in_test (lsm%)
4lsmtree
5SHOW CREATE TABLE lsmtree;
6Table Create Table
7lsmtree CREATE TABLE `lsmtree` (
8 `a` INT,
9 `b` INT,
10 `c` INT,
11 PRIMARY KEY (`a`) USING BTREE,
12 KEY `mylsm` (`b`) USING LSMTREE
13) ENGINE=TABLEPROTOTESTER COMMENT='LSM Tree test' COLLATE = binary
14SHOW INDEX FROM lsmtree;
15Table Unique Key_name Seq_in_index Column_name
16lsmtree YES PRIMARY 1 a
17lsmtree NO mylsm 1 b
18SELECT INDEX_NAME,INDEX_TYPE,INDEX_COMMENT FROM DATA_DICTIONARY.INDEXES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='lsmtree';
19INDEX_NAME INDEX_TYPE INDEX_COMMENT
20PRIMARY BTREE NULL
21mylsm LSMTREE NULL
22CREATE TABLE lsmtree_create (a int, index(a) USING LSMTREE) ENGINE=TABLEPROTOTESTER;
023
=== added file 'plugin/tableprototester/tests/t/lsmtree-master.opt'
--- plugin/tableprototester/tests/t/lsmtree-master.opt 1970-01-01 00:00:00 +0000
+++ plugin/tableprototester/tests/t/lsmtree-master.opt 2013-03-14 03:53:22 +0000
@@ -0,0 +1,1 @@
1--plugin-add=tableprototester
0\ No newline at end of file2\ No newline at end of file
13
=== added file 'plugin/tableprototester/tests/t/lsmtree.test'
--- plugin/tableprototester/tests/t/lsmtree.test 1970-01-01 00:00:00 +0000
+++ plugin/tableprototester/tests/t/lsmtree.test 2013-03-14 03:53:22 +0000
@@ -0,0 +1,8 @@
1use test;
2show tables like 'lsm%';
3SHOW CREATE TABLE lsmtree;
4SHOW INDEX FROM lsmtree;
5SELECT INDEX_NAME,INDEX_TYPE,INDEX_COMMENT FROM DATA_DICTIONARY.INDEXES WHERE TABLE_SCHEMA='test' AND TABLE_NAME='lsmtree';
6# We don't really create a table, we're checking parser and proto creation
7# so we don't need to drop it afterwards.
8CREATE TABLE lsmtree_create (a int, index(a) USING LSMTREE) ENGINE=TABLEPROTOTESTER;
0\ No newline at end of file9\ No newline at end of file

Subscribers

People subscribed via source and target branches

to all changes: