| 1 |
-- source include/have_ndb.inc |
| 2 |
|
| 3 |
# |
| 4 |
# Test showing extra ndb_desc options : |
| 5 |
# -a --autoinc |
| 6 |
# Show next stored autoincrement value for the table |
| 7 |
# |
| 8 |
# -x --context |
| 9 |
# Show table context info (database, schema, name and id) |
| 10 |
# |
| 11 |
|
| 12 |
--disable_query_log |
| 13 |
set @old_ndb_autoincrement_prefetch_sz = @@session.ndb_autoincrement_prefetch_sz; |
| 14 |
set ndb_autoincrement_prefetch_sz = 1; |
| 15 |
--enable_query_log |
| 16 |
|
| 17 |
create table test.t1 (a int auto_increment primary key, b int) engine=ndb; |
| 18 |
create table test.t2 (a int primary key, b int) engine=ndb; |
| 19 |
|
| 20 |
--echo Table with auto-inc, initial value |
| 21 |
--let $ndb_desc_opts= -a -x -dtest t1 |
| 22 |
--source suite/ndb/include/ndb_desc_print.inc |
| 23 |
|
| 24 |
insert into test.t1 (b) values (888); |
| 25 |
select * from test.t1 order by a; |
| 26 |
|
| 27 |
--echo Table with auto-inc, new value |
| 28 |
--let $ndb_desc_opts= -a -x -dtest t1 |
| 29 |
--source suite/ndb/include/ndb_desc_print.inc |
| 30 |
|
| 31 |
insert into test.t1 (a,b) values (12345, 888); |
| 32 |
select * from test.t1 order by a; |
| 33 |
|
| 34 |
--echo Table with auto-inc, forced value |
| 35 |
--let $ndb_desc_opts= -a -x -dtest t1 |
| 36 |
--source suite/ndb/include/ndb_desc_print.inc |
| 37 |
|
| 38 |
insert into test.t1 (b) values (888); |
| 39 |
select * from test.t1 order by a; |
| 40 |
|
| 41 |
--echo Table with auto-inc, next value after forced |
| 42 |
--let $ndb_desc_opts= -a -x -dtest t1 |
| 43 |
--source suite/ndb/include/ndb_desc_print.inc |
| 44 |
|
| 45 |
drop table test.t1; |
| 46 |
create table test.t1 (a int auto_increment primary key, b int) engine=ndb; |
| 47 |
|
| 48 |
--echo Re-created table with auto-inc, initial value |
| 49 |
--let $ndb_desc_opts= -a -x -dtest t1 |
| 50 |
--source suite/ndb/include/ndb_desc_print.inc |
| 51 |
|
| 52 |
drop table test.t1; |
| 53 |
create table test.t1 (a int primary key, b int) engine=ndb; |
| 54 |
|
| 55 |
--echo Re-created table with no auto-inc key |
| 56 |
--let $ndb_desc_opts= -a -x -dtest t1 |
| 57 |
--source suite/ndb/include/ndb_desc_print.inc |
| 58 |
|
| 59 |
|
| 60 |
--echo Table with no auto-inc |
| 61 |
--let $ndb_desc_opts= -a -x -dtest t2 |
| 62 |
|
| 63 |
drop table test.t1; |
| 64 |
drop table test.t2; |
| 65 |
|
| 66 |
--echo Show behaviour with a larger autoinc prefetch size |
| 67 |
set ndb_autoincrement_prefetch_sz = 8; |
| 68 |
|
| 69 |
create table test.t3 (a int auto_increment primary key, b int) engine=ndb; |
| 70 |
|
| 71 |
--echo Initial value : 1 |
| 72 |
--let $ndb_desc_opts= -a -x -dtest t3 |
| 73 |
--source suite/ndb/include/ndb_desc_print.inc |
| 74 |
|
| 75 |
insert into test.t3 (b) values (1); |
| 76 |
select * from test.t3 order by a; |
| 77 |
|
| 78 |
--echo After 1 insertion : 1 + 8 = 9 |
| 79 |
--let $ndb_desc_opts= -a -x -dtest t3 |
| 80 |
--source suite/ndb/include/ndb_desc_print.inc |
| 81 |
|
| 82 |
insert into test.t3 (b) values (1), (1), (1), (1), (1), (1), (1); |
| 83 |
select * from test.t3 order by a; |
| 84 |
|
| 85 |
--echo After 8 insertions : Still 9 |
| 86 |
--let $ndb_desc_opts= -a -x -dtest t3 |
| 87 |
--source suite/ndb/include/ndb_desc_print.inc |
| 88 |
|
| 89 |
insert into test.t3 (b) values (1); |
| 90 |
select * from test.t3 order by a; |
| 91 |
|
| 92 |
--echo After 9 insertions : 9 + 8 = 17 |
| 93 |
--let $ndb_desc_opts= -a -x -dtest t3 |
| 94 |
--source suite/ndb/include/ndb_desc_print.inc |
| 95 |
|
| 96 |
drop table test.t3; |
| 97 |
|
| 98 |
--disable_query_log |
| 99 |
set ndb_autoincrement_prefetch_sz = @old_ndb_autoincrement_prefetch_sz; |
| 100 |
--enable_query_log |
| 101 |
|
| 102 |
--echo Show embedded-metadata behaviour |
| 103 |
|
| 104 |
--echo sys/def/SYSTAB_0 has no embedded metadata |
| 105 |
--let $ndb_desc_opts= --embedded-metadata -dsys SYSTAB_0 |
| 106 |
--source suite/ndb/include/ndb_desc_print.inc |
| 107 |
|
| 108 |
|
| 109 |
--let $OUTPUT_FILE = $MYSQLTEST_VARDIR/tmp/ndb_desc_extra.txt |
| 110 |
|
| 111 |
--echo mysql/def/ndb_apply_status has embedded frm |
| 112 |
--exec $NDB_DESC -m -dmysql ndb_apply_status > $OUTPUT_FILE |
| 113 |
|
| 114 |
--let $assert_text= Version 1 embedded metadata (frm) |
| 115 |
--let $assert_file= $OUTPUT_FILE |
| 116 |
--let $assert_select= Metadata version : 1 |
| 117 |
--let $assert_count= 1 |
| 118 |
|
| 119 |
--source include/assert_grep.inc |
| 120 |
|
| 121 |
--remove_file $OUTPUT_FILE |
| 122 |
|
| 123 |
--echo User table has SDI with creating mysqld version |
| 124 |
create table test.user_tab(a int primary key, b varchar(50) default 'Hello', c blob, d json) engine=ndb; |
| 125 |
|
| 126 |
--exec $NDB_DESC -m -dtest user_tab > $OUTPUT_FILE |
| 127 |
--let $assert_text= SDI contains MySQL Server version |
| 128 |
--let $assert_file= $OUTPUT_FILE |
| 129 |
--let $assert_select= mysqld_version_id |
| 130 |
--let $assert_count= 1 |
| 131 |
|
| 132 |
--source include/assert_grep.inc |
| 133 |
|
| 134 |
--remove_file $OUTPUT_FILE |
| 135 |
|
| 136 |
drop table test.user_tab; |