| 1 |
--source include/have_ndb.inc |
| 2 |
--source have_ndb_error_insert.inc |
| 3 |
|
| 4 |
connect(con1, localhost, root,,); |
| 5 |
connect(con2, localhost, root,,); |
| 6 |
|
| 7 |
--echo check COMMIT behaviour with out-of-order signals and single delete |
| 8 |
|
| 9 |
--echo record DBTUP resource usage before test |
| 10 |
--exec $NDB_MGM -e "all dump 4000" >> $NDB_TOOLS_OUTPUT |
| 11 |
|
| 12 |
CREATE TABLE test.t1 (a int primary key, b int) engine=ndb; |
| 13 |
INSERT INTO test.t1 values (101,101), (202,202); |
| 14 |
|
| 15 |
--exec $NDB_MGM -e "all error 5093" >> $NDB_TOOLS_OUTPUT |
| 16 |
|
| 17 |
let $injected_error_count = |
| 18 |
`SELECT COUNT(*) FROM ndbinfo.ndb\\\$threadblock_details |
| 19 |
WHERE error_insert_value <> 0`; |
| 20 |
|
| 21 |
# Test for multiple ops on specific tuple in transaction, where overall result |
| 22 |
# is deletion of tuple. Error insert re-orders COMMIT and delays COMPLETE to |
| 23 |
# provide a time window where |
| 24 |
# - READ was committed after DELETE |
| 25 |
# - READ has completed on primary and DELETE has not yet completed on backup |
| 26 |
# The tuple should still be deallocated in such a way that this time window |
| 27 |
# has a consistent rowID status: the rowID should either be available on both |
| 28 |
# the primary and the backup, or it should be unavailable on both. |
| 29 |
BEGIN; |
| 30 |
SELECT * FROM test.t1 where a=101 FOR UPDATE; # READ-EX |
| 31 |
UPDATE test.t1 SET b=101 where a=101; # UPDATE |
| 32 |
DELETE FROM test.t1 where a=101; # DELETE |
| 33 |
COMMIT; # Delayed due to error inserts + |
| 34 |
--disable_query_log |
| 35 |
# Start an insert load to use free rowIDs. There should be no rowIDs which |
| 36 |
# have been dealloc'd on the primary but not on the backup, so inserts should |
| 37 |
# never hit an error 899 "rowID already allocated". |
| 38 |
let $i= 100; |
| 39 |
while ($i) |
| 40 |
{ |
| 41 |
eval INSERT INTO test.t1 values ($i, $i); |
| 42 |
dec $i; |
| 43 |
} |
| 44 |
--enable_query_log |
| 45 |
|
| 46 |
drop table test.t1; |
| 47 |
|
| 48 |
let $remaining_error_count = |
| 49 |
`SELECT COUNT(*) FROM ndbinfo.ndb\\\$threadblock_details |
| 50 |
WHERE error_insert_value <> 0`; |
| 51 |
if ($remaining_error_count == $injected_error_count) |
| 52 |
{ |
| 53 |
die Error injection not hit; |
| 54 |
} |
| 55 |
|
| 56 |
--echo compare current DBTUP resource usage w/usage before test to check for leaks |
| 57 |
--exec $NDB_MGM -e "all dump 4001" >> $NDB_TOOLS_OUTPUT |
| 58 |
|
| 59 |
--echo check COMMIT behaviour with out-of-order signals and multiple deletes |
| 60 |
|
| 61 |
--echo record DBTUP resource usage before test |
| 62 |
--exec $NDB_MGM -e "all dump 4000" >> $NDB_TOOLS_OUTPUT |
| 63 |
|
| 64 |
CREATE TABLE test.t1 (a int primary key, b int) engine=ndb; |
| 65 |
INSERT INTO test.t1 values (101,101), (202,202); |
| 66 |
|
| 67 |
--exec $NDB_MGM -e "all error 5093" >> $NDB_TOOLS_OUTPUT |
| 68 |
|
| 69 |
# Test for multiple ops on specific tuple in transaction, where overall result |
| 70 |
# is deletion of tuple. Error insert re-orders COMMIT and delays COMPLETE to |
| 71 |
# provide a time window where |
| 72 |
# - READ was committed after DELETE |
| 73 |
# - READ has completed on primary and DELETE has not yet completed on backup |
| 74 |
# The tuple should still be deallocated in such a way that this time window |
| 75 |
# has a consistent rowID status: the rowID should either be available on both |
| 76 |
# the primary and the backup, or it should be unavailable on both. |
| 77 |
BEGIN; |
| 78 |
SELECT * FROM test.t1 where a=101 FOR UPDATE; # READ-EX |
| 79 |
DELETE FROM test.t1 where a=101; # DELETE |
| 80 |
INSERT INTO test.t1 values (101,102); # INSERT |
| 81 |
UPDATE test.t1 SET b=101 where a=101; # DELETE |
| 82 |
DELETE FROM test.t1 where a=101; # DELETE |
| 83 |
COMMIT; # Delayed due to error inserts + |
| 84 |
--disable_query_log |
| 85 |
# Start an insert load to use free rowIDs. There should be no rowIDs which |
| 86 |
# have been dealloc'd on the primary but not on the backup, so inserts should |
| 87 |
# never hit an error 899 "rowID already allocated". |
| 88 |
let $i= 100; |
| 89 |
while ($i) |
| 90 |
{ |
| 91 |
eval INSERT INTO test.t1 values ($i, $i); |
| 92 |
dec $i; |
| 93 |
} |
| 94 |
--enable_query_log |
| 95 |
|
| 96 |
drop table test.t1; |
| 97 |
|
| 98 |
let $remaining_error_count = |
| 99 |
`SELECT COUNT(*) FROM ndbinfo.ndb\\\$threadblock_details |
| 100 |
WHERE error_insert_value <> 0`; |
| 101 |
if ($remaining_error_count == $injected_error_count) |
| 102 |
{ |
| 103 |
die Error injection not hit; |
| 104 |
} |
| 105 |
|
| 106 |
--echo compare current DBTUP resource usage w/usage before test to check for leaks |
| 107 |
--exec $NDB_MGM -e "all dump 4001" >> $NDB_TOOLS_OUTPUT |
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
--echo check COMMIT behaviour with concurrent reads |
| 113 |
|
| 114 |
--echo record DBTUP resource usage before test |
| 115 |
--exec $NDB_MGM -e "all dump 4000" >> $NDB_TOOLS_OUTPUT |
| 116 |
|
| 117 |
CREATE TABLE test.t1 (a int primary key, b int) engine=ndb; |
| 118 |
INSERT INTO test.t1 values (101,101), (202,202); |
| 119 |
|
| 120 |
--exec $NDB_MGM -e "all error 5093" >> $NDB_TOOLS_OUTPUT |
| 121 |
|
| 122 |
--connection con1 |
| 123 |
|
| 124 |
delimiter %; |
| 125 |
create procedure work(total int) |
| 126 |
begin |
| 127 |
set @x = 0; |
| 128 |
repeat |
| 129 |
select * from test.t1 where a=101; |
| 130 |
set @x = @x + 1; |
| 131 |
until @x = total |
| 132 |
end repeat; |
| 133 |
end% |
| 134 |
|
| 135 |
delimiter ;% |
| 136 |
|
| 137 |
--send call work(10000); |
| 138 |
|
| 139 |
--connection con2 |
| 140 |
|
| 141 |
# Test for multiple ops on specific tuple in transaction, where overall result |
| 142 |
# is deletion of tuple. Error insert re-orders COMMIT and delays COMPLETE to |
| 143 |
# provide a time window where |
| 144 |
# - READ was committed after DELETE |
| 145 |
# - READ has completed on primary and DELETE has not yet completed on backup |
| 146 |
# The tuple should still be deallocated in such a way that this time window |
| 147 |
# has a consistent rowID status: the rowID should either be available on both |
| 148 |
# the primary and the backup, or it should be unavailable on both. |
| 149 |
BEGIN; |
| 150 |
SELECT * FROM test.t1 where a=101 FOR UPDATE; # READ-EX |
| 151 |
DELETE FROM test.t1 where a=101; # INITIAL DELETE |
| 152 |
INSERT INTO test.t1 values (101,102); # INSERT |
| 153 |
UPDATE test.t1 SET b=101 where a=101; # UPDATE |
| 154 |
DELETE FROM test.t1 where a=101; # DELETE |
| 155 |
COMMIT; # Delayed due to error inserts + |
| 156 |
|
| 157 |
--connection con1 |
| 158 |
--disable_query_log |
| 159 |
--disable_result_log |
| 160 |
--reap |
| 161 |
--enable_query_log |
| 162 |
--enable_result_log |
| 163 |
drop procedure work; |
| 164 |
|
| 165 |
drop table test.t1; |
| 166 |
|
| 167 |
let $remaining_error_count = |
| 168 |
`SELECT COUNT(*) FROM ndbinfo.ndb\\\$threadblock_details |
| 169 |
WHERE error_insert_value <> 0`; |
| 170 |
if ($remaining_error_count == $injected_error_count) |
| 171 |
{ |
| 172 |
die Error injection not hit; |
| 173 |
} |
| 174 |
|
| 175 |
--echo compare current DBTUP resource usage w/usage before test to check for leaks |
| 176 |
--exec $NDB_MGM -e "all dump 4001" >> $NDB_TOOLS_OUTPUT |
| 177 |
|
| 178 |
|
| 179 |
--echo check ABORT behaviour with out-of-order signals |
| 180 |
|
| 181 |
--echo record DBTUP resource usage before test |
| 182 |
--exec $NDB_MGM -e "all dump 4000" >> $NDB_TOOLS_OUTPUT |
| 183 |
|
| 184 |
CREATE TABLE test.t1 (a int primary key, b int) engine=ndb; |
| 185 |
INSERT INTO test.t1 values (101,101), (202,202); |
| 186 |
|
| 187 |
--exec $NDB_MGM -e "all error 5093" >> $NDB_TOOLS_OUTPUT |
| 188 |
|
| 189 |
BEGIN; |
| 190 |
SELECT * FROM test.t1 where a=101 FOR UPDATE; # READ-EX |
| 191 |
DELETE FROM test.t1 where a=101; # DELETE |
| 192 |
INSERT INTO test.t1 values (101,102); # INSERT |
| 193 |
UPDATE test.t1 SET b=101 where a=101; # DELETE |
| 194 |
DELETE FROM test.t1 where a=101; # DELETE |
| 195 |
INSERT INTO test.t1 values (101,102); # INSERT |
| 196 |
ROLLBACK; # Delayed due to error inserts + |
| 197 |
--disable_query_log |
| 198 |
let $i= 100; |
| 199 |
while ($i) |
| 200 |
{ |
| 201 |
eval INSERT INTO test.t1 values ($i, $i); |
| 202 |
dec $i; |
| 203 |
} |
| 204 |
--enable_query_log |
| 205 |
|
| 206 |
drop table test.t1; |
| 207 |
|
| 208 |
let $remaining_error_count = `select count(*) from ndbinfo.ndb\\\$threadblock_details where error_insert_value <> 0`; |
| 209 |
if ($remaining_error_count == $injected_error_count) |
| 210 |
{ |
| 211 |
die Error injection not hit; |
| 212 |
} |
| 213 |
|
| 214 |
--echo compare current DBTUP resource usage w/usage before test to check for leaks |
| 215 |
--exec $NDB_MGM -e "all dump 4001" >> $NDB_TOOLS_OUTPUT |
| 216 |
--remove_file $NDB_TOOLS_OUTPUT |
| 217 |
|
| 218 |
--exec $NDB_MGM -e "all error 0" |