summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-07-18 16:51:16 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-07-18 17:41:35 +0300
commitf616e2b97fec3a8105c70cd72e80d6ef57f460c7 (patch)
tree0dfd285a64587719c092f6548caafbcd81976f18
parenteb14806e6c36c126b0e73f5d4d473f6010b05af7 (diff)
downloadmariadb-git-f616e2b97fec3a8105c70cd72e80d6ef57f460c7.tar.gz
MDEV-13625: Add innodb.check_ibd_filesize
-rw-r--r--mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff25
-rw-r--r--mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff25
-rw-r--r--mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff25
-rw-r--r--mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff25
-rw-r--r--mysql-test/suite/innodb/r/check_ibd_filesize.result20
-rw-r--r--mysql-test/suite/innodb/t/check_ibd_filesize.test53
6 files changed, 173 insertions, 0 deletions
diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff
new file mode 100644
index 00000000000..d6828e88256
--- /dev/null
+++ b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff
@@ -0,0 +1,25 @@
+--- check_ibd_filesize.result
++++ check_ibd_filesize.result,32k
+@@ -3,18 +3,12 @@
+ # SPACE IN 5.7 THAN IN 5.6
+ #
+ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 196608
+ INSERT INTO t1 SELECT * FROM seq_1_to_25000;
+-# bytes: 9437184
++# bytes: 786432
+ DROP TABLE t1;
+ CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 196608
+ INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+-# bytes: 2097152
+-DROP TABLE t1;
+-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
+-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+-# bytes: 65536
+-INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+-# bytes: 65536
++# bytes: 786432
+ DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff
new file mode 100644
index 00000000000..0aeb3ebcaee
--- /dev/null
+++ b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff
@@ -0,0 +1,25 @@
+--- check_ibd_filesize.result
++++ check_ibd_filesize.result,4k
+@@ -3,18 +3,18 @@
+ # SPACE IN 5.7 THAN IN 5.6
+ #
+ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 24576
+ INSERT INTO t1 SELECT * FROM seq_1_to_25000;
+ # bytes: 9437184
+ DROP TABLE t1;
+ CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 24576
+ INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+ # bytes: 2097152
+ DROP TABLE t1;
+ CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
+ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+-# bytes: 65536
++# bytes: 16384
+ INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+-# bytes: 65536
++# bytes: 25600
+ DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff
new file mode 100644
index 00000000000..410707991d1
--- /dev/null
+++ b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff
@@ -0,0 +1,25 @@
+--- check_ibd_filesize.result
++++ check_ibd_filesize.result,64k
+@@ -3,18 +3,12 @@
+ # SPACE IN 5.7 THAN IN 5.6
+ #
+ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 393216
+ INSERT INTO t1 SELECT * FROM seq_1_to_25000;
+-# bytes: 9437184
++# bytes: 983040
+ DROP TABLE t1;
+ CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 393216
+ INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+-# bytes: 2097152
+-DROP TABLE t1;
+-CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
+-ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+-# bytes: 65536
+-INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+-# bytes: 65536
++# bytes: 1572864
+ DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff
new file mode 100644
index 00000000000..f1d79846c2a
--- /dev/null
+++ b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff
@@ -0,0 +1,25 @@
+--- check_ibd_filesize.result
++++ check_ibd_filesize.result,8k
+@@ -3,18 +3,18 @@
+ # SPACE IN 5.7 THAN IN 5.6
+ #
+ CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 49152
+ INSERT INTO t1 SELECT * FROM seq_1_to_25000;
+ # bytes: 9437184
+ DROP TABLE t1;
+ CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
+-# bytes: 98304
++# bytes: 49152
+ INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+ # bytes: 2097152
+ DROP TABLE t1;
+ CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
+ ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+-# bytes: 65536
++# bytes: 32768
+ INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+-# bytes: 65536
++# bytes: 32768
+ DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize.result b/mysql-test/suite/innodb/r/check_ibd_filesize.result
new file mode 100644
index 00000000000..9465c3a3115
--- /dev/null
+++ b/mysql-test/suite/innodb/r/check_ibd_filesize.result
@@ -0,0 +1,20 @@
+#
+# Bug #21950389 SMALL TABLESPACES WITH BLOBS TAKE UP TO 80 TIMES MORE
+# SPACE IN 5.7 THAN IN 5.6
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+# bytes: 98304
+INSERT INTO t1 SELECT * FROM seq_1_to_25000;
+# bytes: 9437184
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
+# bytes: 98304
+INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+# bytes: 2097152
+DROP TABLE t1;
+CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
+ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+# bytes: 65536
+INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+# bytes: 65536
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/check_ibd_filesize.test b/mysql-test/suite/innodb/t/check_ibd_filesize.test
new file mode 100644
index 00000000000..92f9061a3f6
--- /dev/null
+++ b/mysql-test/suite/innodb/t/check_ibd_filesize.test
@@ -0,0 +1,53 @@
+--source include/innodb_page_size.inc
+--source include/have_sequence.inc
+
+--echo #
+--echo # Bug #21950389 SMALL TABLESPACES WITH BLOBS TAKE UP TO 80 TIMES MORE
+--echo # SPACE IN 5.7 THAN IN 5.6
+--echo #
+
+#
+# Table 1: small rows
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+let MYSQLD_DATADIR=`select @@datadir`;
+perl;
+print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
+EOF
+
+INSERT INTO t1 SELECT * FROM seq_1_to_25000;
+perl;
+print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
+EOF
+DROP TABLE t1;
+
+#
+# Table 2: BLOB
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB;
+perl;
+print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
+EOF
+INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+perl;
+print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
+EOF
+DROP TABLE t1;
+
+let $page_size=`SELECT @@innodb_page_size`;
+if ($page_size < 32768)
+{
+#
+# Table 3: compressed BLOB
+#
+CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB)
+ENGINE=InnoDB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=1;
+perl;
+print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
+EOF
+INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20;
+perl;
+print "# bytes: ", (-s "$ENV{MYSQLD_DATADIR}/test/t1.ibd"), "\n";
+EOF
+DROP TABLE t1;
+}