Merge lp:~stewart/drizzle/tableshare-use-tableidentifier into lp:~drizzle-trunk/drizzle/development

Proposed by Stewart Smith
Status: Work in progress
Proposed branch: lp:~stewart/drizzle/tableshare-use-tableidentifier
Merge into: lp:~drizzle-trunk/drizzle/development
Diff against target: 1271 lines (+305/-150)
37 files modified
drizzled/catalog/local.cc (+9/-1)
drizzled/catalog/local.h (+4/-1)
drizzled/data_home.cc (+2/-12)
drizzled/data_home.h (+0/-2)
drizzled/drizzled.cc (+1/-1)
drizzled/errmsg_print.cc (+1/-1)
drizzled/function/str/load_file.cc (+3/-2)
drizzled/identifier/catalog.cc (+1/-1)
drizzled/identifier/catalog.h (+7/-1)
drizzled/identifier/schema.cc (+6/-3)
drizzled/identifier/schema.h (+3/-0)
drizzled/identifier/table.cc (+7/-3)
drizzled/identifier/table.h (+2/-2)
drizzled/main.cc (+0/-5)
drizzled/session.cc (+2/-2)
drizzled/sql_load.cc (+3/-2)
drizzled/table/instance/base.cc (+20/-28)
drizzled/table/instance/base.h (+5/-6)
plugin/innobase/dict/dict0dict.cc (+13/-2)
plugin/innobase/handler/ha_innodb.cc (+28/-1)
plugin/innobase/tests/r/innodb-system-table-view.result (+9/-9)
plugin/schema_engine/schema.cc (+10/-3)
plugin/table_cache_dictionary/tests/r/table_cache.result (+2/-2)
plugin/table_cache_dictionary/tests/r/table_definition_cache.result (+2/-2)
plugin/tableprototester/tableprototester.cc (+8/-8)
plugin/transaction_log/hexdump_transaction_message.cc (+1/-1)
plugin/transaction_log/module.cc (+1/-1)
plugin/transaction_log/print_transaction_message.cc (+1/-1)
plugin/transaction_log/tests/r/bug660779.result (+6/-6)
plugin/transaction_log/tests/r/bug911643.result (+71/-0)
plugin/transaction_log/tests/r/variables.result (+1/-1)
plugin/transaction_log/tests/t/bug660779.test (+3/-3)
plugin/transaction_log/tests/t/bug911643-master.opt (+1/-0)
plugin/transaction_log/tests/t/bug911643.test (+28/-0)
tests/r/broken_table_proto_file.result (+1/-1)
tests/r/show_check.result (+28/-28)
unittests/table_identifier.cc (+15/-8)
To merge this branch: bzr merge lp:~stewart/drizzle/tableshare-use-tableidentifier
Reviewer Review Type Date Requested Status
Brian Aker Pending
Drizzle Merge Team Pending
Review via email: mp+87557@code.launchpad.net

Description of the change

This switches TableShare over to use an identifier instead of two strings (db and table_name).

This makes one change to some appearances of a couple of data_dictionary tables. Odds are these were always incorrect (IIRC all I_S table names should be all UPPER_CASE anyway - because SQL loves to shout).

http://jenkins.drizzle.org/view/Drizzle-param/job/drizzle-param/914/

To post a comment you must log in.

Unmerged revisions

2489. By Stewart Smith

merge table_identifier unittest fix

2488. By Stewart Smith

TableShare use a TableIdentifier instead of db,table strings.

2487. By Stewart Smith

merge print_transaction_message filename/path bug fix (also hit in testing CATALOG)

2486. By Stewart Smith

merge off-by-one error message fix (was hitting this)

2485. By Stewart Smith

Schema identifier has a Catalog identifier. Use it instead of catalog::local_identifier() in most places in Schema identifier code

2484. By Stewart Smith

update innodb-system-table-view.result to include CATALOG in path to table

2483. By Stewart Smith

modify tableprototester to include local/ in the path for the test tables

2482. By Stewart Smith

modify transaction_log plugin to default to local/transaction.log to keep backwards compatibility with old drizzled (before chdir to local/ was removed)

2481. By Stewart Smith

no longer chdir into local CATALOG. Instead, generate paths everywhere (well... in identifiers) that include the path to the correct CATALOG. Currently that's just LOCAL, but we get closer. Also added is some backwards compatibility code in InnoDB for old data dictionary entries that didn't include CATALOG in catalog/db/table but just had db/table. The next step is to construct the table and schema identifiers with the current CATALOG.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'drizzled/catalog/local.cc'
2--- drizzled/catalog/local.cc 2011-09-18 17:33:22 +0000
3+++ drizzled/catalog/local.cc 2012-01-05 00:31:36 +0000
4@@ -1,7 +1,7 @@
5 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
6 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
7 *
8- * Copyright (C) 2010 Brian Aker
9+ * Copyright (C) 2010-2011 Brian Aker, Stewart Smith
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13@@ -42,6 +42,14 @@
14 return default_catalog;
15 }
16
17+void resetPath_for_local_identifier()
18+{
19+ /* this is currently commented out to do nothing as we don't need
20+ to reset the relative path ../local to anything but that.
21+ We will need to enable this when we don't chdir into local on startup */
22+// default_catalog.resetPath();
23+}
24+
25 Instance::shared_ptr local()
26 {
27 boost::call_once(&init, run_once);
28
29=== modified file 'drizzled/catalog/local.h'
30--- drizzled/catalog/local.h 2011-03-23 23:34:24 +0000
31+++ drizzled/catalog/local.h 2012-01-05 00:31:36 +0000
32@@ -1,7 +1,7 @@
33 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
34 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
35 *
36- * Copyright (C) 2010 Brian Aker
37+ * Copyright (C) 2010-2011 Brian Aker, Stewart Smith
38 *
39 * This program is free software; you can redistribute it and/or modify
40 * it under the terms of the GNU General Public License as published by
41@@ -28,6 +28,9 @@
42 namespace drizzled {
43 namespace catalog {
44
45+/* only for use by drizzled after command line parsing (new datadir) */
46+void resetPath_for_local_identifier();
47+
48 DRIZZLED_API const identifier::Catalog& local_identifier();
49 DRIZZLED_API Instance::shared_ptr local();
50
51
52=== modified file 'drizzled/data_home.cc'
53--- drizzled/data_home.cc 2011-06-16 15:27:28 +0000
54+++ drizzled/data_home.cc 2012-01-05 00:31:36 +0000
55@@ -1,7 +1,7 @@
56 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
57 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
58 *
59- * Copyright (C) 2011 Brian Aker
60+ * Copyright (C) 2011 Brian Aker, Stewart Smith
61 *
62 * This program is free software; you can redistribute it and/or modify
63 * it under the terms of the GNU General Public License as published by
64@@ -22,12 +22,12 @@
65 #include <boost/filesystem.hpp>
66 #include <drizzled/configmake.h>
67 #include <drizzled/data_home.h>
68+#include <drizzled/catalog.h>
69
70 namespace drizzled {
71
72 static boost::filesystem::path data_home(LOCALSTATEDIR);
73 static boost::filesystem::path full_data_home(LOCALSTATEDIR);
74-static boost::filesystem::path data_home_catalog(LOCALSTATEDIR);
75
76 const boost::filesystem::path& getFullDataHome()
77 {
78@@ -39,11 +39,6 @@
79 return data_home;
80 }
81
82-const boost::filesystem::path& getDataHomeCatalog()
83-{
84- return data_home_catalog;
85-}
86-
87 boost::filesystem::path& getMutableDataHome()
88 {
89 return data_home;
90@@ -54,9 +49,4 @@
91 full_data_home= v;
92 }
93
94-void setDataHomeCatalog(const boost::filesystem::path& v)
95-{
96- data_home_catalog= v;
97-}
98-
99 } // namespace drizzled
100
101=== modified file 'drizzled/data_home.h'
102--- drizzled/data_home.h 2011-06-16 15:27:28 +0000
103+++ drizzled/data_home.h 2012-01-05 00:31:36 +0000
104@@ -26,10 +26,8 @@
105
106 DRIZZLED_API const boost::filesystem::path& getFullDataHome();
107 DRIZZLED_API const boost::filesystem::path& getDataHome();
108-DRIZZLED_API const boost::filesystem::path& getDataHomeCatalog();
109 DRIZZLED_API boost::filesystem::path& getMutableDataHome();
110 DRIZZLED_API void setFullDataHome(const boost::filesystem::path&);
111-DRIZZLED_API void setDataHomeCatalog(const boost::filesystem::path&);
112
113 } /* namespace drizzled */
114
115
116=== modified file 'drizzled/drizzled.cc'
117--- drizzled/drizzled.cc 2012-01-03 01:17:08 +0000
118+++ drizzled/drizzled.cc 2012-01-05 00:31:36 +0000
119@@ -1977,7 +1977,7 @@
120 */
121 static void get_options()
122 {
123- setDataHomeCatalog(getDataHome() / "local");
124+ catalog::resetPath_for_local_identifier();
125
126 if (vm.count("user"))
127 {
128
129=== modified file 'drizzled/errmsg_print.cc'
130--- drizzled/errmsg_print.cc 2011-10-20 02:45:57 +0000
131+++ drizzled/errmsg_print.cc 2012-01-05 00:31:36 +0000
132@@ -74,7 +74,7 @@
133
134 if (not extra.empty())
135 {
136- if (message.at(message.size()) != ' ')
137+ if (message.at(message.size()-1) != ' ')
138 message+= " ";
139
140 message+= "'";
141
142=== modified file 'drizzled/function/str/load_file.cc'
143--- drizzled/function/str/load_file.cc 2011-06-22 22:23:29 +0000
144+++ drizzled/function/str/load_file.cc 2012-01-05 00:31:36 +0000
145@@ -2,6 +2,7 @@
146 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
147 *
148 * Copyright (C) 2008 Sun Microsystems, Inc.
149+ * Copyright (C) 2011 Stewart Smith
150 *
151 * This program is free software; you can redistribute it and/or modify
152 * it under the terms of the GNU General Public License as published by
153@@ -21,7 +22,7 @@
154 #include <drizzled/function/str/strfunc.h>
155 #include <drizzled/function/str/load_file.h>
156 #include <drizzled/error.h>
157-#include <drizzled/data_home.h>
158+#include <drizzled/catalog/local.h>
159 #include <drizzled/session.h>
160 #include <drizzled/internal/my_sys.h>
161 #include <drizzled/sys_var.h>
162@@ -52,7 +53,7 @@
163 return 0;
164 }
165
166- fs::path target_path(fs::system_complete(getDataHomeCatalog()));
167+ fs::path target_path(fs::system_complete(catalog::local_identifier().getPath()));
168 fs::path to_file(file_name->c_ptr());
169 if (not to_file.has_root_directory())
170 {
171
172=== modified file 'drizzled/identifier/catalog.cc'
173--- drizzled/identifier/catalog.cc 2011-10-19 09:25:53 +0000
174+++ drizzled/identifier/catalog.cc 2012-01-05 00:31:36 +0000
175@@ -50,7 +50,7 @@
176 void Catalog::init()
177 {
178 assert(not _name.empty());
179- path += "../";
180+ path.clear();
181 path += util::tablename_to_filename(_name);
182 assert(path.length()); // TODO throw exception, this is a possibility
183 hash_value= util::insensitive_hash()(path);
184
185=== modified file 'drizzled/identifier/catalog.h'
186--- drizzled/identifier/catalog.h 2011-09-18 17:33:22 +0000
187+++ drizzled/identifier/catalog.h 2012-01-05 00:31:36 +0000
188@@ -35,7 +35,7 @@
189 namespace drizzled {
190 namespace identifier {
191
192-class Catalog : public Identifier
193+class DRIZZLED_API Catalog : public Identifier
194 {
195 public:
196 Catalog(str_ref);
197@@ -81,6 +81,12 @@
198 {
199 return boost::iequals(left.getName(), right.getName());
200 }
201+
202+ void resetPath()
203+ {
204+ init();
205+ }
206+
207 private:
208 void init();
209
210
211=== modified file 'drizzled/identifier/schema.cc'
212--- drizzled/identifier/schema.cc 2011-10-19 09:25:53 +0000
213+++ drizzled/identifier/schema.cc 2012-01-05 00:31:36 +0000
214@@ -42,7 +42,8 @@
215 namespace identifier {
216
217 Schema::Schema(str_ref db_arg) :
218- db(db_arg.data(), db_arg.size())
219+ db(db_arg.data(), db_arg.size()),
220+ _catalog(drizzled::catalog::local_identifier())
221 {
222 #if 0
223 string::size_type lastPos= db.find_first_of('/', 0);
224@@ -56,6 +57,8 @@
225
226 if (not db_arg.empty())
227 {
228+ db_path += _catalog.getPath();
229+ db_path += FN_LIBCHAR;
230 db_path += util::tablename_to_filename(db);
231 assert(db_path.length()); // TODO throw exception, this is a possibility
232 }
233@@ -95,12 +98,12 @@
234
235 const std::string &Schema::getCatalogName() const
236 {
237- return drizzled::catalog::local_identifier().name();
238+ return _catalog.name();
239 }
240
241 std::ostream& operator<<(std::ostream& output, const Schema&identifier)
242 {
243- return output << "identifier::Schema:(" << drizzled::catalog::local_identifier() << ", " << identifier.getSchemaName() << ", " << identifier.getPath() << ")";
244+ return output << "identifier::Schema:(" << identifier.getCatalogName() << ", " << identifier.getSchemaName() << ", " << identifier.getPath() << ")";
245 }
246
247 } /* namespace identifier */
248
249=== modified file 'drizzled/identifier/schema.h'
250--- drizzled/identifier/schema.h 2011-10-18 13:52:19 +0000
251+++ drizzled/identifier/schema.h 2012-01-05 00:31:36 +0000
252@@ -37,10 +37,13 @@
253 namespace drizzled {
254 namespace identifier {
255
256+class Catalog;
257+
258 class DRIZZLED_API Schema : public Identifier
259 {
260 std::string db;
261 std::string db_path;
262+ drizzled::identifier::Catalog _catalog;
263
264 public:
265 Schema(str_ref);
266
267=== modified file 'drizzled/identifier/table.cc'
268--- drizzled/identifier/table.cc 2011-10-19 09:25:53 +0000
269+++ drizzled/identifier/table.cc 2012-01-05 00:31:36 +0000
270@@ -33,6 +33,7 @@
271
272 #include <drizzled/util/string.h>
273 #include <drizzled/util/tablename_to_filename.h>
274+#include <drizzled/catalog/local.h>
275
276 #include <algorithm>
277 #include <sstream>
278@@ -179,7 +180,8 @@
279
280 std::string Table::build_table_filename(const std::string &in_db, const std::string &in_table_name, bool is_tmp)
281 {
282- string in_path= util::tablename_to_filename(in_db) + FN_LIBCHAR;
283+ string in_path= drizzled::catalog::local_identifier().getPath();
284+ in_path+= FN_LIBCHAR + util::tablename_to_filename(in_db) + FN_LIBCHAR;
285 return in_path + (is_tmp ? in_table_name : util::tablename_to_filename(in_table_name));
286 }
287
288@@ -221,7 +223,7 @@
289 }
290
291 hash_value= util::insensitive_hash()(path);
292- key.set(getKeySize(), getSchemaName(), boost::to_lower_copy(std::string(getTableName())));
293+ key.set(getKeySize(), getCatalogName(), getSchemaName(), boost::to_lower_copy(std::string(getTableName())));
294 }
295
296
297@@ -284,12 +286,14 @@
298 message.set_schema(getSchemaName());
299 }
300
301-void Table::Key::set(size_t resize_arg, const std::string &a, const std::string &b)
302+ void Table::Key::set(size_t resize_arg, const std::string &a, const std::string &b, const std::string &c)
303 {
304 key_buffer.resize(resize_arg);
305
306 std::copy(a.begin(), a.end(), key_buffer.begin());
307 std::copy(b.begin(), b.end(), key_buffer.begin() + a.length() + 1);
308+ std::copy(c.begin(), c.end(),
309+ key_buffer.begin() + a.length() + 1 + b.length() + 1);
310
311 util::sensitive_hash hasher;
312 hash_value= hasher(key_buffer);
313
314=== modified file 'drizzled/identifier/table.h'
315--- drizzled/identifier/table.h 2011-11-22 06:24:37 +0000
316+++ drizzled/identifier/table.h 2012-01-05 00:31:36 +0000
317@@ -81,7 +81,7 @@
318 return key_buffer;
319 }
320
321- void set(size_t resize_arg, const std::string &a, const std::string &b);
322+ void set(size_t resize_arg, const std::string &a, const std::string &b, const std::string &c);
323
324 friend bool operator==(const Key &left, const Key &right)
325 {
326@@ -123,7 +123,7 @@
327
328 size_t getKeySize() const
329 {
330- return getSchemaName().size() + getTableName().size() + 2;
331+ return getCatalogName().size() + getSchemaName().size() + getTableName().size() + 3;
332 }
333
334 public:
335
336=== modified file 'drizzled/main.cc'
337--- drizzled/main.cc 2011-10-19 19:30:54 +0000
338+++ drizzled/main.cc 2012-01-05 00:31:36 +0000
339@@ -336,11 +336,6 @@
340 }
341 }
342
343- if (chdir("local") == -1)
344- {
345- unireg_abort << "Local catalog does not exist, was unable to chdir() to " << getDataHome().file_string();
346- }
347-
348 setFullDataHome(boost::filesystem::system_complete(getDataHome()));
349 errmsg_printf(error::INFO, "Data Home directory is : %s", getFullDataHome().native_file_string().c_str());
350 }
351
352=== modified file 'drizzled/session.cc'
353--- drizzled/session.cc 2011-11-09 20:20:23 +0000
354+++ drizzled/session.cc 2012-01-05 00:31:36 +0000
355@@ -27,7 +27,7 @@
356 #include <boost/filesystem.hpp>
357 #include <boost/ptr_container/ptr_container.hpp>
358 #include <drizzled/copy_field.h>
359-#include <drizzled/data_home.h>
360+#include <drizzled/catalog/local.h>
361 #include <drizzled/diagnostics_area.h>
362 #include <drizzled/display.h>
363 #include <drizzled/drizzled.h>
364@@ -996,7 +996,7 @@
365
366 if (not to_file.has_root_directory())
367 {
368- target_path= fs::system_complete(getDataHomeCatalog());
369+ target_path= fs::system_complete(catalog::local_identifier().getPath());
370 util::string::ptr schema(session.schema());
371 if (not schema->empty())
372 {
373
374=== modified file 'drizzled/sql_load.cc'
375--- drizzled/sql_load.cc 2011-10-18 11:01:40 +0000
376+++ drizzled/sql_load.cc 2012-01-05 00:31:36 +0000
377@@ -1,4 +1,5 @@
378 /* Copyright (C) 2000-2006 MySQL AB
379+ Copyright (C) 2011 Stewart Smith
380
381 This program is free software; you can redistribute it and/or modify
382 it under the terms of the GNU General Public License as published by
383@@ -20,7 +21,7 @@
384
385 #include <drizzled/sql_load.h>
386 #include <drizzled/error.h>
387-#include <drizzled/data_home.h>
388+#include <drizzled/catalog/local.h>
389 #include <drizzled/session.h>
390 #include <drizzled/sql_base.h>
391 #include <drizzled/field/epoch.h>
392@@ -263,7 +264,7 @@
393 }
394
395 fs::path to_file(ex->file_name);
396- fs::path target_path(fs::system_complete(getDataHomeCatalog()));
397+ fs::path target_path(fs::system_complete(catalog::local_identifier().getPath()));
398 if (not to_file.has_root_directory())
399 {
400 int count_elements= 0;
401
402=== modified file 'drizzled/table/instance/base.cc'
403--- drizzled/table/instance/base.cc 2011-10-29 18:07:51 +0000
404+++ drizzled/table/instance/base.cc 2012-01-05 00:31:36 +0000
405@@ -230,6 +230,7 @@
406 key_info(NULL),
407 mem_root(TABLE_ALLOC_BLOCK_SIZE),
408 all_set(),
409+ table_identifier(NULL),
410 block_size(0),
411 version(0),
412 timestamp_offset(0),
413@@ -289,6 +290,7 @@
414 mem_root(TABLE_ALLOC_BLOCK_SIZE),
415 table_charset(0),
416 all_set(),
417+ table_identifier(NULL),
418 block_size(0),
419 version(0),
420 timestamp_offset(0),
421@@ -328,6 +330,8 @@
422 keys_in_use(0),
423 keys_for_keyread(0)
424 {
425+ table_identifier= new identifier::Table(identifier);
426+
427 assert(identifier.getKey() == key);
428
429 private_key_for_cache= key;
430@@ -335,16 +339,8 @@
431 table_category= TABLE_CATEGORY_TEMPORARY;
432 tmp_table= message::Table::INTERNAL;
433
434- db= str_ref(private_key_for_cache.vector());
435-
436- table_name= str_ref(private_key_for_cache.vector() + strlen(private_key_for_cache.vector()) + 1);
437 path= str_ref("");
438 normalized_path= str_ref("");
439-
440- std::string tb_name(identifier.getTableName());
441- boost::to_lower(tb_name);
442- assert(strcmp(tb_name.c_str(), table_name.data()) == 0);
443- assert(strcmp(identifier.getSchemaName().c_str(), db.data()) == 0);
444 }
445
446 TableShare::TableShare(const identifier::Table &identifier) : // Just used during createTable()
447@@ -355,6 +351,7 @@
448 mem_root(TABLE_ALLOC_BLOCK_SIZE),
449 table_charset(0),
450 all_set(),
451+ table_identifier(NULL),
452 block_size(0),
453 version(0),
454 timestamp_offset(0),
455@@ -394,6 +391,8 @@
456 keys_in_use(0),
457 keys_for_keyread(0)
458 {
459+ table_identifier= new identifier::Table(identifier);
460+
461 private_key_for_cache= identifier.getKey();
462 assert(identifier.getPath().size()); // Since we are doing a create table, this should be a positive value
463 private_normalized_path.resize(identifier.getPath().size() + 1);
464@@ -402,8 +401,6 @@
465 {
466 table_category= TABLE_CATEGORY_TEMPORARY;
467 tmp_table= message::Table::INTERNAL;
468- db= str_ref(private_key_for_cache.vector());
469- table_name= str_ref(db.data() + 1);
470 path= private_normalized_path;
471 normalized_path= path;
472 }
473@@ -424,6 +421,7 @@
474 mem_root(TABLE_ALLOC_BLOCK_SIZE),
475 table_charset(0),
476 all_set(),
477+ table_identifier(NULL),
478 block_size(0),
479 version(0),
480 timestamp_offset(0),
481@@ -463,14 +461,9 @@
482 keys_in_use(0),
483 keys_for_keyread(0)
484 {
485+ table_identifier= new identifier::Table(identifier);
486
487 private_key_for_cache= identifier.getKey();
488- /*
489- Let us use the fact that the key is "db/0/table_name/0" + optional
490- part for temporary tables.
491- */
492- db= str_ref(private_key_for_cache.vector());
493- table_name= str_ref(db.data() + db.size() + 1);
494
495 std::string _path;
496 if (path_arg)
497@@ -479,7 +472,7 @@
498 }
499 else
500 {
501- _path= identifier::Table::build_table_filename(db.data(), table_name.data(), false);
502+ _path= identifier::Table::build_table_filename(table_identifier->getSchemaName(), table_identifier->getTableName(), false);
503 }
504
505 char* path_buff= mem_root.strdup(_path);
506@@ -493,8 +486,11 @@
507 {
508 table_category= TABLE_CATEGORY_TEMPORARY;
509 tmp_table= message::Table::INTERNAL;
510- db= str_ref("");
511- table_name= str_ref(new_table_name);
512+
513+ identifier::Table *n= new identifier::Table("", new_table_name, new_path);
514+ delete table_identifier;
515+ table_identifier= n;
516+
517 path= str_ref(new_path);
518 normalized_path= str_ref(new_path);
519 }
520@@ -502,6 +498,7 @@
521 TableShare::~TableShare()
522 {
523 storage_engine= NULL;
524+ delete table_identifier;
525
526 mem_root.free_root(MYF(0)); // Free's share
527 }
528@@ -510,12 +507,8 @@
529 {
530 private_key_for_cache= identifier_arg.getKey();
531
532- /*
533- Let us use the fact that the key is "db/0/table_name/0" + optional
534- part for temporary tables.
535- */
536- db= str_ref(private_key_for_cache.vector());
537- table_name= str_ref(db.data() + db.size() + 1);
538+ delete table_identifier;
539+ table_identifier= new identifier::Table(identifier_arg);
540
541 getTableMessage()->set_name(identifier_arg.getTableName());
542 getTableMessage()->set_schema(identifier_arg.getSchemaName());
543@@ -1708,8 +1701,7 @@
544 case 1:
545 if (db_errno == ENOENT)
546 {
547- identifier::Table identifier(db.data(), table_name.data());
548- my_error(ER_TABLE_UNKNOWN, identifier);
549+ my_error(ER_TABLE_UNKNOWN, *table_identifier);
550 }
551 else
552 {
553@@ -1732,7 +1724,7 @@
554 snprintf(tmp, sizeof(tmp), "#%d", pass_errarg);
555 csname= tmp;
556 }
557- my_printf_error(ER_UNKNOWN_COLLATION, _("Unknown collation '%s' in table '%-.64s' definition"), MYF(0), csname, table_name.data());
558+ my_printf_error(ER_UNKNOWN_COLLATION, _("Unknown collation '%s' in table '%-.64s' definition"), MYF(0), csname, table_identifier->getTableName().c_str());
559 break;
560 }
561 case 6:
562
563=== modified file 'drizzled/table/instance/base.h'
564--- drizzled/table/instance/base.h 2011-10-29 18:07:51 +0000
565+++ drizzled/table/instance/base.h 2012-01-05 00:31:36 +0000
566@@ -231,8 +231,7 @@
567 private:
568 identifier::Table::Key private_key_for_cache; // This will not exist in the final design.
569 std::vector<char> private_normalized_path; // This will not exist in the final design.
570- str_ref db; /* Pointer to db */
571- str_ref table_name; /* Table name (for open) */
572+ drizzled::identifier::Table *table_identifier;
573 str_ref path; /* Path to table (from datadir) */
574 str_ref normalized_path; /* unpack_filename(path) */
575
576@@ -261,22 +260,22 @@
577
578 str_ref getTableNameRef() const
579 {
580- return table_name;
581+ return str_ref(table_identifier->getTableName());
582 }
583
584 const char *getTableName() const
585 {
586- return table_name.data();
587+ return table_identifier->getTableName().c_str();
588 }
589
590 str_ref getSchemaNameRef() const
591 {
592- return db;
593+ return str_ref(table_identifier->getSchemaName());
594 }
595
596 const char *getSchemaName() const
597 {
598- return db.data();
599+ return table_identifier->getSchemaName().c_str();
600 }
601
602 uint32_t block_size; /* create information */
603
604=== modified file 'plugin/innobase/dict/dict0dict.cc'
605--- plugin/innobase/dict/dict0dict.cc 2011-02-04 22:30:00 +0000
606+++ plugin/innobase/dict/dict0dict.cc 2012-01-05 00:31:36 +0000
607@@ -225,6 +225,11 @@
608 const char* s = strchr(name, '/');
609 ut_a(s);
610
611+ s= strchr(s+1, '/');
612+
613+ if (s == NULL)
614+ s= strchr(name, '/');
615+
616 return(s + 1);
617 }
618
619@@ -239,8 +244,14 @@
620 dbname '/' tablename */
621 {
622 const char* s;
623- s = strchr(name, '/');
624- ut_a(s);
625+ const char* catalog;
626+ catalog = strchr(name, '/');
627+ ut_a(catalog);
628+ s= strchr(catalog+1, '/');
629+
630+ if (s == NULL)
631+ s = catalog;
632+
633 return(s - name);
634 }
635
636
637=== modified file 'plugin/innobase/handler/ha_innodb.cc'
638--- plugin/innobase/handler/ha_innodb.cc 2011-11-09 20:20:23 +0000
639+++ plugin/innobase/handler/ha_innodb.cc 2012-01-05 00:31:36 +0000
640@@ -3,6 +3,7 @@
641 Copyright (C) 2000, 2010, MySQL AB & Innobase Oy. All Rights Reserved.
642 Copyright (C) 2008, 2009 Google Inc.
643 Copyright (C) 2009, Percona Inc.
644+Copyright (C) 2011, Stewart Smith
645
646 Portions of this file contain modifications contributed and copyrighted by
647 Google, Inc. Those modifications are gratefully acknowledged and are described
648@@ -50,6 +51,7 @@
649 #include <drizzled/plugin.h>
650 #include <drizzled/show.h>
651 #include <drizzled/data_home.h>
652+#include <drizzled/catalog/local.h>
653 #include <drizzled/error.h>
654 #include <drizzled/field.h>
655 #include <drizzled/charset.h>
656@@ -1795,6 +1797,12 @@
657 const char* bufend = buf + buflen;
658
659 if (table_id) {
660+ const char* catalog_skip= (const char*) memchr(id, '/', idlen);
661+ if (catalog_skip)
662+ {
663+ idlen = idlen - (catalog_skip - id);
664+ id = catalog_skip + 1;
665+ }
666 const char* slash = (const char*) memchr(id, '/', idlen);
667 if (!slash) {
668
669@@ -3514,6 +3522,15 @@
670 else
671 {
672 ib_table = dict_table_get(identifier.getKeyPath().c_str(), TRUE);
673+ if (ib_table == NULL
674+ && drizzled::identifier::Catalog(identifier.getCatalogName())==drizzled::catalog::local_identifier())
675+ {
676+ std::string table_path_no_catalog(identifier.getKeyPath());
677+ table_path_no_catalog.erase(0, drizzled::catalog::local_identifier().getPath().length()+1);
678+ /* We try without local/ as old InnoDB data dictionary (pre CATALOG)
679+ did not have local/ in data dict, just in filesystem path */
680+ ib_table = dict_table_get(table_path_no_catalog.c_str(), TRUE);
681+ }
682 }
683
684 if (NULL == ib_table) {
685@@ -6661,6 +6678,16 @@
686 session.getSqlCommand()
687 == SQLCOM_DROP_DB);
688
689+ if (error == ENOENT
690+ && drizzled::identifier::Catalog(identifier.getCatalogName())==drizzled::catalog::local_identifier())
691+ {
692+ std::string table_path_no_catalog(identifier.getKeyPath());
693+ table_path_no_catalog.erase(0, drizzled::catalog::local_identifier().getPath().length()+1);
694+ error = row_drop_table_for_mysql(table_path_no_catalog.c_str(), trx,
695+ session.getSqlCommand()
696+ == SQLCOM_DROP_DB);
697+ }
698+
699 session.setXaId(trx->id);
700
701 /* Flush the log to reduce probability that the .frm files and
702@@ -7287,7 +7314,7 @@
703
704 prebuilt->trx->op_info = "returning various info to MySQL";
705
706- fs::path get_status_path(getDataHomeCatalog());
707+ fs::path get_status_path(catalog::local_identifier().getPath());
708 get_status_path /= ib_table->name;
709 fs::change_extension(get_status_path, "dfe");
710
711
712=== modified file 'plugin/innobase/tests/r/innodb-system-table-view.result'
713--- plugin/innobase/tests/r/innodb-system-table-view.result 2011-04-29 18:45:16 +0000
714+++ plugin/innobase/tests/r/innodb-system-table-view.result 2012-01-05 00:31:36 +0000
715@@ -58,23 +58,23 @@
716 ON DELETE CASCADE) ENGINE=INNODB;
717 SELECT * FROM DATA_DICTIONARY.INNODB_SYS_FOREIGN;
718 ID FOR_NAME REF_NAME N_COLS TYPE
719-test/constraint_test test/child test/parent 1 1
720+local/test/constraint_test local/test/child local/test/parent 1 1
721 SELECT * FROM DATA_DICTIONARY.INNODB_SYS_FOREIGN_COLS;
722 ID FOR_COL_NAME REF_COL_NAME POS
723-test/constraint_test parent_id id 0
724+local/test/constraint_test parent_id id 0
725 INSERT INTO parent VALUES(1);
726 SELECT name, num_rows, handles_opened
727 FROM DATA_DICTIONARY.INNODB_SYS_TABLESTATS
728 WHERE name LIKE "%parent";
729 name num_rows handles_opened
730-test/parent 1 1
731+local/test/parent 1 1
732 SELECT NAME, FLAG, N_COLS, SPACE FROM DATA_DICTIONARY.INNODB_SYS_TABLES;
733 NAME FLAG N_COLS SPACE
734 SYS_FOREIGN 0 7 0
735 SYS_FOREIGN_COLS 0 7 0
736 SYS_REPLICATION_LOG 0 11 0
737-test/child 1 5 0
738-test/parent 1 4 0
739+local/test/child 1 5 0
740+local/test/parent 1 4 0
741 SELECT name, n_fields
742 from DATA_DICTIONARY.INNODB_SYS_INDEXES
743 WHERE table_id In (SELECT table_id from
744@@ -109,11 +109,11 @@
745 ON DELETE CASCADE) ENGINE=INNODB;
746 SELECT * FROM DATA_DICTIONARY.INNODB_SYS_FOREIGN;
747 ID FOR_NAME REF_NAME N_COLS TYPE
748-test/constraint_test test/child test/parent 2 1
749+local/test/constraint_test local/test/child local/test/parent 2 1
750 SELECT * FROM DATA_DICTIONARY.INNODB_SYS_FOREIGN_COLS;
751 ID FOR_COL_NAME REF_COL_NAME POS
752-test/constraint_test id id 0
753-test/constraint_test parent_id newid 1
754+local/test/constraint_test id id 0
755+local/test/constraint_test parent_id newid 1
756 INSERT INTO parent VALUES(1, 9);
757 SELECT * FROM parent WHERE id IN (SELECT id FROM parent);
758 id newid
759@@ -122,6 +122,6 @@
760 FROM DATA_DICTIONARY.INNODB_SYS_TABLESTATS
761 WHERE name LIKE "%parent";
762 name num_rows handles_opened
763-test/parent 1 2
764+local/test/parent 1 2
765 DROP TABLE child;
766 DROP TABLE parent;
767
768=== modified file 'plugin/schema_engine/schema.cc'
769--- plugin/schema_engine/schema.cc 2011-10-18 13:52:19 +0000
770+++ plugin/schema_engine/schema.cc 2012-01-05 00:31:36 +0000
771@@ -26,7 +26,7 @@
772 #include <drizzled/sql_table.h>
773 #include <drizzled/charset.h>
774 #include <drizzled/cursor.h>
775-#include <drizzled/data_home.h>
776+#include <drizzled/catalog/local.h>
777
778 #include <drizzled/pthread_globals.h>
779
780@@ -71,7 +71,9 @@
781
782 void Schema::prime()
783 {
784- CachedDirectory directory(getDataHomeCatalog().file_string(), CachedDirectory::DIRECTORY);
785+ CachedDirectory directory(catalog::local_identifier().getPath(),
786+ CachedDirectory::DIRECTORY, true);
787+
788 CachedDirectory::Entries files= directory.getEntries();
789 boost::unique_lock<boost::shared_mutex> scopedLock(mutex);
790
791@@ -80,7 +82,12 @@
792 if (not entry->filename.compare(GLOBAL_TEMPORARY_EXT))
793 continue;
794 message::Schema schema_message;
795- if (readSchemaFile(entry->filename, schema_message))
796+
797+ std::string filename= catalog::local_identifier().getPath();
798+ filename+= FN_LIBCHAR;
799+ filename+= entry->filename;
800+
801+ if (readSchemaFile(filename, schema_message))
802 {
803 identifier::Schema schema_identifier(schema_message.name());
804
805
806=== modified file 'plugin/table_cache_dictionary/tests/r/table_cache.result'
807--- plugin/table_cache_dictionary/tests/r/table_cache.result 2011-04-28 02:29:52 +0000
808+++ plugin/table_cache_dictionary/tests/r/table_cache.result 2012-01-05 00:31:36 +0000
809@@ -17,14 +17,14 @@
810 flush tables;
811 select * FROM data_dictionary.TABLE_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME;
812 SESSION_ID TABLE_SCHEMA TABLE_NAME VERSION IS_NAME_LOCKED ROWS AVG_ROW_LENGTH TABLE_SIZE AUTO_INCREMENT
813-# data_dictionary table_cache # # # 2112 # #
814+# data_dictionary TABLE_CACHE # # # 2112 # #
815 create table a ( a int);
816 create table b ( b int);
817 select * FROM a CROSS JOIN b;
818 a b
819 select * FROM data_dictionary.TABLE_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME;
820 SESSION_ID TABLE_SCHEMA TABLE_NAME VERSION IS_NAME_LOCKED ROWS AVG_ROW_LENGTH TABLE_SIZE AUTO_INCREMENT
821-# data_dictionary table_cache # # # 2112 # #
822+# data_dictionary TABLE_CACHE # # # 2112 # #
823 # test a # # # 6 # #
824 # test b # # # 6 # #
825 DROP TABLES a,b;
826
827=== modified file 'plugin/table_cache_dictionary/tests/r/table_definition_cache.result'
828--- plugin/table_cache_dictionary/tests/r/table_definition_cache.result 2011-04-28 02:29:52 +0000
829+++ plugin/table_cache_dictionary/tests/r/table_definition_cache.result 2012-01-05 00:31:36 +0000
830@@ -13,14 +13,14 @@
831 flush tables;
832 select * FROM data_dictionary.TABLE_DEFINITION_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME;
833 TABLE_SCHEMA TABLE_NAME VERSION TABLE_COUNT IS_NAME_LOCKED
834-# table_definition_cache # # #
835+# TABLE_DEFINITION_CACHE # # #
836 create table a ( a int);
837 create table b ( b int);
838 select * FROM a CROSS JOIN b;
839 a b
840 select * FROM data_dictionary.TABLE_DEFINITION_CACHE ORDER BY TABLE_SCHEMA, TABLE_NAME;
841 TABLE_SCHEMA TABLE_NAME VERSION TABLE_COUNT IS_NAME_LOCKED
842-# table_definition_cache # # #
843+# TABLE_DEFINITION_CACHE # # #
844 # a # # #
845 # b # # #
846 DROP TABLES a,b;
847
848=== modified file 'plugin/tableprototester/tableprototester.cc'
849--- plugin/tableprototester/tableprototester.cc 2011-04-20 22:18:30 +0000
850+++ plugin/tableprototester/tableprototester.cc 2012-01-05 00:31:36 +0000
851@@ -118,11 +118,11 @@
852
853 bool TableProtoTesterEngine::doDoesTableExist(Session&, const drizzled::identifier::Table &identifier)
854 {
855- if (not identifier.getPath().compare("test/t1"))
856- return true;
857- if (not identifier.getPath().compare("test/too_many_enum_values"))
858- return true;
859- if (not identifier.getPath().compare("test/invalid_table_collation"))
860+ if (not identifier.getPath().compare("local/test/t1"))
861+ return true;
862+ if (not identifier.getPath().compare("local/test/too_many_enum_values"))
863+ return true;
864+ if (not identifier.getPath().compare("local/test/invalid_table_collation"))
865 return true;
866
867 return false;
868@@ -239,17 +239,17 @@
869 const drizzled::identifier::Table &identifier,
870 drizzled::message::Table &table_proto)
871 {
872- if (not identifier.getPath().compare("test/t1"))
873+ if (not identifier.getPath().compare("local/test/t1"))
874 {
875 fill_table1(table_proto);
876 return EEXIST;
877 }
878- else if (not identifier.getPath().compare("test/too_many_enum_values"))
879+ else if (not identifier.getPath().compare("local/test/too_many_enum_values"))
880 {
881 fill_table_too_many_enum_values(table_proto);
882 return EEXIST;
883 }
884- else if (not identifier.getPath().compare("test/invalid_table_collation"))
885+ else if (not identifier.getPath().compare("local/test/invalid_table_collation"))
886 {
887 fill_table_invalid_table_collation(table_proto);
888 return EEXIST;
889
890=== modified file 'plugin/transaction_log/hexdump_transaction_message.cc'
891--- plugin/transaction_log/hexdump_transaction_message.cc 2011-08-22 19:14:08 +0000
892+++ plugin/transaction_log/hexdump_transaction_message.cc 2012-01-05 00:31:36 +0000
893@@ -99,7 +99,7 @@
894 * a pool of TransactionLogReader objects that can be
895 * re-used.
896 */
897- const string &filename= transaction_log->getLogFilename();
898+ const string &filename= transaction_log->getLogFilepath();
899 int log_file= open(filename.c_str(), O_RDONLY);
900 if (log_file == -1)
901 {
902
903=== modified file 'plugin/transaction_log/module.cc'
904--- plugin/transaction_log/module.cc 2011-06-24 13:24:06 +0000
905+++ plugin/transaction_log/module.cc 2012-01-05 00:31:36 +0000
906@@ -56,7 +56,7 @@
907 * The name of the main transaction log file on disk. With no prefix,
908 * this goes into Drizzle's $datadir.
909 */
910-static const char DEFAULT_LOG_FILE_PATH[]= "transaction.log"; /* In datadir... */
911+static const char DEFAULT_LOG_FILE_PATH[]= "local/transaction.log"; /* In datadir... */
912 /**
913 * Transaction Log plugin system variable - Is the log enabled? Only used on init().
914 */
915
916=== modified file 'plugin/transaction_log/print_transaction_message.cc'
917--- plugin/transaction_log/print_transaction_message.cc 2011-04-14 21:56:22 +0000
918+++ plugin/transaction_log/print_transaction_message.cc 2012-01-05 00:31:36 +0000
919@@ -99,7 +99,7 @@
920 * a pool of TransactionLogReader objects that can be
921 * re-used.
922 */
923- const string &filename= transaction_log->getLogFilename();
924+ const string &filename= transaction_log->getLogFilepath();
925 int log_file= open(filename.c_str(), O_RDONLY);
926 if (log_file == -1)
927 {
928
929=== modified file 'plugin/transaction_log/tests/r/bug660779.result'
930--- plugin/transaction_log/tests/r/bug660779.result 2011-01-11 14:22:54 +0000
931+++ plugin/transaction_log/tests/r/bug660779.result 2012-01-05 00:31:36 +0000
932@@ -15,8 +15,8 @@
933 COMMIT;
934
935 We should have a Transaction with a single insert Statement
936-SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
937-PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
938+SELECT PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
939+PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
940 transaction_context {
941 server_id: 1
942 TRANSACTION_ID
943@@ -75,8 +75,8 @@
944 COMMIT;
945
946 We should have a Transaction with 1 update and 1 insert Statement
947-SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
948-PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
949+SELECT PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
950+PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
951 transaction_context {
952 server_id: 1
953 TRANSACTION_ID
954@@ -169,8 +169,8 @@
955 COMMIT;
956
957 We should have a Transaction with 1 insert Statement
958-SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
959-PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
960+SELECT PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
961+PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
962 transaction_context {
963 server_id: 1
964 TRANSACTION_ID
965
966=== added file 'plugin/transaction_log/tests/r/bug911643.result'
967--- plugin/transaction_log/tests/r/bug911643.result 1970-01-01 00:00:00 +0000
968+++ plugin/transaction_log/tests/r/bug911643.result 2012-01-05 00:31:36 +0000
969@@ -0,0 +1,71 @@
970+CREATE TABLE t1 (
971+pk INT NOT NULL AUTO_INCREMENT,
972+col_int1 INT,
973+col_int2 INT,
974+col_int_not_null INT NOT NULL,
975+PRIMARY KEY (pk));
976+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (1,1,1);
977+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (NULL,1,1);
978+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (2,1,3);
979+SET GLOBAL transaction_log_truncate_debug= true;
980+BEGIN;
981+UPDATE t1 SET col_int_not_null = col_int1 WHERE col_int2 = 1;
982+ERROR 23000: Column 'col_int_not_null' cannot be null
983+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (5,5,5);
984+COMMIT;
985+
986+We should have a Transaction with a single insert Statement
987+SELECT PRINT_TRANSACTION_MESSAGE('test/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
988+PRINT_TRANSACTION_MESSAGE('test/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS))
989+transaction_context {
990+ server_id: 1
991+ TRANSACTION_ID
992+ START_TIMESTAMP
993+ END_TIMESTAMP
994+}
995+statement {
996+ type: INSERT
997+ START_TIMESTAMP
998+ END_TIMESTAMP
999+ insert_header {
1000+ table_metadata {
1001+ schema_name: "test"
1002+ table_name: "t1"
1003+ }
1004+ field_metadata {
1005+ type: INTEGER
1006+ name: "pk"
1007+ }
1008+ field_metadata {
1009+ type: INTEGER
1010+ name: "col_int1"
1011+ }
1012+ field_metadata {
1013+ type: INTEGER
1014+ name: "col_int2"
1015+ }
1016+ field_metadata {
1017+ type: INTEGER
1018+ name: "col_int_not_null"
1019+ }
1020+ }
1021+ insert_data {
1022+ segment_id: 1
1023+ end_segment: true
1024+ record {
1025+ insert_value: "4"
1026+ insert_value: "5"
1027+ insert_value: "5"
1028+ insert_value: "5"
1029+ is_null: false
1030+ is_null: false
1031+ is_null: false
1032+ is_null: false
1033+ }
1034+ }
1035+}
1036+segment_id: 1
1037+end_segment: true
1038+
1039+DROP TABLE t1;
1040+SET GLOBAL transaction_log_truncate_debug= true;
1041
1042=== modified file 'plugin/transaction_log/tests/r/variables.result'
1043--- plugin/transaction_log/tests/r/variables.result 2010-08-21 19:42:55 +0000
1044+++ plugin/transaction_log/tests/r/variables.result 2012-01-05 00:31:36 +0000
1045@@ -3,7 +3,7 @@
1046 VARIABLE_NAME VARIABLE_VALUE
1047 transaction_log_enable ON
1048 transaction_log_enable_checksum OFF
1049-transaction_log_file transaction.log
1050+transaction_log_file local/transaction.log
1051 transaction_log_flush_frequency 1
1052 transaction_log_num_write_buffers 8
1053 transaction_log_truncate_debug OFF
1054
1055=== modified file 'plugin/transaction_log/tests/t/bug660779.test'
1056--- plugin/transaction_log/tests/t/bug660779.test 2010-10-29 02:01:29 +0000
1057+++ plugin/transaction_log/tests/t/bug660779.test 2012-01-05 00:31:36 +0000
1058@@ -22,7 +22,7 @@
1059 --echo We should have a Transaction with a single insert Statement
1060 --replace_regex /transaction_id: [0-9]+/TRANSACTION_ID/ /start_timestamp: [0-9]+/START_TIMESTAMP/g /end_timestamp: [0-9]+/END_TIMESTAMP/g /creation_timestamp: [0-9]+/CREATE_TIMESTAMP/ /update_timestamp: [0-9]+/UPDATE_TIMESTAMP/
1061
1062-SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1063+SELECT PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1064
1065 BEGIN;
1066 UPDATE t1 SET col_int1 = (col_int1 + 1) WHERE col_int2 = 1;
1067@@ -35,7 +35,7 @@
1068 --echo We should have a Transaction with 1 update and 1 insert Statement
1069 --replace_regex /transaction_id: [0-9]+/TRANSACTION_ID/ /start_timestamp: [0-9]+/START_TIMESTAMP/g /end_timestamp: [0-9]+/END_TIMESTAMP/g /creation_timestamp: [0-9]+/CREATE_TIMESTAMP/ /update_timestamp: [0-9]+/UPDATE_TIMESTAMP/
1070
1071-SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1072+SELECT PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1073
1074 CREATE TABLE t2 (pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY, a INT);
1075 INSERT INTO t2 (a) VALUES (1),(2), (NULL);
1076@@ -50,7 +50,7 @@
1077 --echo We should have a Transaction with 1 insert Statement
1078 --replace_regex /transaction_id: [0-9]+/TRANSACTION_ID/ /start_timestamp: [0-9]+/START_TIMESTAMP/g /end_timestamp: [0-9]+/END_TIMESTAMP/g /creation_timestamp: [0-9]+/CREATE_TIMESTAMP/ /update_timestamp: [0-9]+/UPDATE_TIMESTAMP/
1079
1080-SELECT PRINT_TRANSACTION_MESSAGE('transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1081+SELECT PRINT_TRANSACTION_MESSAGE('local/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1082
1083
1084 DROP TABLE t1;
1085
1086=== added file 'plugin/transaction_log/tests/t/bug911643-master.opt'
1087--- plugin/transaction_log/tests/t/bug911643-master.opt 1970-01-01 00:00:00 +0000
1088+++ plugin/transaction_log/tests/t/bug911643-master.opt 2012-01-05 00:31:36 +0000
1089@@ -0,0 +1,1 @@
1090+--transaction-log.enable --scheduler=multi_thread --transaction-message-threshold=131072 --allow-all-authentication.allow_anonymous=true --transaction-log.file=local/test/transaction.log
1091
1092=== added file 'plugin/transaction_log/tests/t/bug911643.test'
1093--- plugin/transaction_log/tests/t/bug911643.test 1970-01-01 00:00:00 +0000
1094+++ plugin/transaction_log/tests/t/bug911643.test 2012-01-05 00:31:36 +0000
1095@@ -0,0 +1,28 @@
1096+CREATE TABLE t1 (
1097+ pk INT NOT NULL AUTO_INCREMENT,
1098+ col_int1 INT,
1099+ col_int2 INT,
1100+ col_int_not_null INT NOT NULL,
1101+ PRIMARY KEY (pk));
1102+
1103+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (1,1,1);
1104+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (NULL,1,1);
1105+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (2,1,3);
1106+
1107+SET GLOBAL transaction_log_truncate_debug= true;
1108+
1109+--test with no previous Statement message
1110+BEGIN;
1111+--ERROR ER_BAD_NULL_ERROR
1112+UPDATE t1 SET col_int_not_null = col_int1 WHERE col_int2 = 1;
1113+INSERT INTO t1 (col_int1, col_int2, col_int_not_null) VALUES (5,5,5);
1114+COMMIT;
1115+
1116+--echo
1117+--echo We should have a Transaction with a single insert Statement
1118+--replace_regex /transaction_id: [0-9]+/TRANSACTION_ID/ /start_timestamp: [0-9]+/START_TIMESTAMP/g /end_timestamp: [0-9]+/END_TIMESTAMP/g /creation_timestamp: [0-9]+/CREATE_TIMESTAMP/ /update_timestamp: [0-9]+/UPDATE_TIMESTAMP/
1119+
1120+SELECT PRINT_TRANSACTION_MESSAGE('test/transaction.log',(select max(entry_offset) from DATA_DICTIONARY.TRANSACTION_LOG_TRANSACTIONS));
1121+
1122+DROP TABLE t1;
1123+SET GLOBAL transaction_log_truncate_debug= true;
1124
1125=== modified file 'tests/r/broken_table_proto_file.result'
1126--- tests/r/broken_table_proto_file.result 2011-01-12 22:54:12 +0000
1127+++ tests/r/broken_table_proto_file.result 2012-01-05 00:31:36 +0000
1128@@ -2,6 +2,6 @@
1129 SHOW TABLE STATUS like 't1';
1130 Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1131 show create table t1;
1132-ERROR HY000: Corrupt or invalid table definition for 'test/t1.dfe': name, schema, type, engine, creation_timestamp, update_timestamp
1133+ERROR HY000: Corrupt or invalid table definition for 'local/test/t1.dfe': name, schema, type, engine, creation_timestamp, update_timestamp
1134 drop table if exists t1;
1135 Got one of the listed errors
1136
1137=== modified file 'tests/r/show_check.result'
1138--- tests/r/show_check.result 2011-07-15 08:26:31 +0000
1139+++ tests/r/show_check.result 2012-01-05 00:31:36 +0000
1140@@ -26,11 +26,11 @@
1141 test.t1 check status OK
1142 show index from t1;
1143 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1144-def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
1145-def data_dictionary show_indexes SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63
1146-def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
1147-def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63
1148-def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 1 N 4097 0 45
1149+def data_dictionary SHOW_INDEXES SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
1150+def data_dictionary SHOW_INDEXES SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63
1151+def data_dictionary SHOW_INDEXES SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
1152+def data_dictionary SHOW_INDEXES SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63
1153+def data_dictionary SHOW_INDEXES SHOW_INDEXES Column_name Column_name 8 1024 1 N 4097 0 45
1154 Table Unique Key_name Seq_in_index Column_name
1155 t1 YES PRIMARY 1 a
1156 t1 NO b 1 b
1157@@ -48,37 +48,37 @@
1158 -- after Bug#29394 is implemented.
1159 show variables like "server_id%";
1160 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1161-def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
1162-def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
1163+def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
1164+def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
1165 Variable_name Value
1166 server_id 1
1167 show variables like "SERVER_id%";
1168 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1169-def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
1170-def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
1171+def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 9 N 4097 0 45
1172+def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 1 N 4097 0 45
1173 Variable_name Value
1174 server_id 1
1175 show variables like "this_doesn't_exists%";
1176 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1177-def data_dictionary session_variables SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 0 N 4097 0 45
1178-def data_dictionary session_variables SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 4097 0 45
1179+def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_NAME Variable_name 8 1024 0 N 4097 0 45
1180+def data_dictionary SESSION_VARIABLES SESSION_VARIABLES VARIABLE_VALUE Value 8 4096 0 N 4097 0 45
1181 Variable_name Value
1182 show table status from test like "this_doesn't_exists%";
1183 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1184-def data_dictionary show_table_status SHOW_TABLE_STATUS Session Session 5 21 0 N 36865 0 63
1185-def data_dictionary show_table_status SHOW_TABLE_STATUS Schema Schema 8 1024 0 N 4097 0 45
1186-def data_dictionary show_table_status SHOW_TABLE_STATUS Name Name 8 1024 0 N 4097 0 45
1187-def data_dictionary show_table_status SHOW_TABLE_STATUS Type Type 8 1024 0 N 4097 0 45
1188-def data_dictionary show_table_status SHOW_TABLE_STATUS Engine Engine 8 1024 0 N 4097 0 45
1189-def data_dictionary show_table_status SHOW_TABLE_STATUS Version Version 8 1024 0 N 4097 0 45
1190-def data_dictionary show_table_status SHOW_TABLE_STATUS Rows Rows 8 1024 0 N 4097 0 45
1191-def data_dictionary show_table_status SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 1024 0 N 4097 0 45
1192-def data_dictionary show_table_status SHOW_TABLE_STATUS Table_size Table_size 8 1024 0 N 4097 0 45
1193-def data_dictionary show_table_status SHOW_TABLE_STATUS Auto_increment Auto_increment 8 1024 0 N 4097 0 45
1194+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Session Session 5 21 0 N 36865 0 63
1195+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Schema Schema 8 1024 0 N 4097 0 45
1196+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Name Name 8 1024 0 N 4097 0 45
1197+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Type Type 8 1024 0 N 4097 0 45
1198+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Engine Engine 8 1024 0 N 4097 0 45
1199+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Version Version 8 1024 0 N 4097 0 45
1200+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Rows Rows 8 1024 0 N 4097 0 45
1201+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Avg_row_length Avg_row_length 8 1024 0 N 4097 0 45
1202+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Table_size Table_size 8 1024 0 N 4097 0 45
1203+def data_dictionary SHOW_TABLE_STATUS SHOW_TABLE_STATUS Auto_increment Auto_increment 8 1024 0 N 4097 0 45
1204 Session Schema Name Type Engine Version Rows Avg_row_length Table_size Auto_increment
1205 show databases;
1206 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1207-def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database 8 1024 18 N 4097 0 45
1208+def data_dictionary SHOW_SCHEMAS SHOW_SCHEMAS SCHEMA_NAME Database 8 1024 18 N 4097 0 45
1209 Database
1210 DATA_DICTIONARY
1211 INFORMATION_SCHEMA
1212@@ -86,7 +86,7 @@
1213 test
1214 show databases like "test%";
1215 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1216-def data_dictionary show_schemas SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 1024 4 N 4097 0 45
1217+def data_dictionary SHOW_SCHEMAS SHOW_SCHEMAS SCHEMA_NAME Database (test%) 8 1024 4 N 4097 0 45
1218 Database (test%)
1219 test
1220 create table t1 (f1 int not null, f2 int not null, f3 int not null, f4 int not null, primary key(f1,f2,f3,f4));
1221@@ -446,11 +446,11 @@
1222 );
1223 show index from t1;
1224 Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
1225-def data_dictionary show_indexes SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
1226-def data_dictionary show_indexes SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63
1227-def data_dictionary show_indexes SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
1228-def data_dictionary show_indexes SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63
1229-def data_dictionary show_indexes SHOW_INDEXES Column_name Column_name 8 1024 6 N 4097 0 45
1230+def data_dictionary SHOW_INDEXES SHOW_INDEXES Table Table 8 1024 2 N 4097 0 45
1231+def data_dictionary SHOW_INDEXES SHOW_INDEXES Unique Unique 13 1 1 N 36897 0 63
1232+def data_dictionary SHOW_INDEXES SHOW_INDEXES Key_name Key_name 8 1024 7 N 4097 0 45
1233+def data_dictionary SHOW_INDEXES SHOW_INDEXES Seq_in_index Seq_in_index 5 21 1 N 36865 0 63
1234+def data_dictionary SHOW_INDEXES SHOW_INDEXES Column_name Column_name 8 1024 6 N 4097 0 45
1235 Table Unique Key_name Seq_in_index Column_name
1236 t1 YES PRIMARY 1 field1
1237 drop table t1;
1238
1239=== modified file 'unittests/table_identifier.cc'
1240--- unittests/table_identifier.cc 2011-07-07 11:47:49 +0000
1241+++ unittests/table_identifier.cc 2012-01-05 00:31:36 +0000
1242@@ -63,14 +63,21 @@
1243
1244 const identifier::Table::Key key= identifier.getKey();
1245
1246- BOOST_REQUIRE_EQUAL(key.size(), 7);
1247- BOOST_REQUIRE_EQUAL(key.vector()[0], 't');
1248- BOOST_REQUIRE_EQUAL(key.vector()[1], 'e');
1249- BOOST_REQUIRE_EQUAL(key.vector()[2], 's');
1250- BOOST_REQUIRE_EQUAL(key.vector()[3], 't');
1251- BOOST_REQUIRE_EQUAL(key.vector()[4], 0);
1252- BOOST_REQUIRE_EQUAL(key.vector()[5], 'a');
1253- BOOST_REQUIRE_EQUAL(key.vector()[6], 0);
1254+ BOOST_REQUIRE_EQUAL(key.size(), 13);
1255+ int i=0;
1256+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'L');
1257+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'O');
1258+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'C');
1259+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'A');
1260+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'L');
1261+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 0);
1262+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 't');
1263+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'e');
1264+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 's');
1265+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 't');
1266+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 0);
1267+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 'a');
1268+ BOOST_REQUIRE_EQUAL(key.vector()[i++], 0);
1269 }
1270
1271 BOOST_AUTO_TEST_CASE(KeyCompare)