File: metadata_sync_pfs.test

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 (130 lines) | stat: -rw-r--r-- 3,513 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
--source connect.inc
--source include/have_debug.inc
--source suite/ndb/include/backup_restore_setup.inc

#
# This test focuses on the metadata sync related performance schema
# tables: ndb_sync_pending_objects and ndb_sync_excluded_objects
#

# Create metadata
CREATE LOGFILE GROUP lg1
  ADD UNDOFILE 'lg1_undofile.dat'
  INITIAL_SIZE 1M
  UNDO_BUFFER_SIZE = 1M
  ENGINE NDB;

CREATE TABLESPACE ts1
  ADD DATAFILE 'ts1_datafile.dat'
  USE LOGFILE GROUP lg1
  INITIAL_SIZE 2M
  ENGINE NDB;

CREATE TABLE t1 (
  a INT PRIMARY KEY,
  b INT
) ENGINE NDB
  TABLESPACE ts1
  STORAGE DISK;

CREATE TABLE t2 (
  a INT PRIMARY KEY,
  b VARCHAR(255)
) ENGINE NDB;

CREATE TABLE t3 (
  a INT PRIMARY KEY,
  b VARCHAR(255)
) ENGINE NDB;

CREATE DATABASE db1;
CREATE TABLE db1.t1 (
  a INT PRIMARY KEY,
  b VARCHAR(255)
) ENGINE NDB;

--echo Backup
--disable_query_log
--source include/ndb_backup.inc
--enable_query_log

# Drop metadata
DROP TABLE t1,t2,t3;
DROP DATABASE db1;
ALTER TABLESPACE ts1
  DROP DATAFILE 'ts1_datafile.dat';
DROP TABLESPACE ts1;
DROP LOGFILE GROUP lg1
  ENGINE NDB;

--echo Restore backup into NDB Dictionary
--exec $NDB_RESTORE -b $the_backup_id -n 1 -m $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT

# Store initial counts of both detected and synchronized objects
--let $initial_detected_count = query_get_value(SHOW STATUS LIKE 'Ndb_metadata_detected_count', Value, 1)
--let $initial_synced_count = query_get_value(SHOW STATUS LIKE 'Ndb_metadata_synced_count', Value, 1)

--disable_query_log
# Skip synchronization of detected objects to obtain deterministic results
# in the ndb_sync_pending_objects table
SET GLOBAL debug = '+d,skip_ndb_metadata_sync';
# Enable metadata check with no interval so changes are detected quickly
SET @old_ndb_metadata_check = @@global.ndb_metadata_check;
SET @old_ndb_metadata_check_interval = @@global.ndb_metadata_check_interval;
SET GLOBAL ndb_metadata_check_interval = 0;
SET GLOBAL ndb_metadata_check = true;
--enable_query_log

--echo Wait until the following 6 object changes are detected:
--echo - Logfile group 'lg1'
--echo - Tablespace 'ts1'
--echo - Schema 'db1'
--echo - Table 'test.t1'
--echo - Table 'test.t2'
--echo - Table 'test.t3'
--let $expected_changes = 6
--let $max_wait = 60
--source wait_metadata_changes_detected.inc

--disable_query_log
# Reset values
SET GLOBAL ndb_metadata_check = @old_ndb_metadata_check;
SET GLOBAL ndb_metadata_check_interval = @old_ndb_metadata_check_interval;
--enable_query_log

--sorted_result
SELECT * FROM performance_schema.ndb_sync_pending_objects;

# Enable sync again with the injected failures resulting in the
# ndb_sync_excluded_objects table being populated
--disable_query_log
SET GLOBAL debug = '+d,ndb_metadata_sync_fail';
SET GLOBAL debug = '-d,skip_ndb_metadata_sync';
--enable_query_log

--echo Wait until the changes detected have been synced
--let $max_wait = 60
--source wait_metadata_synced.inc

# Verify that the objects have been excluded
--sorted_result
SELECT * FROM performance_schema.ndb_sync_excluded_objects;

# Remove injected failure
--disable_query_log ONCE
SET GLOBAL debug = '-d,ndb_metadata_sync_fail';

--echo Restart MySQL server to synchronize metadata
let $mysqld_name=mysqld.1.1;
--source include/restart_mysqld.inc

# Clean-up
DROP TABLE t1,t2,t3;
DROP DATABASE db1;
ALTER TABLESPACE ts1
  DROP DATAFILE 'ts1_datafile.dat';
DROP TABLESPACE ts1;
DROP LOGFILE GROUP lg1
  ENGINE NDB;
--source suite/ndb/include/backup_restore_cleanup.inc
--remove_file $NDB_TOOLS_OUTPUT