Debian Codegraph @

mysql-test/suite/ndb_opt/wait_index_stat_cache_updated.inc

raw
1 #
2 # Check if the index stat cache has been updated. This is done by keeping
3 # track of the events on the ndb_index_stat_head table which is exposed by
4 # the Ndb_index_stat_event_count status variable.
5 #
6 # Usage:
7 #
8 # --let $old_event_count=
9 # query_get_value(SHOW STATUS LIKE 'Ndb_index_stat_event_count', Value, 1)
10 # < Changes that are expected to cause an auto-update of index stats >
11 # --let $index_stat_db=<db name>
12 # --let $index_stat_table=<table name>
13 # --source wait_index_stat_cache_updated.inc
14 #
15
16 if (`select LENGTH('$index_stat_db') = 0`)
17 {
18 # Default is test
19 --let $index_stat_db=test
20 }
21 if (`select LENGTH('$index_stat_table') = 0`)
22 {
23 # Default is t1
24 --let $index_stat_table=t1
25 }
26
27 #--echo Old event count = $old_event_count
28 --let $root_name = $index_stat_db/def/$index_stat_table
29 # Get index count
30 --let $index_count = query_get_value(SELECT COUNT(*) FROM ndbinfo.dict_obj_tree WHERE root_name = '$root_name' AND type = 6, COUNT(*), 1)
31 #--echo Index count = $index_count
32 --expr $expected_event_count = $old_event_count + $index_count
33 --echo Waiting for the index stats to be updated
34 # Suppress the echo when the wait times out. It's likely that an event has
35 # been handled earlier than expected. We are more concerned about scenarios
36 # where the stats haven't been updated. This will be detected in the select
37 # queries that follow the wait
38 --let $silent_failure=1
39 --let $wait_condition = SELECT VARIABLE_VALUE >= $expected_event_count FROM performance_schema.global_status WHERE VARIABLE_NAME LIKE 'Ndb_index_stat_event_count'
40 --source include/wait_condition.inc
41 --echo Index stats updated