| 1 |
# |
| 2 |
# Wait until index stats have been updated for a table. |
| 3 |
# Times out after waiting for 30 seconds |
| 4 |
# |
| 5 |
# Usage: |
| 6 |
# |
| 7 |
# let $index_stat_db=<db name>; |
| 8 |
# let $index_stat_table=<table name>; |
| 9 |
# let $expected_version=<expected sample version> |
| 10 |
# source wait_index_stats_updated.inc; |
| 11 |
# |
| 12 |
|
| 13 |
if (`select LENGTH('$index_stat_db') = 0`) |
| 14 |
{ |
| 15 |
# Default is test |
| 16 |
let $index_stat_db=test; |
| 17 |
} |
| 18 |
if (`select LENGTH('$index_stat_table') = 0`) |
| 19 |
{ |
| 20 |
# Default is t1 |
| 21 |
let $index_stat_table=t1; |
| 22 |
} |
| 23 |
if (`select LENGTH('$expected_version') = 0`) |
| 24 |
{ |
| 25 |
# Default is 1 |
| 26 |
let $expected_version=1; |
| 27 |
} |
| 28 |
|
| 29 |
let $root_name = '$index_stat_db/def/$index_stat_table'; |
| 30 |
# Get the id of an ordered index on the table |
| 31 |
let $index_id = |
| 32 |
query_get_value(SELECT id FROM ndbinfo.dict_obj_tree |
| 33 |
WHERE root_name = $root_name AND type = 6, id, 1); |
| 34 |
|
| 35 |
# Wait until a new sample version shows up in the ndbinfo table |
| 36 |
let $wait_condition = SELECT MAX(sample_version) > $expected_version |
| 37 |
FROM ndbinfo.index_stats |
| 38 |
WHERE index_id = $index_id; |
| 39 |
source include/wait_condition.inc; |
| 40 |
|
| 41 |
echo Stats automatically updated; |
| 42 |
#echo Sample version: $sample_version; |
| 43 |
|
| 44 |
let $index_stat_db=; |
| 45 |
let $index_stat_table=; |