File: wait_index_stat_updated.inc

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (45 lines) | stat: -rw-r--r-- 1,188 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#
# Wait until index stats have been updated for a table.
# Times out after waiting for 30 seconds
#
# Usage:
#
# let $index_stat_db=<db name>;
# let $index_stat_table=<table name>;
# let $expected_version=<expected sample version>
# source wait_index_stats_updated.inc;
#

if (`select LENGTH('$index_stat_db') = 0`)
{
  # Default is test
  let $index_stat_db=test;
}
if (`select LENGTH('$index_stat_table') = 0`)
{
  # Default is t1
  let $index_stat_table=t1;
}
if (`select LENGTH('$expected_version') = 0`)
{
  # Default is 1
  let $expected_version=1;
}

let $root_name = '$index_stat_db/def/$index_stat_table';
# Get the id of an ordered index on the table
let $index_id =
  query_get_value(SELECT id FROM ndbinfo.dict_obj_tree
                  WHERE root_name = $root_name AND type = 6, id, 1);

# Wait until a new sample version shows up in the ndbinfo table
let $wait_condition = SELECT MAX(sample_version) > $expected_version
                      FROM ndbinfo.index_stats
                      WHERE index_id = $index_id;
source include/wait_condition.inc;

echo Stats automatically updated;
#echo Sample version: $sample_version;

let $index_stat_db=;
let $index_stat_table=;