| 1 |
-- source include/have_ndb.inc |
| 2 |
|
| 3 |
# Test is using error insert, check that binaries support it |
| 4 |
--source have_ndb_error_insert.inc |
| 5 |
|
| 6 |
--source suite/ndb/include/turn_off_ndb_read_backup.inc |
| 7 |
|
| 8 |
--exec $NDB_MGM -e "all error 0" >> $NDB_TOOLS_OUTPUT |
| 9 |
|
| 10 |
# make ndb nodes die if correct tc is not selected |
| 11 |
|
| 12 |
--echo # |
| 13 |
--echo # Test tc select with 2-way joins with unique lookups |
| 14 |
--echo # |
| 15 |
|
| 16 |
create table t1 ( |
| 17 |
a int key, |
| 18 |
b int |
| 19 |
) charset latin1 engine ndb; |
| 20 |
create table t2 ( |
| 21 |
a int, |
| 22 |
b int, |
| 23 |
c int, |
| 24 |
d int, |
| 25 |
primary key(a,b), |
| 26 |
unique(d) |
| 27 |
) charset latin1 engine ndb partition by key(a); |
| 28 |
--disable_query_log |
| 29 |
--disable_result_log |
| 30 |
let $i= 100; |
| 31 |
let $j= 1; |
| 32 |
while ($i) |
| 33 |
{ |
| 34 |
--eval insert into t1 values ("$i","$j") |
| 35 |
--eval insert into t2 values ("$i","$j",9999,"$j") |
| 36 |
dec $i; |
| 37 |
inc $j; |
| 38 |
} |
| 39 |
--enable_query_log |
| 40 |
--enable_result_log |
| 41 |
|
| 42 |
--echo # |
| 43 |
--echo # 2-way join tc selection in pk |
| 44 |
--echo # |
| 45 |
--exec $NDB_MGM -e "all error 8072" >> $NDB_TOOLS_OUTPUT |
| 46 |
--replace_column 10 # 11 # |
| 47 |
explain select t2.c from t1,t2 where t1.a=50 and t2.a=t1.a and t2.b=t1.b; |
| 48 |
--disable_query_log |
| 49 |
--disable_result_log |
| 50 |
let $i= 100; |
| 51 |
while ($i) |
| 52 |
{ |
| 53 |
--eval select t2.c from t1,t2 where t1.a="$i" and t2.a=t1.a and t2.b=t1.b |
| 54 |
dec $i; |
| 55 |
} |
| 56 |
--enable_query_log |
| 57 |
--enable_result_log |
| 58 |
|
| 59 |
--echo # |
| 60 |
--echo # 2-way join tc selection in unique key |
| 61 |
--echo # |
| 62 |
--exec $NDB_MGM -e "all error 8071" >> $NDB_TOOLS_OUTPUT |
| 63 |
--replace_column 10 # 11 # |
| 64 |
explain select t1.b from t1,t2 where t2.d=50 and t1.a=t2.a; |
| 65 |
--disable_query_log |
| 66 |
--disable_result_log |
| 67 |
let $i= 100; |
| 68 |
while ($i) |
| 69 |
{ |
| 70 |
--eval select t1.b from t1,t2 where t2.d="$i" and t1.a=t2.a |
| 71 |
dec $i; |
| 72 |
} |
| 73 |
--enable_query_log |
| 74 |
--enable_result_log |
| 75 |
|
| 76 |
# cleanup |
| 77 |
--exec $NDB_MGM -e "all error 0" >> $NDB_TOOLS_OUTPUT |
| 78 |
drop table t1,t2; |
| 79 |
|
| 80 |
|
| 81 |
--echo # |
| 82 |
--echo # Test tc select with 2-way joins with scan followed by unique lookup |
| 83 |
--echo # |
| 84 |
|
| 85 |
create table t1 ( |
| 86 |
a int, |
| 87 |
b int, |
| 88 |
primary key(a,b) |
| 89 |
) charset latin1 engine ndb partition by key (a); |
| 90 |
create table t2 ( |
| 91 |
a int, |
| 92 |
b int, |
| 93 |
c int, |
| 94 |
primary key(a,b) |
| 95 |
) charset latin1 engine ndb partition by key (a); |
| 96 |
|
| 97 |
--disable_query_log |
| 98 |
--disable_result_log |
| 99 |
let $i= 100; |
| 100 |
let $j= 1; |
| 101 |
while ($i) |
| 102 |
{ |
| 103 |
--eval insert into t1 values ("$i","$j") |
| 104 |
--eval insert into t2 values ("$i",9999,"$j") |
| 105 |
dec $i; |
| 106 |
inc $j; |
| 107 |
} |
| 108 |
--enable_query_log |
| 109 |
--enable_result_log |
| 110 |
|
| 111 |
--exec $NDB_MGM -e "all error 8071" >> $NDB_TOOLS_OUTPUT |
| 112 |
--replace_column 10 # 11 # |
| 113 |
explain select t2.c from t1,t2 where t1.a=50 and t2.a=t1.a and t2.b=t1.b; |
| 114 |
--disable_query_log |
| 115 |
--disable_result_log |
| 116 |
let $i= 100; |
| 117 |
while ($i) |
| 118 |
{ |
| 119 |
--eval select t2.c from t1,t2 where t1.a="$i" and t2.a=t1.a and t2.b=t1.b |
| 120 |
dec $i; |
| 121 |
} |
| 122 |
--enable_query_log |
| 123 |
--enable_result_log |
| 124 |
|
| 125 |
# cleanup |
| 126 |
--exec $NDB_MGM -e "all error 0" >> $NDB_TOOLS_OUTPUT |
| 127 |
drop table t1,t2; |
| 128 |
|
| 129 |
|
| 130 |
--let $type1= int |
| 131 |
--let $type2= varchar(22) |
| 132 |
--source suite/ndb/t/ndb_dbug_tc_select_1.inc |
| 133 |
|
| 134 |
--let $type1= varchar(1024) |
| 135 |
--let $type2= int |
| 136 |
--source suite/ndb/t/ndb_dbug_tc_select_1.inc |
| 137 |
|
| 138 |
--let $type1= varchar(32) |
| 139 |
--let $type2= varchar(257) |
| 140 |
--source suite/ndb/t/ndb_dbug_tc_select_1.inc |
| 141 |
|
| 142 |
--let $type1= int |
| 143 |
--let $type2= int |
| 144 |
--let $type3= int |
| 145 |
--source suite/ndb/t/ndb_dbug_tc_select_2.inc |
| 146 |
|
| 147 |
--let $type1= int |
| 148 |
--let $type2= char(22) |
| 149 |
--let $type3= char(12) |
| 150 |
--source suite/ndb/t/ndb_dbug_tc_select_2.inc |
| 151 |
|
| 152 |
--let $type1= varchar(32) |
| 153 |
--let $type2= int |
| 154 |
--let $type3= varchar(257) |
| 155 |
--source suite/ndb/t/ndb_dbug_tc_select_2.inc |
| 156 |
|
| 157 |
--let $type1= int |
| 158 |
--let $type2= int |
| 159 |
--let $type3= int |
| 160 |
--let $type4= int |
| 161 |
--source suite/ndb/t/ndb_dbug_tc_select_3.inc |
| 162 |
|
| 163 |
--let $type1= int |
| 164 |
--let $type2= varchar(22) |
| 165 |
--let $type3= char(12) |
| 166 |
--let $type4= varchar(257) |
| 167 |
--source suite/ndb/t/ndb_dbug_tc_select_3.inc |
| 168 |
|
| 169 |
--let $type1= varchar(1024) |
| 170 |
--let $type2= char(22) |
| 171 |
--let $type3= varchar(257) |
| 172 |
--let $type4= char(12) |
| 173 |
--source suite/ndb/t/ndb_dbug_tc_select_3.inc |
| 174 |
|
| 175 |
--source suite/ndb/include/restore_ndb_read_backup.inc |
| 176 |
--remove_file $NDB_TOOLS_OUTPUT |