Skip to content

Commit 598d1c8

Browse files
arnabray21dahlerlend
authored andcommitted
Bug#31341888 RECURRING TEMPORARY ERRORS STALL NDB METADATA SYNC
Post push fix: Stabilize a test by making the detection + sync deterministic Change-Id: I87d1393c04e5508d2c516d102458db754d45a2f9
1 parent 6eec94f commit 598d1c8

File tree

2 files changed

+23
-49
lines changed

2 files changed

+23
-49
lines changed

mysql-test/suite/ndb_ddl/metadata_sync_restore_disable_index.result

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@ UNIQUE ib(b),
66
INDEX ic(c)
77
) ENGINE NDB;
88
INSERT INTO t1 VALUES (1,2,3),(2,3,5),(3,4,6),(4,5,8),(5,6,2),(6,7,2);
9-
CREATE TABLE t2 (
10-
a INT,
11-
b VARCHAR(10)
12-
) ENGINE NDB;
13-
INSERT INTO t2 VALUES (1,'Number 4'),(2,'Privet'),(3,'Drive');
149
CREATE TABLE parent (
1510
c1 INT PRIMARY KEY
1611
) ENGINE NDB;
@@ -24,27 +19,18 @@ REFERENCES parent(c1)
2419
ON DELETE CASCADE
2520
) ENGINE NDB;
2621
INSERT INTO child VALUES (1,1),(2,2);
27-
DROP TABLE t1,t2,child,parent;
22+
DROP TABLE t1,child,parent;
23+
Restore with --disable-indexes
24+
include/assert.inc [Synced count has remained unchanged]
2825
SHOW TABLES;
2926
Tables_in_test
30-
t2
31-
SHOW CREATE TABLE t2;
32-
Table Create Table
33-
t2 CREATE TABLE `t2` (
34-
`a` int DEFAULT NULL,
35-
`b` varchar(10) DEFAULT NULL
36-
) ENGINE=ndbcluster DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
37-
SELECT * FROM t2;
38-
a b
39-
1 Number 4
40-
2 Privet
41-
3 Drive
27+
Rebuild indexes in NDB
28+
Wait until the objects are synced
4229
SHOW TABLES;
4330
Tables_in_test
4431
child
4532
parent
4633
t1
47-
t2
4834
SHOW CREATE TABLE t1;
4935
Table Create Table
5036
t1 CREATE TABLE `t1` (
@@ -86,4 +72,4 @@ SELECT * FROM child;
8672
c1 c2
8773
1 1
8874
2 2
89-
DROP TABLE t1,t2,child,parent;
75+
DROP TABLE t1,child,parent;

mysql-test/suite/ndb_ddl/metadata_sync_restore_disable_index.test

Lines changed: 17 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,6 @@ CREATE TABLE t1 (
2020

2121
INSERT INTO t1 VALUES (1,2,3),(2,3,5),(3,4,6),(4,5,8),(5,6,2),(6,7,2);
2222

23-
CREATE TABLE t2 (
24-
a INT,
25-
b VARCHAR(10)
26-
) ENGINE NDB;
27-
28-
INSERT INTO t2 VALUES (1,'Number 4'),(2,'Privet'),(3,'Drive');
29-
3023
CREATE TABLE parent (
3124
c1 INT PRIMARY KEY
3225
) ENGINE NDB;
@@ -47,13 +40,13 @@ INSERT INTO child VALUES (1,1),(2,2);
4740
# Take a backup
4841
--source include/ndb_backup.inc
4942

50-
DROP TABLE t1,t2,child,parent;
43+
DROP TABLE t1,child,parent;
5144

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

56-
# Restore metadata and data but do not rebuild indexes
49+
--echo Restore with --disable-indexes
5750
--exec $NDB_RESTORE -b $the_backup_id -n 1 -m -r --disable-indexes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
5851
--exec $NDB_RESTORE -b $the_backup_id -n 2 -r $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
5952

@@ -62,15 +55,14 @@ DROP TABLE t1,t2,child,parent;
6255
SET @old_ndb_metadata_check = @@global.ndb_metadata_check;
6356
SET @old_ndb_metadata_check_interval = @@global.ndb_metadata_check_interval;
6457
SET GLOBAL ndb_metadata_check = true;
65-
SET GLOBAL ndb_metadata_check_interval = 0;
58+
SET GLOBAL ndb_metadata_check_interval = 5;
6659
--enable_query_log
6760

68-
# Wait until the following 4 object changes are detected:
61+
# Wait until the following 3 object changes are detected:
6962
# Table 'test.t1'
70-
# Table 'test.t2'
7163
# Table 'test.child'
7264
# Table 'test.parent'
73-
--let $expected_changes = 4
65+
--let $expected_changes = 3
7466
--let $max_wait = 30
7567
--source wait_metadata_changes_detected.inc
7668

@@ -80,29 +72,25 @@ SET GLOBAL ndb_metadata_check = @old_ndb_metadata_check;
8072
SET GLOBAL ndb_metadata_check_interval = @old_ndb_metadata_check_interval;
8173
--enable_query_log
8274

83-
# Wait until table t2 is synced since it contains no indexes.
84-
# The remaining tables aren't synced but treated as temporary errors
85-
# instead
86-
--let $expected_changes = 1
87-
--let $max_wait = 30
88-
--source wait_metadata_synced.inc
89-
75+
# Check that no tables have been synced. The tables aren't
76+
# synced due to the missing indexes and are treated as
77+
# temporary failures
78+
--let $synced_count = query_get_value(SHOW STATUS LIKE 'Ndb_metadata_synced_count', Value, 1)
79+
--let $assert_cond = "$synced_count" = "$initial_synced_count"
80+
--let $assert_text = Synced count has remained unchanged
81+
--source include/assert.inc
9082
SHOW TABLES;
91-
SHOW CREATE TABLE t2;
92-
--sorted_result
93-
SELECT * FROM t2;
9483

95-
# Refresh counts
84+
# Refresh count
9685
--let $initial_detected_count = query_get_value(SHOW STATUS LIKE 'Ndb_metadata_detected_count', Value, 1)
97-
--let $initial_synced_count = query_get_value(SHOW STATUS LIKE 'Ndb_metadata_synced_count', Value, 1)
9886

99-
# Rebuild indexes in NDB
87+
--echo Rebuild indexes in NDB
10088
--exec $NDB_RESTORE -b $the_backup_id -n 1 --rebuild-indexes $NDB_BACKUPS-$the_backup_id >> $NDB_TOOLS_OUTPUT
10189

10290
--disable_query_log
10391
# Set low interval so changes are detected quickly
10492
SET GLOBAL ndb_metadata_check = true;
105-
SET GLOBAL ndb_metadata_check_interval = 0;
93+
SET GLOBAL ndb_metadata_check_interval = 5;
10694
--enable_query_log
10795

10896
# Wait until the following 3 object changes are detected:
@@ -119,7 +107,7 @@ SET GLOBAL ndb_metadata_check = @old_ndb_metadata_check;
119107
SET GLOBAL ndb_metadata_check_interval = @old_ndb_metadata_check_interval;
120108
--enable_query_log
121109

122-
# Wait until the objects are synced
110+
--echo Wait until the objects are synced
123111
--let $max_wait = 30
124112
--source wait_metadata_synced.inc
125113

@@ -135,7 +123,7 @@ SHOW CREATE TABLE child;
135123
--sorted_result
136124
SELECT * FROM child;
137125

138-
DROP TABLE t1,t2,child,parent;
126+
DROP TABLE t1,child,parent;
139127

140128
--source suite/ndb/include/backup_restore_cleanup.inc
141129
--remove_file $NDB_TOOLS_OUTPUT

0 commit comments

Comments
 (0)