Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
23422c45
Commit
23422c45
authored
Feb 21, 2023
by
Yuchen Pei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adding testcase
parent
15ec36a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
113 additions
and
0 deletions
+113
-0
mysql-test/suite/innodb/r/import.result
mysql-test/suite/innodb/r/import.result
+47
-0
mysql-test/suite/innodb/t/import.test
mysql-test/suite/innodb/t/import.test
+66
-0
No files found.
mysql-test/suite/innodb/r/import.result
0 → 100644
View file @
23422c45
CREATE TABLE t1 (a int) ENGINE=InnoDB;
INSERT INTO t1 VALUES(42);
CREATE TABLE t2 LIKE t1;
ALTER TABLE t2 DISCARD TABLESPACE;
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;
SELECT * from t2;
a
42
DROP TABLE t1, t2;
#
# MDEV-26137 ALTER TABLE IMPORT enhancement
#
CREATE TABLE t1 (a int) ENGINE=InnoDB;
INSERT INTO t1 VALUES(42);
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
ALTER TABLE t2 IMPORT TABLESPACE;
SELECT * FROM t2;
a
42
DROP TABLE t1, t2;
CREATE TABLE t1 (a int) ENGINE=InnoDB;
INSERT INTO t1 VALUES(42);
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE t1;
ALTER TABLE t2 IMPORT TABLESPACE;
SELECT * FROM t2;
a
42
DROP TABLE t2;
CREATE TABLE t1 (a int) ENGINE=InnoDB;
INSERT INTO t1 VALUES(42);
CREATE TABLE t2 LIKE t1;
FLUSH TABLES t1 FOR EXPORT;
UNLOCK TABLES;
DROP TABLE t1;
call mtr.add_suppression("InnoDB: Unable to import tablespace");
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR HY000: Tablespace for table 'test/t2' exists. Please DISCARD the tablespace before IMPORT
SELECT * FROM t2;
a
DROP TABLE t2;
ALTER TABLE t2 IMPORT TABLESPACE;
ERROR 42S02: Table 'test.t2' doesn't exist
mysql-test/suite/innodb/t/import.test
0 → 100644
View file @
23422c45
--
source
include
/
have_innodb
.
inc
let
$MYSQLD_DATADIR
=
`SELECT @@datadir`
;
# existing workflow
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
42
);
CREATE
TABLE
t2
LIKE
t1
;
ALTER
TABLE
t2
DISCARD
TABLESPACE
;
FLUSH
TABLES
t1
FOR
EXPORT
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
UNLOCK
TABLES
;
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
SELECT
*
from
t2
;
DROP
TABLE
t1
,
t2
;
--
echo
#
--
echo
# MDEV-26137 ALTER TABLE IMPORT enhancement
--
echo
#
# enhanced workflow
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
42
);
FLUSH
TABLES
t1
FOR
EXPORT
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
$MYSQLD_DATADIR
/
test
/
t2
.
frm
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
UNLOCK
TABLES
;
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
SELECT
*
FROM
t2
;
DROP
TABLE
t1
,
t2
;
# a variant of the previous case, but we drop t1 before importing t2
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
42
);
FLUSH
TABLES
t1
FOR
EXPORT
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
$MYSQLD_DATADIR
/
test
/
t2
.
frm
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
UNLOCK
TABLES
;
DROP
TABLE
t1
;
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
# created t2 but did not discard tablespace
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
InnoDB
;
INSERT
INTO
t1
VALUES
(
42
);
CREATE
TABLE
t2
LIKE
t1
;
FLUSH
TABLES
t1
FOR
EXPORT
;
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
cfg
$MYSQLD_DATADIR
/
test
/
t2
.
cfg
--
error
1
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
frm
$MYSQLD_DATADIR
/
test
/
t2
.
frm
--
error
1
--
copy_file
$MYSQLD_DATADIR
/
test
/
t1
.
ibd
$MYSQLD_DATADIR
/
test
/
t2
.
ibd
UNLOCK
TABLES
;
DROP
TABLE
t1
;
call
mtr
.
add_suppression
(
"InnoDB: Unable to import tablespace"
);
--
error
ER_TABLESPACE_EXISTS
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
SELECT
*
FROM
t2
;
DROP
TABLE
t2
;
# attempt to import when there's no tablespace
--
error
ER_NO_SUCH_TABLE
ALTER
TABLE
t2
IMPORT
TABLESPACE
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment