Debian Codegraph @

mysql-test/suite/innodb/include/print_instant_part_metadata.inc

raw
1 #-------------------------------------------------------
2 # Prints instant metadata of partition table and it's
3 # columns from
4 # - DD Tables
5 # - Information_schema tables
6 # NOTE : $table_name needs to be set.
7 # : $is_debug to be set for debug build
8 #-------------------------------------------------------
9
10 --disable_query_log
11 --let $n_parts = `SELECT COUNT(*) from information_schema.innodb_tables where name like "%$table_name%"`
12
13 --let $part_no = 0
14 while ($part_no < $n_parts)
15 {
16 --let $part_name = `select NAME from information_schema.innodb_tables where name like "%$table_name%" limit $part_no, 1`
17 --let $table_id = `SELECT TABLE_ID FROM INFORMATION_SCHEMA.INNODB_TABLES WHERE NAME="$part_name"`
18
19 if ($is_debug)
20 {
21 # Print DD metadata only once for 1st partition
22 if ($part_no == 0)
23 {
24 --echo # DD Metadata of columns in table
25 SET SESSION debug= '+d,skip_dd_table_access_check';
26 eval SELECT ID INTO @tid FROM mysql.tables WHERE NAME='$table_name';
27 --replace_regex /table_id=[0-9]+;/table_id=TABLE_ID;/
28 SELECT NAME, ORDINAL_POSITION, TYPE, HAS_NO_DEFAULT, HIDDEN, SE_PRIVATE_DATA
29 FROM mysql.columns
30 WHERE TABLE_ID=@tid
31 ORDER BY ORDINAL_POSITION;
32
33 --echo # DD Metadata of partitions in table
34 SELECT NAME, DESCRIPTION_UTF8, SE_PRIVATE_DATA
35 FROM mysql.table_partitions
36 WHERE TABLE_ID=@tid;
37 }
38
39 --echo # Metadata from INFORMATION_SCHEMA.TABLES
40 eval SELECT NAME, N_COLS, INSTANT_COLS, TOTAL_ROW_VERSIONS,
41 INITIAL_COLUMN_COUNTS, CURRENT_COLUMN_COUNTS, TOTAL_COLUMN_COUNTS
42 FROM INFORMATION_SCHEMA.INNODB_TABLES
43 WHERE TABLE_ID=$table_id;
44
45 --echo # Metadata from INFORMATION_SCHEMA.COLUMNS
46 SET SESSION debug= '+d,show_dropped_column';
47 eval SELECT NAME, POS, MTYPE, PRTYPE, HAS_DEFAULT,
48 VERSION_ADDED, VERSION_DROPPED
49 FROM INFORMATION_SCHEMA.INNODB_COLUMNS
50 WHERE TABLE_ID=$table_id;
51 }
52
53 if (!$is_debug)
54 {
55 --echo # Metadata from INFORMATION_SCHEMA.TABLES
56 eval SELECT NAME, N_COLS, INSTANT_COLS, TOTAL_ROW_VERSIONS
57 FROM INFORMATION_SCHEMA.INNODB_TABLES
58 WHERE TABLE_ID=$table_id;
59
60 --echo # Metadata from INFORMATION_SCHEMA.COLUMNS
61 eval SELECT NAME, POS, MTYPE, PRTYPE, HAS_DEFAULT
62 FROM INFORMATION_SCHEMA.INNODB_COLUMNS
63 WHERE TABLE_ID=$table_id;
64 }
65
66 inc $part_no;
67 }
68 --enable_query_log