File: dist_priv_migration.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 (127 lines) | stat: -rw-r--r-- 3,927 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
--source include/have_debug.inc
--source connect.inc

--echo *** TEST CASE 1 ***
--echo *** Positive test that a table named mtr__acl_test_table exhibits
--echo *** the special behavior used for upgrading ACL tables into 8.0

--connection mysqld1
--echo At MySQL Server 1
# This test relies on a special hard-coded table name mysql.mtr__acl_test_table
USE mysql;
CREATE TABLE mtr__acl_test_table (i int not null primary key, j int)
  ENGINE=ndb;

# Supress errors provoked by the "shadow table" on first mysqld
--disable_query_log
call mtr.add_suppression("Local table 'mysql.mtr__acl_test_table' .* shadows");
call mtr.add_suppression("Failed to remove table definition");
--enable_query_log

# Populate the table with some data
INSERT INTO mtr__acl_test_table values(1,2);
INSERT INTO mtr__acl_test_table values(2,3);
INSERT INTO mtr__acl_test_table values(3,4);

# Test the "NDB to InnoDB" upgrade migration of WL#12711
#
# On one server, migrate the table to InnoDB
ALTER TABLE mtr__acl_test_table ENGINE=InnoDB;

# The data still exists
SELECT * FROM mtr__acl_test_table ORDER BY i;

# The table is in InnoDB
SELECT engine FROM INFORMATION_SCHEMA.TABLES
  WHERE table_name='mtr__acl_test_table';

# From a different MySQL server, we see the server still existing in NDB
--connection mysqld2
--echo At MySQL Server 2

USE mysql;
SELECT engine FROM INFORMATION_SCHEMA.TABLES
  WHERE table_name='mtr__acl_test_table';

# And the original data remains
SELECT * FROM mtr__acl_test_table ORDER BY i;

# Add a record:
INSERT INTO mtr__acl_test_table values(4,5);

# From mysqld1 where the table is in InnoDB the new record does not appear
--connection mysqld1
--echo At MySQL Server 1
SELECT * FROM mtr__acl_test_table ORDER BY i;

--connection mysqld3
--echo At MySQL Server 3 also migrate the table to InnoDB
SELECT engine FROM INFORMATION_SCHEMA.TABLES
  WHERE table_name='mtr__acl_test_table';
ALTER TABLE mysql.mtr__acl_test_table ENGINE=InnoDB;

# Supress errors provoked by the "shadow table" on third mysqld
--disable_query_log
call mtr.add_suppression("Local table 'mysql.mtr__acl_test_table' .* shadows");
call mtr.add_suppression("Failed to remove table definition");
--enable_query_log

--connection mysqld2
--echo At MySQL Server 2, DROP the NDB table:

# This will not drop the shadow tables in both mysqld1 and mysqld3
--replace_regex /Node [0-9]+:/Node <nodeid>/
DROP TABLE mysql.mtr__acl_test_table;

--connection mysqld4
--echo At MySQL Server 4, Confirm that the NDB table has been dropped
SELECT engine FROM INFORMATION_SCHEMA.TABLES
  WHERE table_name='mtr__acl_test_table';

# Back at mysqld1 the InnoDB table still exists
--connection mysqld1
--echo At MySQL Server 1
SELECT COUNT(*) FROM mtr__acl_test_table;

# Finally drop the InnoDB table
DROP TABLE mtr__acl_test_table;

--connection mysqld3
--echo At MySQL Server 3 Drop the local InnoDB table
DROP TABLE mysql.mtr__acl_test_table;


--echo *** TEST CASE 2 ***
--echo *** Negative test that a table *not* named mtr__acl_test_table
--echo *** does not exhibit the special behavior

--connection mysqld1

CREATE TABLE mtr__acl_test_table_2 (i int not null primary key, j int)
  ENGINE=ndb;

# Populate the table with some data
INSERT INTO mtr__acl_test_table_2 values(1,2);
INSERT INTO mtr__acl_test_table_2 values(2,3);
INSERT INTO mtr__acl_test_table_2 values(3,4);

# This ALTER TABLE changes the table to a *local* InnoDB table.
# It will be dropped from NDB
ALTER TABLE mtr__acl_test_table_2 ENGINE=InnoDB;

SELECT * FROM mtr__acl_test_table_2 ORDER BY i;

# The table is in InnoDB
SELECT engine FROM INFORMATION_SCHEMA.TABLES
  WHERE table_name='mtr__acl_test_table_2';

--connection mysqld2
--echo At MySQL 2 we expect the table does not exist
SELECT count(*) FROM INFORMATION_SCHEMA.TABLES
  WHERE table_name='mtr__acl_test_table_2';

--connection mysqld1
--echo Back at mysqld1 drop the negative test table
DROP TABLE mtr__acl_test_table_2;