Skip to content

Commit 99aa7b2

Browse files
committed
WL#8500 Adapt MySQL Cluster to 8.0
- add testcase to --suite=ndbcluster for testing basic tablespace functionality with NDB
1 parent 1c81b83 commit 99aa7b2

File tree

2 files changed

+103
-0
lines changed

2 files changed

+103
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
CREATE LOGFILE GROUP lg1
2+
ADD UNDOFILE 'lg1_undofile.dat'
3+
INITIAL_SIZE 1M
4+
UNDO_BUFFER_SIZE = 1M
5+
ENGINE=NDB;
6+
CREATE TABLESPACE ts1
7+
ADD DATAFILE 'ts1_datafile.dat'
8+
USE LOGFILE GROUP lg1
9+
INITIAL_SIZE 1M
10+
ENGINE NDB;
11+
CREATE TABLE t1 (
12+
a int PRIMARY KEY,
13+
b varchar(255)
14+
) ENGINE = NDB
15+
TABLESPACE ts1
16+
STORAGE DISK;
17+
INSERT INTO t1 VALUES (1, "MySQL Server with NDB");
18+
SELECT * FROM t1 WHERE a = 1;
19+
a b
20+
1 MySQL Server with NDB
21+
UPDATE t1 SET b = CONCAT(b, " test") WHERE a = 1;
22+
SELECT * FROM t1 WHERE a = 1;
23+
a b
24+
1 MySQL Server with NDB test
25+
REPLACE t1 (a, b) VALUES (12, "Another layer");
26+
SELECT * FROM t1 WHERE a = 12 ORDER BY a;
27+
a b
28+
12 Another layer
29+
DELETE FROM t1 WHERE a = 11;
30+
SELECT COUNT(*) FROM t1;
31+
COUNT(*)
32+
2
33+
SELECT b FROM t1 WHERE b LIKE "MySQL%";
34+
b
35+
MySQL Server with NDB test
36+
DELETE FROM t1 ORDER BY b DESC;
37+
DROP TABLE t1;
38+
ALTER TABLESPACE ts1
39+
DROP DATAFILE 'ts1_datafile.dat'
40+
ENGINE=NDB;
41+
DROP TABLESPACE ts1
42+
ENGINE=NDB;
43+
DROP LOGFILE GROUP lg1
44+
ENGINE=NDB;
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
--source include/have_ndb.inc
2+
3+
# Create logfile group
4+
CREATE LOGFILE GROUP lg1
5+
ADD UNDOFILE 'lg1_undofile.dat'
6+
INITIAL_SIZE 1M
7+
UNDO_BUFFER_SIZE = 1M
8+
ENGINE=NDB;
9+
10+
# Create tablespace using the logfile group
11+
CREATE TABLESPACE ts1
12+
ADD DATAFILE 'ts1_datafile.dat'
13+
USE LOGFILE GROUP lg1
14+
INITIAL_SIZE 1M
15+
ENGINE NDB;
16+
17+
# Create table in the tablespace
18+
CREATE TABLE t1 (
19+
a int PRIMARY KEY,
20+
b varchar(255)
21+
) ENGINE = NDB
22+
TABLESPACE ts1
23+
STORAGE DISK;
24+
25+
INSERT INTO t1 VALUES (1, "MySQL Server with NDB");
26+
SELECT * FROM t1 WHERE a = 1;
27+
UPDATE t1 SET b = CONCAT(b, " test") WHERE a = 1;
28+
SELECT * FROM t1 WHERE a = 1;
29+
REPLACE t1 (a, b) VALUES (12, "Another layer");
30+
SELECT * FROM t1 WHERE a = 12 ORDER BY a;
31+
DELETE FROM t1 WHERE a = 11;
32+
SELECT COUNT(*) FROM t1;
33+
SELECT b FROM t1 WHERE b LIKE "MySQL%";
34+
DELETE FROM t1 ORDER BY b DESC;
35+
36+
DROP TABLE t1;
37+
38+
# BUG#NNN
39+
# Can't drop tablespace here, it seems like NDB does not allow
40+
# dropping a tablespace with datafiles.
41+
#
42+
# Trying to workaround by dropping the datafile first does not
43+
# work either since MySQL Server refuses to drop tablesapce without
44+
# datafiles
45+
#
46+
ALTER TABLESPACE ts1
47+
DROP DATAFILE 'ts1_datafile.dat'
48+
ENGINE=NDB;
49+
50+
DROP TABLESPACE ts1
51+
ENGINE=NDB;
52+
53+
# Finally dropping the logfile group does not work since
54+
# it still contains tablespaces, this is expected
55+
DROP LOGFILE GROUP lg1
56+
ENGINE=NDB;
57+
58+
# Improper cleanup from testcase, need full restart
59+
--source include/force_restart.inc

0 commit comments

Comments
 (0)