| 1 |
# |
| 2 |
# Test for read before write removal(rbwr) optimization in MySQL Cluster |
| 3 |
# - Run one testcase using different setttings |
| 4 |
# |
| 5 |
|
| 6 |
let $counter = 2; |
| 7 |
while($counter) |
| 8 |
{ |
| 9 |
|
| 10 |
# Load data into test table |
| 11 |
eval insert into $test_table select * from data_$test_table; |
| 12 |
|
| 13 |
# Create reference table |
| 14 |
eval create table ref_$test_table engine=innodb select * from $test_table; |
| 15 |
|
| 16 |
# Run the query against reference table |
| 17 |
let $test_query_ref = |
| 18 |
`SELECT REPLACE('$test_query', '$test_table', 'ref_$test_table')`; |
| 19 |
eval $test_query_ref; |
| 20 |
|
| 21 |
# Save ndb_execute_count from before query |
| 22 |
let $before = query_get_value( |
| 23 |
select VARIABLE_VALUE from performance_schema.session_status |
| 24 |
where variable_name like 'NDB_EXECUTE_COUNT', VARIABLE_VALUE, 1); |
| 25 |
|
| 26 |
let $transaction = 0; |
| 27 |
if ($counter == 2) |
| 28 |
{ |
| 29 |
# Run within transaction, this may cause one more execute |
| 30 |
let $transaction = 1; |
| 31 |
begin; |
| 32 |
} |
| 33 |
|
| 34 |
# Run the query |
| 35 |
--enable_info |
| 36 |
eval $test_query; |
| 37 |
--disable_info |
| 38 |
|
| 39 |
if ($counter == 2) |
| 40 |
{ |
| 41 |
# Commit the transaction |
| 42 |
commit; |
| 43 |
} |
| 44 |
|
| 45 |
# Calculate number of ndb_execute_count's generated by query |
| 46 |
let $diff = query_get_value( |
| 47 |
select VARIABLE_VALUE-$before AS diff from performance_schema.session_status |
| 48 |
where variable_name like 'NDB_EXECUTE_COUNT', diff, 1); |
| 49 |
|
| 50 |
if ($transaction) |
| 51 |
{ |
| 52 |
# Check if $diff should be decreased to compensate for the |
| 53 |
# execute caused by using transaction |
| 54 |
if ($diff != $test_execute_count) |
| 55 |
{ |
| 56 |
dec $diff; |
| 57 |
} |
| 58 |
} |
| 59 |
|
| 60 |
if ($diff != $test_execute_count) |
| 61 |
{ |
| 62 |
--echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 63 |
--echo Unxpected ndb_execute_count detected |
| 64 |
--echo - actual ndb_execute_count: $diff |
| 65 |
--echo - expected ndb_execute_count: $test_execute_count |
| 66 |
--echo - query: '$test_query' |
| 67 |
--echo - Within transaction: $transaction |
| 68 |
--echo !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
| 69 |
let $ndb_rbwr_fail = 1; |
| 70 |
} |
| 71 |
|
| 72 |
# Compare data in test table against reference table |
| 73 |
let $ndb_diff_tables= $test_table, ref_$test_table; |
| 74 |
--source suite/ndb/include/ndb_diff_tables.inc |
| 75 |
|
| 76 |
# Cleanup |
| 77 |
eval delete from $test_table; |
| 78 |
eval drop table ref_$test_table; |
| 79 |
|
| 80 |
dec $counter; |
| 81 |
|
| 82 |
} |