summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-12-11 15:06:11 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-12-11 15:06:11 +0200
commite312a407b888b3107bc7a2ca3303b588ab4560c0 (patch)
treeabeb585eec0dfec5c5e37b9efe9f2c10037c8906
parent927dd9f355c742ce896983969b82cb3198c250ff (diff)
parent13b9ec651a807be59139fc295431d7ad14d3c8db (diff)
downloadmariadb-git-e312a407b888b3107bc7a2ca3303b588ab4560c0.tar.gz
Merge 10.2 into bb-10.2-ext
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result38
-rw-r--r--mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result38
-rw-r--r--mysql-test/suite/innodb/r/lock_deleted.result57
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_32k.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test41
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_64k.opt3
-rw-r--r--mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test41
-rw-r--r--mysql-test/suite/innodb/t/lock_deleted.test72
-rw-r--r--sql/sql_show.cc51
-rw-r--r--storage/innobase/btr/btr0defragment.cc1
-rw-r--r--storage/innobase/dict/dict0defrag_bg.cc7
-rw-r--r--storage/innobase/dict/dict0load.cc3
-rw-r--r--storage/innobase/dict/dict0stats.cc4
-rw-r--r--storage/innobase/dict/dict0stats_bg.cc1
-rw-r--r--storage/innobase/handler/ha_innodb.cc3
-rw-r--r--storage/innobase/handler/handler0alter.cc1
-rw-r--r--storage/innobase/include/dict0load.h3
-rw-r--r--storage/innobase/include/row0vers.h20
-rw-r--r--storage/innobase/row/row0mysql.cc46
-rw-r--r--storage/innobase/row/row0sel.cc51
-rw-r--r--storage/innobase/row/row0vers.cc49
-rw-r--r--storage/innobase/srv/srv0srv.cc64
-rw-r--r--storage/rocksdb/ha_rocksdb.cc12
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/mariadb_ignore_dirs.result9
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/suite.opt2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/bulk_load.inc2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/compact_deletes_test.inc2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/drop_table2.test4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/mariadb_ignore_dirs.test17
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/optimize_table.inc2
-rwxr-xr-xstorage/rocksdb/mysql-test/rocksdb_hotbackup/include/stream_run.sh4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_gtid_crash_safe_wal_corrupt.inc4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_datadir_basic.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb_sys_vars/suite.opt2
-rw-r--r--storage/rocksdb/mysql-test/storage_engine/cleanup_engine.inc4
-rw-r--r--storage/rocksdb/mysql-test/storage_engine/parts/suite.opt2
-rw-r--r--storage/rocksdb/mysql-test/storage_engine/suite.opt2
-rw-r--r--storage/rocksdb/mysql-test/storage_engine/trx/suite.opt2
39 files changed, 364 insertions, 307 deletions
diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
index 0c06ad24a49..117b7e4418e 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result
@@ -2,18 +2,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
SELECT @@innodb_page_size;
@@innodb_page_size
32768
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-SET @@innodb_strict_mode=ON;
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SELECT @@innodb_strict_mode;
-@@innodb_strict_mode
-1
+SET innodb_strict_mode=ON;
CREATE TABLE tab5(col1 CHAR (255), col2 CHAR (255), col3 CHAR(255),col4 CHAR(255), col5 CHAR(255),
col6 CHAR(255), col7 CHAR(255), col8 CHAR(255), col9 CHAR(255),col10 CHAR(255), col11 CHAR(255),
col12 CHAR(255), col13 CHAR(255),col14 CHAR(255),col15 CHAR(255),col16 CHAR(255), col17 CHAR(255),
@@ -337,11 +326,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-stat_value
-6
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
-clustered_index_size
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
+clust_index_size
7
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@@ -359,11 +346,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-stat_value
-4
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
-clustered_index_size
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
+clust_index_size
5
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@@ -381,11 +366,8 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-stat_value
-4
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
-clustered_index_size
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
+clust_index_size
5
DROP TABLE t;
-# Success
diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
index f9751f02d43..de957023ff8 100644
--- a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
+++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result
@@ -2,18 +2,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
SELECT @@innodb_page_size;
@@innodb_page_size
65536
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-SET @@innodb_strict_mode=ON;
-SELECT @@innodb_file_format;
-@@innodb_file_format
-Barracuda
-SELECT @@innodb_file_per_table;
-@@innodb_file_per_table
-1
-SELECT @@innodb_strict_mode;
-@@innodb_strict_mode
-1
+SET innodb_strict_mode=ON;
CREATE TABLE tab5(col1 CHAR (255), col2 CHAR (255), col3 CHAR(255),col4 CHAR(255), col5 CHAR(255),
col6 CHAR(255), col7 CHAR(255), col8 CHAR(255), col9 CHAR(255),col10 CHAR(255), col11 CHAR(255),
col12 CHAR(255), col13 CHAR(255),col14 CHAR(255),col15 CHAR(255),col16 CHAR(255), col17 CHAR(255),
@@ -540,11 +529,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-stat_value
-4
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
-clustered_index_size
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
+clust_index_size
5
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@@ -562,11 +549,9 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-stat_value
-3
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
-clustered_index_size
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
+clust_index_size
4
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@@ -584,11 +569,8 @@ FLUSH TABLE t;
ANALYZE TABLE t;
Table Op Msg_type Msg_text
test.t analyze status OK
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-stat_value
-3
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
-clustered_index_size
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
+clust_index_size
4
DROP TABLE t;
-# Success
diff --git a/mysql-test/suite/innodb/r/lock_deleted.result b/mysql-test/suite/innodb/r/lock_deleted.result
new file mode 100644
index 00000000000..0fcb8bd5aa8
--- /dev/null
+++ b/mysql-test/suite/innodb/r/lock_deleted.result
@@ -0,0 +1,57 @@
+connect stop_purge, localhost, root,,;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connect delete, localhost, root,,;
+connection default;
+CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1,1);
+DELETE FROM t1;
+SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
+BEGIN;
+INSERT INTO t1 VALUES(1,1);
+connection delete;
+SET DEBUG_SYNC='now WAIT_FOR inserted';
+SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
+SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
+BEGIN;
+DELETE FROM t1 WHERE b=1;
+connection default;
+connection delete;
+COMMIT;
+connection default;
+SET DEBUG_SYNC='RESET';
+ROLLBACK;
+SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
+BEGIN;
+INSERT INTO t1 VALUES(1,1);
+connection delete;
+SET DEBUG_SYNC='now WAIT_FOR inserted';
+SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
+SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
+BEGIN;
+DELETE FROM t1 WHERE b=1;
+connection default;
+connection delete;
+COMMIT;
+connection default;
+SET DEBUG_SYNC='RESET';
+ROLLBACK;
+SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
+BEGIN;
+SET innodb_lock_wait_timeout=1;
+INSERT INTO t1 VALUES(1,1);
+connection delete;
+SET DEBUG_SYNC='now WAIT_FOR inserted';
+SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
+DELETE FROM t1 WHERE b=1;
+connection default;
+ERROR HY000: Lock wait timeout exceeded; try restarting transaction
+COMMIT;
+SET DEBUG_SYNC='RESET';
+connection delete;
+COMMIT;
+disconnect delete;
+disconnect stop_purge;
+connection default;
+DROP TABLE t1;
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.opt b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.opt
index f543bd0da39..587a2d7e6c1 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.opt
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.opt
@@ -1,3 +1,4 @@
--innodb-page-size=32K
--innodb_buffer_pool_size=32M
---innodb-stats-persistent=ON
+--skip-innodb-stats-persistent
+--innodb-sys-tablestats
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
index 8549bbfdbef..aa816a9b0e8 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test
@@ -6,19 +6,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
# Check page size 32k
SELECT @@innodb_page_size;
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-let $innodb_strict_mode = `SELECT @@innodb_strict_mode`;
-
---disable_warnings
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-SET @@innodb_strict_mode=ON;
---enable_warnings
-
-SELECT @@innodb_file_format;
-SELECT @@innodb_file_per_table;
-SELECT @@innodb_strict_mode;
+SET innodb_strict_mode=ON;
# Check the error when the max record length > 16K for innodb_page_size=32k
--error ER_TOO_BIG_ROWSIZE
@@ -359,9 +347,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
-# retrieve the number of leaf pages
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@@ -372,9 +359,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
-# retrieve the number of leaf pages
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@@ -385,19 +371,6 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
-# retrieve the number of leaf pages
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
DROP TABLE t;
-
-# cleanup
---disable_query_log
---disable_warnings
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
-eval SET GLOBAL INNODB_STRICT_MODE=$innodb_strict_mode;
---enable_warnings
---enable_query_log
-
---echo # Success
-
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.opt b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.opt
index 8c9b8ae1e48..1a8442b841f 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.opt
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.opt
@@ -1,3 +1,4 @@
--innodb-page-size=64K
--innodb_buffer_pool_size=32M
---innodb-stats-persistent=ON
+--skip-innodb-stats-persistent
+--innodb-sys-tablestats
diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
index 0e6bc3bb04c..598cc3d77bf 100644
--- a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
+++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test
@@ -6,19 +6,7 @@ call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the
# Check page size 64k
SELECT @@innodb_page_size;
-let $innodb_file_per_table = `SELECT @@innodb_file_per_table`;
-let $innodb_file_format = `SELECT @@innodb_file_format`;
-let $innodb_strict_mode = `SELECT @@innodb_strict_mode`;
-
---disable_warnings
-SET GLOBAL innodb_file_format='Barracuda';
-SET GLOBAL innodb_file_per_table=ON;
-SET @@innodb_strict_mode=ON;
---enable_warnings
-
-SELECT @@innodb_file_format;
-SELECT @@innodb_file_per_table;
-SELECT @@innodb_strict_mode;
+SET innodb_strict_mode=ON;
# Check the error when the max record length > 32K for innodb_page_size=64k
--error ER_TOO_BIG_ROWSIZE
@@ -563,9 +551,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
-# retrieve the number of leaf pages
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
@@ -576,9 +563,8 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
-# retrieve the number of leaf pages
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
DROP TABLE t;
CREATE TABLE t(col BLOB) ENGINE=InnoDB ROW_FORMAT=COMPACT;
@@ -589,19 +575,6 @@ INSERT INTO t VALUES (REPEAT('a',65535));
SELECT LENGTH(col) FROM t;
FLUSH TABLE t;
ANALYZE TABLE t;
-# retrieve the number of leaf pages
-SELECT stat_value FROM mysql.innodb_index_stats where database_name = 'test' and table_name= 't' and stat_name='n_leaf_pages';
-SELECT clustered_index_size from mysql.innodb_table_stats where database_name = 'test' and table_name= 't';
+SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
+WHERE name = 'test/t';
DROP TABLE t;
-
-# cleanup
---disable_query_log
---disable_warnings
-eval SET GLOBAL INNODB_FILE_FORMAT=$innodb_file_format;
-eval SET GLOBAL INNODB_FILE_PER_TABLE=$innodb_file_per_table;
-eval SET GLOBAL INNODB_STRICT_MODE=$innodb_strict_mode;
---enable_warnings
---enable_query_log
-
---echo # Success
-
diff --git a/mysql-test/suite/innodb/t/lock_deleted.test b/mysql-test/suite/innodb/t/lock_deleted.test
new file mode 100644
index 00000000000..8dbad90d354
--- /dev/null
+++ b/mysql-test/suite/innodb/t/lock_deleted.test
@@ -0,0 +1,72 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_debug_sync.inc
+
+--source include/count_sessions.inc
+
+connect(stop_purge, localhost, root,,);
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connect(delete, localhost, root,,);
+connection default;
+
+CREATE TABLE t1(a INT PRIMARY KEY, b INT UNIQUE) ENGINE=InnoDB;
+INSERT INTO t1 VALUES(1,1);
+DELETE FROM t1;
+
+let $i=2;
+while ($i) {
+let $iso= `SELECT CASE $i WHEN 1 THEN 'UNCOMMITTED' ELSE 'COMMITTED' END`;
+
+SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
+BEGIN;
+send INSERT INTO t1 VALUES(1,1);
+
+connection delete;
+SET DEBUG_SYNC='now WAIT_FOR inserted';
+SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
+eval SET SESSION TRANSACTION ISOLATION LEVEL READ $iso;
+BEGIN;
+send DELETE FROM t1 WHERE b=1;
+
+connection default;
+reap;
+connection delete;
+reap;
+COMMIT;
+
+connection default;
+SET DEBUG_SYNC='RESET';
+ROLLBACK;
+
+dec $i;
+}
+
+SET DEBUG_SYNC='row_ins_sec_index_unique SIGNAL inserted WAIT_FOR locked';
+BEGIN;
+SET innodb_lock_wait_timeout=1;
+send INSERT INTO t1 VALUES(1,1);
+
+connection delete;
+SET DEBUG_SYNC='now WAIT_FOR inserted';
+SET DEBUG_SYNC='innodb_row_search_for_mysql_exit SIGNAL locked';
+SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
+BEGIN;
+send DELETE FROM t1 WHERE b=1;
+
+connection default;
+--error ER_LOCK_WAIT_TIMEOUT
+reap;
+COMMIT;
+SET DEBUG_SYNC='RESET';
+
+connection delete;
+reap;
+COMMIT;
+
+disconnect delete;
+disconnect stop_purge;
+
+connection default;
+DROP TABLE t1;
+
+--source include/wait_until_count_sessions.inc
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index f5ce91c6612..b480ce14abe 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -813,6 +813,57 @@ static void dispose_db_dir(void *ptr)
}
+/*
+ Append an element into @@ignore_db_dirs
+
+ This is a function to be called after regular option processing has been
+ finalized.
+*/
+
+void ignore_db_dirs_append(const char *dirname_arg)
+{
+ char *new_entry_buf;
+ LEX_STRING *new_entry;
+ size_t len= strlen(dirname_arg);
+
+ if (!my_multi_malloc(0,
+ &new_entry, sizeof(LEX_STRING),
+ &new_entry_buf, len + 1,
+ NullS))
+ return;
+
+ memcpy(new_entry_buf, dirname_arg, len+1);
+ new_entry->str = new_entry_buf;
+ new_entry->length= len;
+
+ if (my_hash_insert(&ignore_db_dirs_hash, (uchar *)new_entry))
+ {
+ // Either the name is already there or out-of-memory.
+ my_free(new_entry);
+ return;
+ }
+
+ // Append the name to the option string.
+ size_t curlen= strlen(opt_ignore_db_dirs);
+ // Add one for comma and one for \0.
+ size_t newlen= curlen + len + 1 + 1;
+ char *new_db_dirs;
+ if (!(new_db_dirs= (char*)my_malloc(newlen ,MYF(0))))
+ {
+ // This is not a critical condition
+ return;
+ }
+
+ memcpy(new_db_dirs, opt_ignore_db_dirs, curlen);
+ if (curlen != 0)
+ new_db_dirs[curlen]=',';
+ memcpy(new_db_dirs + (curlen + ((curlen!=0)?1:0)), dirname_arg, len+1);
+
+ if (opt_ignore_db_dirs)
+ my_free(opt_ignore_db_dirs);
+ opt_ignore_db_dirs= new_db_dirs;
+}
+
bool
ignore_db_dirs_process_additions()
{
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index cdbe47d48f8..86df5a077a8 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -831,6 +831,7 @@ DECLARE_THREAD(btr_defragment_thread)(void*)
mtr_commit(&mtr);
/* Reaching the end of the index. */
dict_stats_empty_defrag_stats(index);
+ trx->error_state = DB_SUCCESS;
ut_d(trx->persistent_stats = true);
++trx->will_lock;
dberr_t err = dict_stats_save_defrag_stats(index, trx);
diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc
index e43a75b2cf7..34120f0bdc9 100644
--- a/storage/innobase/dict/dict0defrag_bg.cc
+++ b/storage/innobase/dict/dict0defrag_bg.cc
@@ -213,6 +213,7 @@ dict_stats_process_entry_from_defrag_pool(trx_t* trx)
index_id_t index_id;
ut_ad(!srv_read_only_mode);
+ ut_ad(trx->persistent_stats);
/* pop the first index from the auto defrag pool */
if (!dict_stats_defrag_pool_get(&table_id, &index_id)) {
@@ -242,6 +243,7 @@ dict_stats_process_entry_from_defrag_pool(trx_t* trx)
}
mutex_exit(&dict_sys->mutex);
+ trx->error_state = DB_SUCCESS;
++trx->will_lock;
dberr_t err = dict_stats_save_defrag_stats(index, trx);
@@ -275,6 +277,8 @@ dict_defrag_process_entries_from_defrag_pool(trx_t* trx)
dberr_t
dict_stats_save_defrag_summary(dict_index_t* index, trx_t* trx)
{
+ ut_ad(trx->persistent_stats);
+
if (dict_index_is_ibuf(index)) {
return DB_SUCCESS;
}
@@ -294,6 +298,9 @@ dict_stats_save_defrag_summary(dict_index_t* index, trx_t* trx)
dberr_t
dict_stats_save_defrag_stats(dict_index_t* index, trx_t* trx)
{
+ ut_ad(trx->error_state == DB_SUCCESS);
+ ut_ad(trx->persistent_stats);
+
if (dict_index_is_ibuf(index)) {
return DB_SUCCESS;
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 47cc4811272..6d149d6c7d0 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -377,8 +377,7 @@ dict_getnext_system(
/********************************************************************//**
This function processes one SYS_TABLES record and populate the dict_table_t
-struct for the table. Extracted out of dict_print() to be used by
-both monitor table output and information schema innodb_sys_tables output.
+struct for the table.
@return error message, or NULL on success */
const char*
dict_process_sys_tables_rec_and_mtr_commit(
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index e4aca96da4b..662ea959b9e 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -3659,8 +3659,8 @@ dict_stats_rename_table(
new_db_utf8, new_table_utf8, trx);
mutex_exit(&dict_sys->mutex);
/* fall through */
- case DB_DEADLOCK:
case DB_LOCK_WAIT_TIMEOUT:
+ trx->error_state = DB_SUCCESS;
os_thread_sleep(200000 /* 0.2 sec */);
continue;
case DB_STATS_DO_NOT_EXIST:
@@ -3701,8 +3701,8 @@ dict_stats_rename_table(
new_db_utf8, new_table_utf8, trx);
mutex_exit(&dict_sys->mutex);
/* fall through */
- case DB_DEADLOCK:
case DB_LOCK_WAIT_TIMEOUT:
+ trx->error_state = DB_SUCCESS;
os_thread_sleep(200000 /* 0.2 sec */);
continue;
case DB_STATS_DO_NOT_EXIST:
diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc
index 0f76c73bc96..3f5419a0751 100644
--- a/storage/innobase/dict/dict0stats_bg.cc
+++ b/storage/innobase/dict/dict0stats_bg.cc
@@ -378,6 +378,7 @@ dict_stats_process_entry_from_recalc_pool(trx_t* trx)
dict_stats_recalc_pool_add(table);
} else {
+ trx->error_state = DB_SUCCESS;
++trx->will_lock;
dict_stats_update(table, DICT_STATS_RECALC_PERSISTENT, trx);
if (trx->state != TRX_STATE_NOT_STARTED) {
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 1c7489f3392..3263260c0b3 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -6478,6 +6478,7 @@ no_such_table:
}
ut_ad(!trx->persistent_stats);
ut_d(trx->persistent_stats = true);
+ trx->error_state = DB_SUCCESS;
++trx->will_lock;
dict_stats_init(ib_table, trx);
innobase_commit_low(trx);
@@ -13284,6 +13285,7 @@ create_table_info_t::create_table_update_dict()
innobase_copy_frm_flags_from_create_info(innobase_table, m_create_info);
++m_trx->will_lock;
+ m_trx->error_state = DB_SUCCESS;
dict_stats_update(innobase_table, DICT_STATS_EMPTY_TABLE, m_trx);
innobase_commit_low(m_trx);
@@ -14052,6 +14054,7 @@ ha_innobase::rename_table(
normalize_table_name(norm_from, from);
normalize_table_name(norm_to, to);
+ trx->error_state = DB_SUCCESS;
++trx->will_lock;
ret = dict_stats_rename_table(norm_from, norm_to,
errstr, sizeof errstr, trx);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 4d630f9f731..bdb7295825d 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -9080,6 +9080,7 @@ foreign_fail:
}
row_mysql_unlock_data_dictionary(trx);
+ trx->error_state = DB_SUCCESS;
++trx->will_lock;
/* TODO: The following code could be executed
diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h
index 22fd27c2484..9ba42007568 100644
--- a/storage/innobase/include/dict0load.h
+++ b/storage/innobase/include/dict0load.h
@@ -193,8 +193,7 @@ dict_getnext_system(
mtr_t* mtr); /*!< in: the mini-transaction */
/********************************************************************//**
This function processes one SYS_TABLES record and populate the dict_table_t
-struct for the table. Extracted out of dict_print() to be used by
-both monitor table output and information schema innodb_sys_tables output.
+struct for the table.
@return error message, or NULL on success */
const char*
dict_process_sys_tables_rec_and_mtr_commit(
diff --git a/storage/innobase/include/row0vers.h b/storage/innobase/include/row0vers.h
index b28533578e1..576b53358f8 100644
--- a/storage/innobase/include/row0vers.h
+++ b/storage/innobase/include/row0vers.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -38,19 +39,18 @@ Created 2/6/1997 Heikki Tuuri
// Forward declaration
class ReadView;
-/*****************************************************************//**
-Finds out if an active transaction has inserted or modified a secondary
+/** Determine if an active transaction has inserted or modified a secondary
index record.
-@return 0 if committed, else the active transaction id;
-NOTE that this function can return false positives but never false
-negatives. The caller must confirm all positive results by calling
-trx_is_active() while holding lock_sys->mutex. */
+@param[in] rec secondary index record
+@param[in] index secondary index
+@param[in] offsets rec_get_offsets(rec, index)
+@return the active transaction; trx_release_reference() must be invoked
+@retval NULL if the record was committed */
trx_t*
row_vers_impl_x_locked(
-/*===================*/
- const rec_t* rec, /*!< in: record in a secondary index */
- dict_index_t* index, /*!< in: the secondary index */
- const ulint* offsets);/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec,
+ dict_index_t* index,
+ const ulint* offsets);
/*****************************************************************//**
Finds out if we must preserve a delete marked earlier version of a clustered
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index d9bc6dac34b..feff74138c4 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -93,27 +93,6 @@ static ib_mutex_t row_drop_list_mutex;
/** Flag: has row_mysql_drop_list been initialized? */
static ibool row_mysql_drop_list_inited = FALSE;
-/** Magic table names for invoking various monitor threads */
-/* @{ */
-static const char S_innodb_monitor[] = "innodb_monitor";
-static const char S_innodb_lock_monitor[] = "innodb_lock_monitor";
-static const char S_innodb_tablespace_monitor[] = "innodb_tablespace_monitor";
-static const char S_innodb_table_monitor[] = "innodb_table_monitor";
-#ifdef UNIV_MEM_DEBUG
-static const char S_innodb_mem_validate[] = "innodb_mem_validate";
-#endif /* UNIV_MEM_DEBUG */
-/* @} */
-
-/** Evaluates to true if str1 equals str2_onstack, used for comparing
-the magic table names.
-@param str1 in: string to compare
-@param str1_len in: length of str1, in bytes, including terminating NUL
-@param str2_onstack in: char[] array containing a NUL terminated string
-@return TRUE if str1 equals str2_onstack */
-#define STR_EQ(str1, str1_len, str2_onstack) \
- ((str1_len) == sizeof(str2_onstack) \
- && memcmp(str1, str2_onstack, sizeof(str2_onstack)) == 0)
-
/*******************************************************************//**
Determine if the given name is a name reserved for MySQL system tables.
@return TRUE if name is a MySQL system table name */
@@ -5139,31 +5118,6 @@ not_ok:
goto loop;
}
-/*********************************************************************//**
-Determines if a table is a magic monitor table.
-@return true if monitor table */
-UNIV_INTERN
-bool
-row_is_magic_monitor_table(
-/*=======================*/
- const char* table_name) /*!< in: name of the table, in the
- form database/table_name */
-{
- const char* name; /* table_name without database/ */
- ulint len;
-
- name = dict_remove_db_name(table_name);
- len = strlen(name) + 1;
-
- return(STR_EQ(name, len, S_innodb_monitor)
- || STR_EQ(name, len, S_innodb_lock_monitor)
- || STR_EQ(name, len, S_innodb_tablespace_monitor)
- || STR_EQ(name, len, S_innodb_table_monitor)
-#ifdef UNIV_MEM_DEBUG
- || STR_EQ(name, len, S_innodb_mem_validate)
-#endif /* UNIV_MEM_DEBUG */
- );
-}
/*********************************************************************//**
Initialize this module */
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index a867eb73db0..d768fbff6c8 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -4899,9 +4899,44 @@ wrong_offs:
ulint lock_type;
+ if (srv_locks_unsafe_for_binlog
+ || trx->isolation_level <= TRX_ISO_READ_COMMITTED) {
+ /* At READ COMMITTED or READ UNCOMMITTED
+ isolation levels, do not lock committed
+ delete-marked records. */
+ if (!rec_get_deleted_flag(rec, comp)) {
+ goto no_gap_lock;
+ }
+ if (index == clust_index) {
+ trx_id_t trx_id = row_get_rec_trx_id(
+ rec, index, offsets);
+ /* In delete-marked records, DB_TRX_ID must
+ always refer to an existing undo log record. */
+ ut_ad(trx_id);
+ if (!trx_rw_is_active(trx_id, NULL, false)) {
+ /* The clustered index record
+ was delete-marked in a committed
+ transaction. Ignore the record. */
+ goto locks_ok_del_marked;
+ }
+ } else if (trx_t* trx = row_vers_impl_x_locked(
+ rec, index, offsets)) {
+ /* The record belongs to an active
+ transaction. We must acquire a lock. */
+ trx_release_reference(trx);
+ } else {
+ /* The secondary index record does not
+ point to a delete-marked clustered index
+ record that belongs to an active transaction.
+ Ignore the secondary index record, because
+ it is not locked. */
+ goto next_rec;
+ }
+
+ goto no_gap_lock;
+ }
+
if (!set_also_gap_locks
- || srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED
|| (unique_search && !rec_get_deleted_flag(rec, comp))
|| dict_index_is_spatial(index)) {
@@ -5106,6 +5141,7 @@ locks_ok:
page_rec_is_comp() cannot be used! */
if (rec_get_deleted_flag(rec, comp)) {
+locks_ok_del_marked:
/* In delete-marked records, DB_TRX_ID must
always refer to an existing undo log record. */
ut_ad(index != clust_index
@@ -5113,17 +5149,6 @@ locks_ok:
/* The record is delete-marked: we can skip it */
- if ((srv_locks_unsafe_for_binlog
- || trx->isolation_level <= TRX_ISO_READ_COMMITTED)
- && prebuilt->select_lock_type != LOCK_NONE
- && !did_semi_consistent_read) {
-
- /* No need to keep a lock on a delete-marked record
- if we do not want to use next-key locking. */
-
- row_unlock_for_mysql(prebuilt, TRUE);
- }
-
/* This is an optimization to skip setting the next key lock
on the record that follows this delete-marked record. This
optimization works because of the unique search criteria
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index c5d08e1ece6..23ba751ea67 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation
+Copyright (c) 2017, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -63,23 +63,25 @@ row_vers_non_vc_match(
const dtuple_t* ientry,
mem_heap_t* heap,
ulint* n_non_v_col);
-/*****************************************************************//**
-Finds out if an active transaction has inserted or modified a secondary
+/** Determine if an active transaction has inserted or modified a secondary
index record.
-@return 0 if committed, else the active transaction id;
-NOTE that this function can return false positives but never false
-negatives. The caller must confirm all positive results by calling
-trx_is_active() while holding lock_sys->mutex. */
+@param[in] clust_rec clustered index record
+@param[in] clust_index clustered index
+@param[in] rec secondary index record
+@param[in] index secondary index
+@param[in] offsets rec_get_offsets(rec, index)
+@param[in,out] mtr mini-transaction
+@return the active transaction; trx_release_reference() must be invoked
+@retval NULL if the record was committed */
UNIV_INLINE
trx_t*
row_vers_impl_x_locked_low(
-/*=======================*/
- const rec_t* clust_rec, /*!< in: clustered index record */
- dict_index_t* clust_index, /*!< in: the clustered index */
- const rec_t* rec, /*!< in: secondary index record */
- dict_index_t* index, /*!< in: the secondary index */
- const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */
- mtr_t* mtr) /*!< in/out: mini-transaction */
+ const rec_t* clust_rec,
+ dict_index_t* clust_index,
+ const rec_t* rec,
+ dict_index_t* index,
+ const ulint* offsets,
+ mtr_t* mtr)
{
trx_id_t trx_id;
ibool corrupt;
@@ -325,19 +327,18 @@ result_check:
DBUG_RETURN(trx);
}
-/*****************************************************************//**
-Finds out if an active transaction has inserted or modified a secondary
+/** Determine if an active transaction has inserted or modified a secondary
index record.
-@return 0 if committed, else the active transaction id;
-NOTE that this function can return false positives but never false
-negatives. The caller must confirm all positive results by calling
-trx_is_active() while holding lock_sys->mutex. */
+@param[in] rec secondary index record
+@param[in] index secondary index
+@param[in] offsets rec_get_offsets(rec, index)
+@return the active transaction; trx_release_reference() must be invoked
+@retval NULL if the record was committed */
trx_t*
row_vers_impl_x_locked(
-/*===================*/
- const rec_t* rec, /*!< in: record in a secondary index */
- dict_index_t* index, /*!< in: the secondary index */
- const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */
+ const rec_t* rec,
+ dict_index_t* index,
+ const ulint* offsets)
{
mtr_t mtr;
trx_t* trx;
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index 9ac4daf5901..b6d9fbe635d 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -454,8 +454,6 @@ stderr on startup/shutdown. Not enabled on the embedded server. */
ibool srv_print_verbose_log;
my_bool srv_print_innodb_monitor;
my_bool srv_print_innodb_lock_monitor;
-my_bool srv_print_innodb_tablespace_monitor;
-my_bool srv_print_innodb_table_monitor;
/** innodb_force_primary_key; whether to disallow CREATE TABLE without
PRIMARY KEY */
my_bool srv_force_primary_key;
@@ -1713,8 +1711,6 @@ DECLARE_THREAD(srv_monitor_thread)(void*)
double time_elapsed;
time_t current_time;
time_t last_monitor_time;
- time_t last_table_monitor_time;
- time_t last_tablespace_monitor_time;
ulint mutex_skipped;
ibool last_srv_print_monitor;
@@ -1730,8 +1726,6 @@ DECLARE_THREAD(srv_monitor_thread)(void*)
#endif /* UNIV_PFS_THREAD */
srv_last_monitor_time = ut_time();
- last_table_monitor_time = ut_time();
- last_tablespace_monitor_time = ut_time();
last_monitor_time = ut_time();
mutex_skipped = 0;
last_srv_print_monitor = srv_print_innodb_monitor;
@@ -1791,60 +1785,6 @@ loop:
os_file_set_eof(srv_monitor_file);
mutex_exit(&srv_monitor_file_mutex);
}
-
- if (srv_print_innodb_tablespace_monitor
- && difftime(current_time,
- last_tablespace_monitor_time) > 60) {
- last_tablespace_monitor_time = ut_time();
-
- fputs("========================"
- "========================\n",
- stderr);
-
- ut_print_timestamp(stderr);
-
- fputs(" INNODB TABLESPACE MONITOR OUTPUT\n"
- "========================"
- "========================\n",
- stderr);
-
- // JAN: TODO: MySQL 5.7
- //fsp_print(0);
- //fputs("Validating tablespace\n", stderr);
- //fsp_validate(0);
- fputs("Validation ok\n"
- "---------------------------------------\n"
- "END OF INNODB TABLESPACE MONITOR OUTPUT\n"
- "=======================================\n",
- stderr);
- }
-
- if (srv_print_innodb_table_monitor
- && difftime(current_time, last_table_monitor_time) > 60) {
-
- last_table_monitor_time = ut_time();
-
- // fprintf(stderr, "Warning: %s\n",
- // DEPRECATED_MSG_INNODB_TABLE_MONITOR);
-
- fputs("===========================================\n",
- stderr);
-
- ut_print_timestamp(stderr);
-
- fputs(" INNODB TABLE MONITOR OUTPUT\n"
- "===========================================\n",
- stderr);
- // dict_print();
-
- fputs("-----------------------------------\n"
- "END OF INNODB TABLE MONITOR OUTPUT\n"
- "==================================\n",
- stderr);
-
- //fprintf(stderr, "Warning: %s\n",
- // DEPRECATED_MSG_INNODB_TABLE_MONITOR);
- }
}
if (srv_shutdown_state != SRV_SHUTDOWN_NONE) {
@@ -1852,9 +1792,7 @@ loop:
}
if (srv_print_innodb_monitor
- || srv_print_innodb_lock_monitor
- || srv_print_innodb_tablespace_monitor
- || srv_print_innodb_table_monitor) {
+ || srv_print_innodb_lock_monitor) {
goto loop;
}
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index 660c5d20557..a2a34486cb6 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -111,6 +111,10 @@ bool thd_binlog_filter_ok(const MYSQL_THD thd);
MYSQL_PLUGIN_IMPORT bool my_disable_leak_check;
+// Needed in rocksdb_init_func
+void ignore_db_dirs_append(const char *dirname_arg);
+
+
namespace myrocks {
static st_global_stats global_stats;
@@ -1446,7 +1450,7 @@ static MYSQL_SYSVAR_UINT(
static MYSQL_SYSVAR_STR(datadir, rocksdb_datadir,
PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
"RocksDB data directory", nullptr, nullptr,
- "./.rocksdb");
+ "./#rocksdb");
static MYSQL_SYSVAR_STR(supported_compression_types,
compression_types_val,
@@ -3934,6 +3938,7 @@ static rocksdb::Status check_rocksdb_options_compatibility(
return status;
}
+
/*
Storage Engine initialization function, invoked when plugin is loaded.
*/
@@ -3962,6 +3967,11 @@ static int rocksdb_init_func(void *const p) {
mysql_mutex_init(rdb_mem_cmp_space_mutex_key, &rdb_mem_cmp_space_mutex,
MY_MUTEX_INIT_FAST);
+ const char* initial_rocksdb_datadir_for_ignore_dirs= rocksdb_datadir;
+ if (!strncmp(rocksdb_datadir, "./", 2))
+ initial_rocksdb_datadir_for_ignore_dirs += 2;
+ ignore_db_dirs_append(initial_rocksdb_datadir_for_ignore_dirs);
+
#if defined(HAVE_PSI_INTERFACE)
rdb_collation_exceptions =
new Regex_list_handler(key_rwlock_collation_exception_list);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_ignore_dirs.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_ignore_dirs.result
new file mode 100644
index 00000000000..9b91cdb5551
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_ignore_dirs.result
@@ -0,0 +1,9 @@
+#
+# RocksDB plugin adds #rocksdb to ignore_db_dirs
+#
+select @@ignore_db_dirs;
+@@ignore_db_dirs
+#rocksdb
+select @@ignore_db_dirs;
+@@ignore_db_dirs
+aa,bbb,#rocksdb
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
index ed0688c96ad..d791cf98bb0 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb.result
@@ -898,7 +898,7 @@ rocksdb_concurrent_prepare ON
rocksdb_create_checkpoint
rocksdb_create_if_missing ON
rocksdb_create_missing_column_families OFF
-rocksdb_datadir ./.rocksdb
+rocksdb_datadir ./#rocksdb
rocksdb_db_write_buffer_size 0
rocksdb_deadlock_detect OFF
rocksdb_deadlock_detect_depth 50
diff --git a/storage/rocksdb/mysql-test/rocksdb/suite.opt b/storage/rocksdb/mysql-test/rocksdb/suite.opt
index f5dc0ce891c..22c9d7a300e 100644
--- a/storage/rocksdb/mysql-test/rocksdb/suite.opt
+++ b/storage/rocksdb/mysql-test/rocksdb/suite.opt
@@ -1,2 +1,2 @@
---ignore-db-dirs=.rocksdb --plugin-load=$HA_ROCKSDB_SO --default-storage-engine=rocksdb
+--plugin-load=$HA_ROCKSDB_SO --default-storage-engine=rocksdb
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/bulk_load.inc b/storage/rocksdb/mysql-test/rocksdb/t/bulk_load.inc
index 42cab5ad8c1..87cb1f70f32 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/bulk_load.inc
+++ b/storage/rocksdb/mysql-test/rocksdb/t/bulk_load.inc
@@ -134,7 +134,7 @@ select count(b) from t3;
# the server starts
--let $tmpext = .bulk_load.tmp
--let $MYSQLD_DATADIR= `SELECT @@datadir`
---let $datadir = $MYSQLD_DATADIR/.rocksdb
+--let $datadir = $MYSQLD_DATADIR/#rocksdb
--write_file $datadir/test$tmpext
dummy data
EOF
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/compact_deletes_test.inc b/storage/rocksdb/mysql-test/rocksdb/t/compact_deletes_test.inc
index 19a16fbe3a7..0a0d670505f 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/compact_deletes_test.inc
+++ b/storage/rocksdb/mysql-test/rocksdb/t/compact_deletes_test.inc
@@ -44,7 +44,7 @@ perl;
print "wait_for_delete: $ENV{no_more_deletes}\n";
while ($retry++ < $num_retries) {
$total_d=$total_e=0;
- for $f (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/.rocksdb/*.sst>) {
+ for $f (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/#rocksdb/*.sst>) {
# excluding system cf
$filename= "$ENV{MARIAROCKS_SST_DUMP} --command=scan --output_hex --file=$f";
open(D, '-|', $filename) || die("Can't open file $filename: $!");
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/drop_table2.test b/storage/rocksdb/mysql-test/rocksdb/t/drop_table2.test
index 14d856cc0c5..a9012aea80a 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/drop_table2.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/drop_table2.test
@@ -97,7 +97,7 @@ set @@global.rocksdb_compact_cf = 'rev:cf2';
set @@global.rocksdb_compact_cf = 'default';
perl;
-$size+=-s $_ for (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/.rocksdb/*.sst>);
+$size+=-s $_ for (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/\#rocksdb/*.sst>);
$filename= "$ENV{MYSQLTEST_VARDIR}/tmp/size_output";
open(F, '>', $filename) || die("Can't open file $filename: $!");
print F $size;
@@ -121,7 +121,7 @@ let $wait_condition = select count(*) = 0
# Check that space is reclaimed
perl;
-$size+=-s $_ for (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/.rocksdb/*.sst>);
+$size+=-s $_ for (<$ENV{MYSQLTEST_VARDIR}/mysqld.1/data/\#rocksdb/*.sst>);
$filename= "$ENV{MYSQLTEST_VARDIR}/tmp/size_output";
open(F, '<', $filename) || die("Can't open file $filename: $!");
$old=<F>;
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_ignore_dirs.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_ignore_dirs.test
new file mode 100644
index 00000000000..49591dd612a
--- /dev/null
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_ignore_dirs.test
@@ -0,0 +1,17 @@
+--source include/have_rocksdb.inc
+
+
+--echo #
+--echo # RocksDB plugin adds #rocksdb to ignore_db_dirs
+--echo #
+
+select @@ignore_db_dirs;
+
+--let $_mysqld_option=--ignore-db-dirs=aa --ignore-db-dirs=bbb
+--source include/restart_mysqld_with_option.inc
+
+select @@ignore_db_dirs;
+
+--let $_mysqld_option=--ignore-db-dirs=#rocksdb
+--source include/restart_mysqld_with_option.inc
+
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.inc b/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.inc
index 9d03aae5c0c..5f66937cef1 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.inc
+++ b/storage/rocksdb/mysql-test/rocksdb/t/optimize_table.inc
@@ -1,7 +1,7 @@
# run a check script to verify sst files reduced enough during each optimize table
perl;
-$size += -s $_ for (<$ENV{datadir}/.rocksdb/*.sst>);
+$size += -s $_ for (<$ENV{datadir}/#rocksdb/*.sst>);
$file= "$ENV{MYSQL_TMP_DIR}/sst_size.dat";
if (-f $file) {
diff --git a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/stream_run.sh b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/stream_run.sh
index ecf8a851267..b6735abb0a9 100755
--- a/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/stream_run.sh
+++ b/storage/rocksdb/mysql-test/rocksdb_hotbackup/include/stream_run.sh
@@ -77,7 +77,7 @@ MOVEBACK_LOG="${MYSQL_TMP_DIR}/myrocks_hotbackup_moveback_log"
echo "myrocks_hotbackup move-back phase"
$MYSQL_MYROCKS_HOTBACKUP --move_back --datadir=$dest_data_dir \
- --rocksdb_datadir=$dest_data_dir/.rocksdb \
- --rocksdb_waldir=$dest_data_dir/.rocksdb \
+ --rocksdb_datadir=$dest_data_dir/\#rocksdb \
+ --rocksdb_waldir=$dest_data_dir/\#rocksdb \
--backup_dir=$backup_dir > $MOVEBACK_LOG 2>&1
diff --git a/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_gtid_crash_safe_wal_corrupt.inc b/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_gtid_crash_safe_wal_corrupt.inc
index a52bfc9186d..5e5961f3aef 100644
--- a/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_gtid_crash_safe_wal_corrupt.inc
+++ b/storage/rocksdb/mysql-test/rocksdb_rpl/t/rpl_gtid_crash_safe_wal_corrupt.inc
@@ -40,7 +40,7 @@ select * from mysql.slave_gtid_info;
--write_file $MYSQL_TMP_DIR/truncate_tail_wal.sh
#!/bin/bash
-F=`ls -t $slave_data_dir/.rocksdb/*.log | head -n 1`
+F=`ls -t $slave_data_dir/\#rocksdb/*.log | head -n 1`
SIZE=`stat -c %s $F`
NEW_SIZE=`expr $SIZE - 10`
truncate -s $NEW_SIZE $F
@@ -116,7 +116,7 @@ connection slave;
#!/bin/bash
# expected to be around 950 bytes
-F=`ls -t $slave_data_dir/.rocksdb/*.log | head -n 1`
+F=`ls -t $slave_data_dir/\#rocksdb/*.log | head -n 1`
SIZE=`stat -c %s $F`
OFFSET=$(( $SIZE-500 ))
dd bs=1 if=/dev/zero of=$F count=100 seek=$OFFSET conv=notrunc
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_datadir_basic.result b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_datadir_basic.result
index a3f9eff6c1f..3215624bad8 100644
--- a/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_datadir_basic.result
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/r/rocksdb_datadir_basic.result
@@ -1,7 +1,7 @@
SET @start_global_value = @@global.ROCKSDB_DATADIR;
SELECT @start_global_value;
@start_global_value
-./.rocksdb
+./#rocksdb
"Trying to set variable @@global.ROCKSDB_DATADIR to 444. It should fail because it is readonly."
SET @@global.ROCKSDB_DATADIR = 444;
ERROR HY000: Variable 'rocksdb_datadir' is a read only variable
diff --git a/storage/rocksdb/mysql-test/rocksdb_sys_vars/suite.opt b/storage/rocksdb/mysql-test/rocksdb_sys_vars/suite.opt
index 431fc331458..b503913d2c8 100644
--- a/storage/rocksdb/mysql-test/rocksdb_sys_vars/suite.opt
+++ b/storage/rocksdb/mysql-test/rocksdb_sys_vars/suite.opt
@@ -1,2 +1,2 @@
---ignore-db-dirs=.rocksdb --plugin-load=$HA_ROCKSDB_SO
+--ignore-db-dirs=#rocksdb --plugin-load=$HA_ROCKSDB_SO
diff --git a/storage/rocksdb/mysql-test/storage_engine/cleanup_engine.inc b/storage/rocksdb/mysql-test/storage_engine/cleanup_engine.inc
index 4f6c586172d..e6fe915ed38 100644
--- a/storage/rocksdb/mysql-test/storage_engine/cleanup_engine.inc
+++ b/storage/rocksdb/mysql-test/storage_engine/cleanup_engine.inc
@@ -12,14 +12,14 @@
--let $datadir= `SELECT @@datadir`
--error 0,1
---file_exists $datadir/.rocksdb/*
+--file_exists $datadir/\#rocksdb/*
if (!$mysql_errno)
{
--enable_reconnect
--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--shutdown_server
--source include/wait_until_disconnected.inc
- --rmdir $datadir/.rocksdb
+ --rmdir $datadir/\#rocksdb
--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
--source include/wait_until_connected_again.inc
}
diff --git a/storage/rocksdb/mysql-test/storage_engine/parts/suite.opt b/storage/rocksdb/mysql-test/storage_engine/parts/suite.opt
index 1e464761753..d77a822766f 100644
--- a/storage/rocksdb/mysql-test/storage_engine/parts/suite.opt
+++ b/storage/rocksdb/mysql-test/storage_engine/parts/suite.opt
@@ -1 +1 @@
---ignore-db-dirs=.rocksdb --plugin-load=$HA_ROCKSDB_SO --binlog_format=ROW --loose-rocksdb_flush_log_at_trx_commit=0
+--ignore-db-dirs=#rocksdb --plugin-load=$HA_ROCKSDB_SO --binlog_format=ROW --loose-rocksdb_flush_log_at_trx_commit=0
diff --git a/storage/rocksdb/mysql-test/storage_engine/suite.opt b/storage/rocksdb/mysql-test/storage_engine/suite.opt
index 8eb0e87db98..e6122c7ed3e 100644
--- a/storage/rocksdb/mysql-test/storage_engine/suite.opt
+++ b/storage/rocksdb/mysql-test/storage_engine/suite.opt
@@ -1 +1 @@
---ignore-db-dirs=.rocksdb --plugin-load=$HA_ROCKSDB_SO --binlog_format=ROW --collation-server=latin1_bin --loose-rocksdb_flush_log_at_trx_commit=0
+--ignore-db-dirs=#rocksdb --plugin-load=$HA_ROCKSDB_SO --binlog_format=ROW --collation-server=latin1_bin --loose-rocksdb_flush_log_at_trx_commit=0
diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/suite.opt b/storage/rocksdb/mysql-test/storage_engine/trx/suite.opt
index 1e464761753..d77a822766f 100644
--- a/storage/rocksdb/mysql-test/storage_engine/trx/suite.opt
+++ b/storage/rocksdb/mysql-test/storage_engine/trx/suite.opt
@@ -1 +1 @@
---ignore-db-dirs=.rocksdb --plugin-load=$HA_ROCKSDB_SO --binlog_format=ROW --loose-rocksdb_flush_log_at_trx_commit=0
+--ignore-db-dirs=#rocksdb --plugin-load=$HA_ROCKSDB_SO --binlog_format=ROW --loose-rocksdb_flush_log_at_trx_commit=0