summaryrefslogtreecommitdiff
path: root/mysql-test/suite/s3
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2019-05-28 11:02:16 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2019-06-26 20:59:35 +0300
commit5c5ea59bf88bc7cd9774f48e847168b47de7b249 (patch)
tree0ce0105aad46c9c2e76d99cf29c9e4582474dedd /mysql-test/suite/s3
parent878ad986fdbe0ca455fa825c459f2fb62ffcfa52 (diff)
downloadmariadb-git-5c5ea59bf88bc7cd9774f48e847168b47de7b249.tar.gz
MDEV-19867: fix mysqldump to by default not copy S3 tables
There are two options when coping S3 tables with mysqldump (there is startup option --copy_s3_tables, boolean, default no) 1) Ignore all tables with engine S3, as the data is already safe in S3 and any computer where you restore the backup will automatically discover the S3 table. 2) Copy the table as a normal table with the following 2 changes: - Change ENGINE=S3 to ENGINE=ARIA; - After copy add to log 'ALTER TABLE table_name ENGINE=S3'
Diffstat (limited to 'mysql-test/suite/s3')
-rw-r--r--mysql-test/suite/s3/mysqldump.result60
-rw-r--r--mysql-test/suite/s3/mysqldump.test33
2 files changed, 93 insertions, 0 deletions
diff --git a/mysql-test/suite/s3/mysqldump.result b/mysql-test/suite/s3/mysqldump.result
new file mode 100644
index 00000000000..995cbf5bc63
--- /dev/null
+++ b/mysql-test/suite/s3/mysqldump.result
@@ -0,0 +1,60 @@
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+#####
+# mysqldump with --copy-s3-tables=0 (by default)
+###
+#####
+# mysqldump with --copy-s3-tables=0 (by default) XML
+###
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="database">
+</database>
+</mysqldump>
+#####
+# mysqldump with --copy-s3-tables=1
+###
+/*!40101 SET @saved_cs_client = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `t1` (
+ `pk` int(11) NOT NULL,
+ `a` int(11) DEFAULT NULL,
+ PRIMARY KEY (`pk`)
+) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+INSERT INTO `t1` VALUES (1,1),(2,2),(3,3),(4,4);
+ATER TABLE `t1` ENGINE=S3;
+#####
+# mysqldump with --copy-s3-tables=1 XML
+###
+<?xml version="1.0"?>
+<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+<database name="database">
+ <table_structure name="t1">
+ <field Field="pk" Type="int(11)" Null="NO" Key="PRI" Extra="" Comment="" />
+ <field Field="a" Type="int(11)" Null="YES" Key="" Default="NULL" Extra="" Comment="" />
+ <key Table="t1" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="pk" Collation="A" Cardinality="4" Null="" Index_type="BTREE" Comment="" Index_comment="" />
+ <options Name="t1" Engine="Aria" Version="10" Row_format="Page" Rows="4" Avg_row_length="4096" Data_length="16384" Max_data_length="17592186011648" Index_length="16384" Data_free="0" Create_time="--TIME--" Collation="latin1_swedish_ci" Create_options="" Comment="" Max_index_length="9007199254732800" Temporary="N" />
+ </table_structure>
+ <table_data name="t1">
+ <row>
+ <field name="pk">1</field>
+ <field name="a">1</field>
+ </row>
+ <row>
+ <field name="pk">2</field>
+ <field name="a">2</field>
+ </row>
+ <row>
+ <field name="pk">3</field>
+ <field name="a">3</field>
+ </row>
+ <row>
+ <field name="pk">4</field>
+ <field name="a">4</field>
+ </row>
+ </table_data>
+</database>
+</mysqldump>
+drop table t1;
diff --git a/mysql-test/suite/s3/mysqldump.test b/mysql-test/suite/s3/mysqldump.test
new file mode 100644
index 00000000000..83d2310d636
--- /dev/null
+++ b/mysql-test/suite/s3/mysqldump.test
@@ -0,0 +1,33 @@
+--source include/have_s3.inc
+--source create_database.inc
+
+create table t1 (pk int primary key, a int);
+insert into t1 values (1,1),(2,2),(3,3),(4,4);
+alter table t1 engine=S3;
+
+--echo #####
+--echo # mysqldump with --copy-s3-tables=0 (by default)
+--echo ###
+--exec $MYSQL_DUMP --compact $database
+--echo #####
+--echo # mysqldump with --copy-s3-tables=0 (by default) XML
+--echo ###
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
+--replace_result $database database
+--exec $MYSQL_DUMP --compact -X $database
+--echo #####
+--echo # mysqldump with --copy-s3-tables=1
+--echo ###
+--exec $MYSQL_DUMP --compact --copy-s3-tables=1 $database
+--echo #####
+--echo # mysqldump with --copy-s3-tables=1 XML
+--echo ###
+--replace_regex /[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}(.[0-9]{2})*/--TIME--/
+--replace_result $database database
+--exec $MYSQL_DUMP --compact --copy-s3-tables=1 -X $database
+
+drop table t1;
+#
+# clean up
+#
+--source drop_database.inc