Merge lp:~stewart/drizzle/table-proto-message-error-checking into lp:~drizzle-trunk/drizzle/development
- table-proto-message-error-checking
- Merge into development
Proposed by
Stewart Smith
Status: | Merged |
---|---|
Merged at revision: | not available |
Proposed branch: | lp:~stewart/drizzle/table-proto-message-error-checking |
Merge into: | lp:~drizzle-trunk/drizzle/development |
Prerequisite: | lp:~stewart/drizzle/enum_field_type_to_table_message_type |
Diff against target: |
654 lines (+479/-8) 18 files modified
drizzled/error.cc (+3/-1) drizzled/error.h (+2/-1) drizzled/message/table_writer.cc (+69/-5) drizzled/plugin/storage_engine.cc (+16/-1) drizzled/table.cc (+6/-0) plugin/blackhole/ha_blackhole.cc (+7/-0) plugin/tableprototester/plugin.ini (+5/-0) plugin/tableprototester/tableprototester.cc (+292/-0) plugin/tableprototester/tableprototester.h (+58/-0) plugin/tableprototester/tests/r/basic.result (+3/-0) plugin/tableprototester/tests/r/drop_table.result (+2/-0) plugin/tableprototester/tests/r/missing_engine.result (+5/-0) plugin/tableprototester/tests/t/basic-master.opt (+1/-0) plugin/tableprototester/tests/t/basic.test (+1/-0) plugin/tableprototester/tests/t/drop_table-master.opt (+1/-0) plugin/tableprototester/tests/t/drop_table.test (+2/-0) plugin/tableprototester/tests/t/missing_engine-master.opt (+1/-0) plugin/tableprototester/tests/t/missing_engine.test (+5/-0) |
To merge this branch: | bzr merge lp:~stewart/drizzle/table-proto-message-error-checking |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Brian Aker | Pending | ||
Drizzle Developers | Pending | ||
Review via email: mp+18672@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) wrote : | # |
- 1315. By Stewart Smith
-
Merged enum_field_
type_to_ table_message_ type into table-proto- message- error-checking.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'drizzled/error.cc' |
2 | --- drizzled/error.cc 2010-02-04 08:14:46 +0000 |
3 | +++ drizzled/error.cc 2010-02-08 01:35:22 +0000 |
4 | @@ -1418,7 +1418,9 @@ |
5 | /* ER_INVALID_ENUM_VALUE */ |
6 | N_("Received an invalid enum value '%s'."), |
7 | /* ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE */ |
8 | -N_("Tables which are replicated require a primary key.") |
9 | +N_("Tables which are replicated require a primary key."), |
10 | +/* ER_CORRUPT_TABLE_DEFINITION */ |
11 | +N_("Corrupt or invalid table definition: %s") |
12 | }; |
13 | |
14 | const char * error_message(unsigned int code) |
15 | |
16 | === modified file 'drizzled/error.h' |
17 | --- drizzled/error.h 2010-02-04 08:14:46 +0000 |
18 | +++ drizzled/error.h 2010-02-08 01:35:22 +0000 |
19 | @@ -723,7 +723,8 @@ |
20 | ER_INVALID_TIME_VALUE, |
21 | ER_INVALID_ENUM_VALUE, |
22 | ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE, |
23 | - ER_ERROR_LAST= ER_NO_PRIMARY_KEY_ON_REPLICATED_TABLE |
24 | + ER_CORRUPT_TABLE_DEFINITION, |
25 | + ER_ERROR_LAST= ER_CORRUPT_TABLE_DEFINITION |
26 | }; |
27 | |
28 | } /* namespace drizzled */ |
29 | |
30 | === modified file 'drizzled/message/table_writer.cc' |
31 | --- drizzled/message/table_writer.cc 2009-12-11 21:54:18 +0000 |
32 | +++ drizzled/message/table_writer.cc 2010-02-08 01:35:22 +0000 |
33 | @@ -22,6 +22,7 @@ |
34 | #include <iostream> |
35 | #include <fstream> |
36 | #include <string> |
37 | +#include <getopt.h> |
38 | #include <drizzled/message/table.pb.h> |
39 | |
40 | using namespace std; |
41 | @@ -78,6 +79,13 @@ |
42 | index->set_is_primary(is_primary); |
43 | index->set_is_unique(is_unique); |
44 | |
45 | + int key_length= 0; |
46 | + |
47 | + for(int i=0; i< num_index_parts; i++) |
48 | + key_length+= compare_lengths[i]; |
49 | + |
50 | + index->set_key_length(key_length); |
51 | + |
52 | while (x < num_index_parts) |
53 | { |
54 | index_part= index->add_index_part(); |
55 | @@ -190,21 +198,77 @@ |
56 | |
57 | } |
58 | |
59 | +static void fill_table1(message::Table *table) |
60 | +{ |
61 | + message::Table::Field *field; |
62 | + message::Table::TableOptions *tableopts; |
63 | + |
64 | + table->set_name("t1"); |
65 | + table->set_type(message::Table::INTERNAL); |
66 | + |
67 | + tableopts= table->mutable_options(); |
68 | + tableopts->set_comment("Table without a StorageEngine message"); |
69 | + |
70 | + { |
71 | + field= table->add_field(); |
72 | + field->set_name("number"); |
73 | + field->set_type(message::Table::Field::INTEGER); |
74 | + } |
75 | + |
76 | +} |
77 | + |
78 | +static void usage(char *argv0) |
79 | +{ |
80 | + cerr << "Usage: " << argv0 << " [-t N] TABLE_NAME.dfe" << endl; |
81 | + cerr << endl; |
82 | + cerr << "-t N\tTable Number" << endl; |
83 | + cerr << "\t0 - default" << endl; |
84 | + cerr << endl; |
85 | +} |
86 | + |
87 | int main(int argc, char* argv[]) |
88 | { |
89 | + int opt; |
90 | + int table_number= 0; |
91 | + |
92 | GOOGLE_PROTOBUF_VERIFY_VERSION; |
93 | |
94 | - if (argc != 2) |
95 | + while ((opt= getopt(argc, argv, "t:")) != -1) |
96 | { |
97 | - cerr << "Usage: " << argv[0] << " SCHEMA" << endl; |
98 | - return -1; |
99 | + switch (opt) |
100 | + { |
101 | + case 't': |
102 | + table_number= atoi(optarg); |
103 | + break; |
104 | + default: |
105 | + usage(argv[0]); |
106 | + exit(EXIT_FAILURE); |
107 | + } |
108 | + } |
109 | + |
110 | + if (optind >= argc) { |
111 | + fprintf(stderr, "Expected Table name argument\n\n"); |
112 | + usage(argv[0]); |
113 | + exit(EXIT_FAILURE); |
114 | } |
115 | |
116 | message::Table table; |
117 | |
118 | - fill_table(&table, "example_table"); |
119 | + switch (table_number) |
120 | + { |
121 | + case 0: |
122 | + fill_table(&table, "example_table"); |
123 | + break; |
124 | + case 1: |
125 | + fill_table1(&table); |
126 | + break; |
127 | + default: |
128 | + fprintf(stderr, "Invalid table number.\n\n"); |
129 | + usage(argv[0]); |
130 | + exit(EXIT_FAILURE); |
131 | + } |
132 | |
133 | - fstream output(argv[1], ios::out | ios::trunc | ios::binary); |
134 | + fstream output(argv[optind], ios::out | ios::trunc | ios::binary); |
135 | if (!table.SerializeToOstream(&output)) |
136 | { |
137 | cerr << "Failed to write schema." << endl; |
138 | |
139 | === modified file 'drizzled/plugin/storage_engine.cc' |
140 | --- drizzled/plugin/storage_engine.cc 2010-02-04 08:14:46 +0000 |
141 | +++ drizzled/plugin/storage_engine.cc 2010-02-08 01:35:22 +0000 |
142 | @@ -579,7 +579,7 @@ |
143 | if (ret != ENOENT) |
144 | *err= ret; |
145 | |
146 | - return *err == EEXIST; |
147 | + return *err == EEXIST || *err != ENOENT; |
148 | } |
149 | }; |
150 | |
151 | @@ -705,6 +705,13 @@ |
152 | identifier, |
153 | &src_proto); |
154 | |
155 | + if (error_proto == ER_CORRUPT_TABLE_DEFINITION) |
156 | + { |
157 | + my_error(ER_CORRUPT_TABLE_DEFINITION, MYF(0), |
158 | + src_proto.InitializationErrorString().c_str()); |
159 | + return ER_CORRUPT_TABLE_DEFINITION; |
160 | + } |
161 | + |
162 | engine= plugin::StorageEngine::findByName(session, |
163 | src_proto.engine().name()); |
164 | |
165 | @@ -732,6 +739,14 @@ |
166 | if (error_proto && error == 0) |
167 | return 0; |
168 | |
169 | + if (((error_proto != EEXIST && error_proto != ENOENT) |
170 | + && !engine && generate_warning) |
171 | + | ( error && !engine && generate_warning)) |
172 | + { |
173 | + my_error(ER_GET_ERRNO, MYF(0), error_proto); |
174 | + return error_proto; |
175 | + } |
176 | + |
177 | if (error && generate_warning) |
178 | { |
179 | /* |
180 | |
181 | === modified file 'drizzled/table.cc' |
182 | --- drizzled/table.cc 2010-02-08 01:35:22 +0000 |
183 | +++ drizzled/table.cc 2010-02-08 01:35:22 +0000 |
184 | @@ -262,6 +262,12 @@ |
185 | { |
186 | int error= 0; |
187 | |
188 | + if (! table.IsInitialized()) |
189 | + { |
190 | + my_error(ER_CORRUPT_TABLE_DEFINITION, MYF(0), table.InitializationErrorString().c_str()); |
191 | + return ER_CORRUPT_TABLE_DEFINITION; |
192 | + } |
193 | + |
194 | share->setTableProto(new(nothrow) message::Table(table)); |
195 | |
196 | share->storage_engine= plugin::StorageEngine::findByName(session, table.engine().name()); |
197 | |
198 | === modified file 'plugin/blackhole/ha_blackhole.cc' |
199 | --- plugin/blackhole/ha_blackhole.cc 2010-02-04 08:14:46 +0000 |
200 | +++ plugin/blackhole/ha_blackhole.cc 2010-02-08 01:35:22 +0000 |
201 | @@ -259,6 +259,13 @@ |
202 | { |
203 | close(fd); |
204 | delete input; |
205 | + if (! table_proto->IsInitialized()) |
206 | + { |
207 | + my_error(ER_CORRUPT_TABLE_DEFINITION, MYF(0), |
208 | + table_proto->InitializationErrorString().c_str()); |
209 | + return ER_CORRUPT_TABLE_DEFINITION; |
210 | + } |
211 | + |
212 | return HA_ERR_CRASHED_ON_USAGE; |
213 | } |
214 | |
215 | |
216 | === added directory 'plugin/tableprototester' |
217 | === added file 'plugin/tableprototester/plugin.ini' |
218 | --- plugin/tableprototester/plugin.ini 1970-01-01 00:00:00 +0000 |
219 | +++ plugin/tableprototester/plugin.ini 2010-02-08 01:35:22 +0000 |
220 | @@ -0,0 +1,5 @@ |
221 | +[plugin] |
222 | +title=Table Proto Message Tester |
223 | +description=Used only to test other bits of the server. |
224 | +sources=tableprototester.cc |
225 | +headers=tableprototester.h |
226 | |
227 | === added file 'plugin/tableprototester/tableprototester.cc' |
228 | --- plugin/tableprototester/tableprototester.cc 1970-01-01 00:00:00 +0000 |
229 | +++ plugin/tableprototester/tableprototester.cc 2010-02-08 01:35:22 +0000 |
230 | @@ -0,0 +1,292 @@ |
231 | +/* |
232 | + Copyright (C) 2010 Stewart Smith |
233 | + |
234 | + This program is free software; you can redistribute it and/or |
235 | + modify it under the terms of the GNU General Public License |
236 | + as published by the Free Software Foundation; either version 2 |
237 | + of the License, or (at your option) any later version. |
238 | + |
239 | + This program is distributed in the hope that it will be useful, |
240 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
241 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
242 | + GNU General Public License for more details. |
243 | + |
244 | + You should have received a copy of the GNU General Public License |
245 | + along with this program; if not, write to the Free Software |
246 | + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
247 | +*/ |
248 | + |
249 | +#include "config.h" |
250 | +#include <drizzled/table.h> |
251 | +#include <drizzled/error.h> |
252 | +#include "drizzled/internal/my_pthread.h" |
253 | + |
254 | +#include "tableprototester.h" |
255 | + |
256 | +#include <fcntl.h> |
257 | + |
258 | +#include <string> |
259 | +#include <map> |
260 | +#include <fstream> |
261 | +#include <drizzled/message/table.pb.h> |
262 | +#include "drizzled/internal/m_string.h" |
263 | + |
264 | +#include "drizzled/global_charset_info.h" |
265 | + |
266 | + |
267 | +using namespace std; |
268 | +using namespace google; |
269 | +using namespace drizzled; |
270 | + |
271 | +#define TABLEPROTOTESTER_EXT ".TBT" |
272 | + |
273 | +static const char *TableProtoTesterCursor_exts[] = { |
274 | + NULL |
275 | +}; |
276 | + |
277 | +class TableProtoTesterEngine : public drizzled::plugin::StorageEngine |
278 | +{ |
279 | +public: |
280 | + TableProtoTesterEngine(const string &name_arg) |
281 | + : drizzled::plugin::StorageEngine(name_arg, |
282 | + HTON_NULL_IN_KEY | |
283 | + HTON_CAN_INDEX_BLOBS | |
284 | + HTON_SKIP_STORE_LOCK | |
285 | + HTON_AUTO_PART_KEY | |
286 | + HTON_HAS_DATA_DICTIONARY) |
287 | + { |
288 | + table_definition_ext= TABLEPROTOTESTER_EXT; |
289 | + } |
290 | + |
291 | + virtual Cursor *create(TableShare &table, |
292 | + drizzled::memory::Root *mem_root) |
293 | + { |
294 | + return new (mem_root) TableProtoTesterCursor(*this, table); |
295 | + } |
296 | + |
297 | + const char **bas_ext() const { |
298 | + return TableProtoTesterCursor_exts; |
299 | + } |
300 | + |
301 | + int doCreateTable(Session*, |
302 | + const char *, |
303 | + Table&, |
304 | + drizzled::message::Table&); |
305 | + |
306 | + int doDropTable(Session&, const string table_name); |
307 | + |
308 | + int doGetTableDefinition(Session& session, |
309 | + const char* path, |
310 | + const char *db, |
311 | + const char *table_name, |
312 | + const bool is_tmp, |
313 | + drizzled::message::Table *table_proto); |
314 | + |
315 | + void doGetTableNames(drizzled::CachedDirectory &directory, |
316 | + string&, set<string>& set_of_names) |
317 | + { |
318 | + (void)directory; |
319 | + set_of_names.insert("t1"); |
320 | + |
321 | + } |
322 | + |
323 | + /* The following defines can be increased if necessary */ |
324 | + uint32_t max_supported_keys() const { return 64; } |
325 | + uint32_t max_supported_key_length() const { return 1000; } |
326 | + uint32_t max_supported_key_part_length() const { return 1000; } |
327 | + |
328 | + uint32_t index_flags(enum ha_key_alg) const |
329 | + { |
330 | + return (HA_READ_NEXT | |
331 | + HA_READ_PREV | |
332 | + HA_READ_RANGE | |
333 | + HA_READ_ORDER | |
334 | + HA_KEYREAD_ONLY); |
335 | + } |
336 | + |
337 | +}; |
338 | + |
339 | +TableProtoTesterCursor::TableProtoTesterCursor(drizzled::plugin::StorageEngine &engine_arg, |
340 | + TableShare &table_arg) |
341 | + :Cursor(engine_arg, table_arg) |
342 | +{ } |
343 | + |
344 | +int TableProtoTesterCursor::open(const char *, int, uint32_t) |
345 | +{ |
346 | + return(0); |
347 | +} |
348 | + |
349 | +int TableProtoTesterCursor::close(void) |
350 | +{ |
351 | + return 0; |
352 | +} |
353 | + |
354 | +int TableProtoTesterEngine::doCreateTable(Session*, const char *, |
355 | + Table&, |
356 | + drizzled::message::Table&) |
357 | +{ |
358 | + return EEXIST; |
359 | +} |
360 | + |
361 | + |
362 | +int TableProtoTesterEngine::doDropTable(Session&, const string) |
363 | +{ |
364 | + return EPERM; |
365 | +} |
366 | + |
367 | +static void fill_table1(message::Table *table) |
368 | +{ |
369 | + message::Table::Field *field; |
370 | + message::Table::TableOptions *tableopts; |
371 | + |
372 | + table->set_name("t1"); |
373 | + table->set_type(message::Table::INTERNAL); |
374 | + |
375 | + tableopts= table->mutable_options(); |
376 | + tableopts->set_comment("Table without a StorageEngine message"); |
377 | + |
378 | + { |
379 | + field= table->add_field(); |
380 | + field->set_name("number"); |
381 | + field->set_type(message::Table::Field::INTEGER); |
382 | + } |
383 | + |
384 | +} |
385 | +int TableProtoTesterEngine::doGetTableDefinition(Session&, |
386 | + const char* path, |
387 | + const char *, |
388 | + const char *, |
389 | + const bool, |
390 | + drizzled::message::Table *table_proto) |
391 | +{ |
392 | + if (strcmp(path, "./test/t1") == 0) |
393 | + { |
394 | + if (table_proto) |
395 | + fill_table1(table_proto); |
396 | + return EEXIST; |
397 | + } |
398 | + return ENOENT; |
399 | +} |
400 | + |
401 | +const char *TableProtoTesterCursor::index_type(uint32_t) |
402 | +{ |
403 | + return("BTREE"); |
404 | +} |
405 | + |
406 | +int TableProtoTesterCursor::write_row(unsigned char *) |
407 | +{ |
408 | + return(table->next_number_field ? update_auto_increment() : 0); |
409 | +} |
410 | + |
411 | +int TableProtoTesterCursor::rnd_init(bool) |
412 | +{ |
413 | + return(0); |
414 | +} |
415 | + |
416 | + |
417 | +int TableProtoTesterCursor::rnd_next(unsigned char *) |
418 | +{ |
419 | + return(HA_ERR_END_OF_FILE); |
420 | +} |
421 | + |
422 | + |
423 | +int TableProtoTesterCursor::rnd_pos(unsigned char *, unsigned char *) |
424 | +{ |
425 | + assert(0); |
426 | + return(0); |
427 | +} |
428 | + |
429 | + |
430 | +void TableProtoTesterCursor::position(const unsigned char *) |
431 | +{ |
432 | + assert(0); |
433 | + return; |
434 | +} |
435 | + |
436 | + |
437 | +int TableProtoTesterCursor::info(uint32_t flag) |
438 | +{ |
439 | + memset(&stats, 0, sizeof(stats)); |
440 | + if (flag & HA_STATUS_AUTO) |
441 | + stats.auto_increment_value= 1; |
442 | + return(0); |
443 | +} |
444 | + |
445 | + |
446 | +int TableProtoTesterCursor::index_read_map(unsigned char *, const unsigned char *, |
447 | + key_part_map, enum ha_rkey_function) |
448 | +{ |
449 | + return(HA_ERR_END_OF_FILE); |
450 | +} |
451 | + |
452 | + |
453 | +int TableProtoTesterCursor::index_read_idx_map(unsigned char *, uint32_t, const unsigned char *, |
454 | + key_part_map, enum ha_rkey_function) |
455 | +{ |
456 | + return(HA_ERR_END_OF_FILE); |
457 | +} |
458 | + |
459 | + |
460 | +int TableProtoTesterCursor::index_read_last_map(unsigned char *, const unsigned char *, key_part_map) |
461 | +{ |
462 | + return(HA_ERR_END_OF_FILE); |
463 | +} |
464 | + |
465 | + |
466 | +int TableProtoTesterCursor::index_next(unsigned char *) |
467 | +{ |
468 | + return(HA_ERR_END_OF_FILE); |
469 | +} |
470 | + |
471 | + |
472 | +int TableProtoTesterCursor::index_prev(unsigned char *) |
473 | +{ |
474 | + return(HA_ERR_END_OF_FILE); |
475 | +} |
476 | + |
477 | + |
478 | +int TableProtoTesterCursor::index_first(unsigned char *) |
479 | +{ |
480 | + return(HA_ERR_END_OF_FILE); |
481 | +} |
482 | + |
483 | + |
484 | +int TableProtoTesterCursor::index_last(unsigned char *) |
485 | +{ |
486 | + return(HA_ERR_END_OF_FILE); |
487 | +} |
488 | + |
489 | +static drizzled::plugin::StorageEngine *tableprototester_engine= NULL; |
490 | + |
491 | +static int tableprototester_init(drizzled::plugin::Registry ®istry) |
492 | +{ |
493 | + |
494 | + tableprototester_engine= new TableProtoTesterEngine("TABLEPROTOTESTER"); |
495 | + registry.add(tableprototester_engine); |
496 | + |
497 | + return 0; |
498 | +} |
499 | + |
500 | +static int tableprototester_fini(drizzled::plugin::Registry ®istry) |
501 | +{ |
502 | + registry.remove(tableprototester_engine); |
503 | + delete tableprototester_engine; |
504 | + |
505 | + return 0; |
506 | +} |
507 | + |
508 | +DRIZZLE_DECLARE_PLUGIN |
509 | +{ |
510 | + DRIZZLE_VERSION_ID, |
511 | + "TABLEPROTOTESTER", |
512 | + "1.0", |
513 | + "Stewart Smith", |
514 | + "Used to test rest of server with various table proto messages", |
515 | + PLUGIN_LICENSE_GPL, |
516 | + tableprototester_init, /* Plugin Init */ |
517 | + tableprototester_fini, /* Plugin Deinit */ |
518 | + NULL, /* status variables */ |
519 | + NULL, /* system variables */ |
520 | + NULL /* config options */ |
521 | +} |
522 | +DRIZZLE_DECLARE_PLUGIN_END; |
523 | |
524 | === added file 'plugin/tableprototester/tableprototester.h' |
525 | --- plugin/tableprototester/tableprototester.h 1970-01-01 00:00:00 +0000 |
526 | +++ plugin/tableprototester/tableprototester.h 2010-02-08 01:35:22 +0000 |
527 | @@ -0,0 +1,58 @@ |
528 | +/* |
529 | + Copyright (C) 2010 Stewart Smith |
530 | + |
531 | + This program is free software; you can redistribute it and/or |
532 | + modify it under the terms of the GNU General Public License |
533 | + as published by the Free Software Foundation; either version 2 |
534 | + of the License, or (at your option) any later version. |
535 | + |
536 | + This program is distributed in the hope that it will be useful, |
537 | + but WITHOUT ANY WARRANTY; without even the implied warranty of |
538 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
539 | + GNU General Public License for more details. |
540 | + |
541 | + You should have received a copy of the GNU General Public License |
542 | + along with this program; if not, write to the Free Software |
543 | + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
544 | +*/ |
545 | + |
546 | +#ifndef PLUGIN_TABLEPROTOTESTER_TABLEPROTOTESTER_H |
547 | +#define PLUGIN_TABLEPROTOTESTER_TABLEPROTOTESTER_H |
548 | + |
549 | +#include <drizzled/cursor.h> |
550 | + |
551 | +class TableProtoTesterCursor: public drizzled::Cursor |
552 | +{ |
553 | +public: |
554 | + TableProtoTesterCursor(drizzled::plugin::StorageEngine &engine, drizzled::TableShare &table_arg); |
555 | + ~TableProtoTesterCursor() |
556 | + {} |
557 | + |
558 | + /* |
559 | + The name of the index type that will be used for display |
560 | + don't implement this method unless you really have indexes |
561 | + */ |
562 | + const char *index_type(uint32_t key_number); |
563 | + uint32_t index_flags(uint32_t inx) const; |
564 | + int open(const char *name, int mode, uint32_t test_if_locked); |
565 | + int close(void); |
566 | + int write_row(unsigned char * buf); |
567 | + int rnd_init(bool scan); |
568 | + int rnd_next(unsigned char *buf); |
569 | + int rnd_pos(unsigned char * buf, unsigned char *pos); |
570 | + |
571 | + int index_read_map(unsigned char * buf, const unsigned char * key, drizzled::key_part_map keypart_map, |
572 | + drizzled::ha_rkey_function find_flag); |
573 | + int index_read_idx_map(unsigned char * buf, uint32_t idx, const unsigned char * key, |
574 | + drizzled::key_part_map keypart_map, |
575 | + drizzled::ha_rkey_function find_flag); |
576 | + int index_read_last_map(unsigned char * buf, const unsigned char * key, drizzled::key_part_map keypart_map); |
577 | + int index_next(unsigned char * buf); |
578 | + int index_prev(unsigned char * buf); |
579 | + int index_first(unsigned char * buf); |
580 | + int index_last(unsigned char * buf); |
581 | + void position(const unsigned char *record); |
582 | + int info(uint32_t flag); |
583 | +}; |
584 | + |
585 | +#endif /* PLUGIN_TABLEPROTOTESTER_TABLEPROTOTESTER_H */ |
586 | |
587 | === added directory 'plugin/tableprototester/tests' |
588 | === added directory 'plugin/tableprototester/tests/r' |
589 | === added file 'plugin/tableprototester/tests/r/basic.result' |
590 | --- plugin/tableprototester/tests/r/basic.result 1970-01-01 00:00:00 +0000 |
591 | +++ plugin/tableprototester/tests/r/basic.result 2010-02-08 01:35:22 +0000 |
592 | @@ -0,0 +1,3 @@ |
593 | +SHOW TABLES; |
594 | +Tables_in_test |
595 | +t1 |
596 | |
597 | === added file 'plugin/tableprototester/tests/r/drop_table.result' |
598 | --- plugin/tableprototester/tests/r/drop_table.result 1970-01-01 00:00:00 +0000 |
599 | +++ plugin/tableprototester/tests/r/drop_table.result 2010-02-08 01:35:22 +0000 |
600 | @@ -0,0 +1,2 @@ |
601 | +DROP TABLE t1; |
602 | +ERROR HY000: Got error 17 from storage engine |
603 | |
604 | === added file 'plugin/tableprototester/tests/r/missing_engine.result' |
605 | --- plugin/tableprototester/tests/r/missing_engine.result 1970-01-01 00:00:00 +0000 |
606 | +++ plugin/tableprototester/tests/r/missing_engine.result 2010-02-08 01:35:22 +0000 |
607 | @@ -0,0 +1,5 @@ |
608 | +SHOW TABLES; |
609 | +Tables_in_test |
610 | +t1 |
611 | +SHOW CREATE TABLE t1; |
612 | +ERROR HY000: Corrupt or invalid table definition: engine |
613 | |
614 | === added directory 'plugin/tableprototester/tests/t' |
615 | === added file 'plugin/tableprototester/tests/t/basic-master.opt' |
616 | --- plugin/tableprototester/tests/t/basic-master.opt 1970-01-01 00:00:00 +0000 |
617 | +++ plugin/tableprototester/tests/t/basic-master.opt 2010-02-08 01:35:22 +0000 |
618 | @@ -0,0 +1,1 @@ |
619 | +--plugin_add=tableprototester |
620 | |
621 | === added file 'plugin/tableprototester/tests/t/basic.test' |
622 | --- plugin/tableprototester/tests/t/basic.test 1970-01-01 00:00:00 +0000 |
623 | +++ plugin/tableprototester/tests/t/basic.test 2010-02-08 01:35:22 +0000 |
624 | @@ -0,0 +1,1 @@ |
625 | +SHOW TABLES; |
626 | |
627 | === added file 'plugin/tableprototester/tests/t/drop_table-master.opt' |
628 | --- plugin/tableprototester/tests/t/drop_table-master.opt 1970-01-01 00:00:00 +0000 |
629 | +++ plugin/tableprototester/tests/t/drop_table-master.opt 2010-02-08 01:35:22 +0000 |
630 | @@ -0,0 +1,1 @@ |
631 | +--plugin_add=tableprototester |
632 | |
633 | === added file 'plugin/tableprototester/tests/t/drop_table.test' |
634 | --- plugin/tableprototester/tests/t/drop_table.test 1970-01-01 00:00:00 +0000 |
635 | +++ plugin/tableprototester/tests/t/drop_table.test 2010-02-08 01:35:22 +0000 |
636 | @@ -0,0 +1,2 @@ |
637 | +--error 1030 |
638 | +DROP TABLE t1; |
639 | |
640 | === added file 'plugin/tableprototester/tests/t/missing_engine-master.opt' |
641 | --- plugin/tableprototester/tests/t/missing_engine-master.opt 1970-01-01 00:00:00 +0000 |
642 | +++ plugin/tableprototester/tests/t/missing_engine-master.opt 2010-02-08 01:35:22 +0000 |
643 | @@ -0,0 +1,1 @@ |
644 | +--plugin_add=tableprototester |
645 | |
646 | === added file 'plugin/tableprototester/tests/t/missing_engine.test' |
647 | --- plugin/tableprototester/tests/t/missing_engine.test 1970-01-01 00:00:00 +0000 |
648 | +++ plugin/tableprototester/tests/t/missing_engine.test 2010-02-08 01:35:22 +0000 |
649 | @@ -0,0 +1,5 @@ |
650 | + |
651 | +SHOW TABLES; |
652 | + |
653 | +--error 1693 |
654 | +SHOW CREATE TABLE t1; |
Fix error reporting on bad table protobuf messages.
Also introduce testing of this.
We use a storage engine that presents tables and definitions to test server
functions such as parse_table_proto() instead of writing the proto out to a
file as some versions of the protobuf lib won't let you write out a proto
message that's missing required fields but within the server, it's possible
to get a message that is missing these fields.
We load this plugin ONLY for the test suite. It is NEVER designed to be used
by end users *at all*.