diff --git a/mysql-test/suite/rocksdb/r/drop_table.result b/mysql-test/suite/rocksdb/r/drop_table.result index 8fe546d1ba25..7d0fae229da5 100644 --- a/mysql-test/suite/rocksdb/r/drop_table.result +++ b/mysql-test/suite/rocksdb/r/drop_table.result @@ -52,14 +52,6 @@ drop table t5; set global rocksdb_compact_cf = 'cf1'; set global rocksdb_compact_cf = 'rev:cf2'; set global rocksdb_signal_drop_index_thread = 1; -Compacted+ 0: 1000 -Compacted+ 1: 1000 -Compacted+ 1: 1000 -Compacted+ 1: 1000 -Compacted+ 1: 50000 -Compacted+ 1: 50000 -Compacted+ 1: 1000 -Compacted+ 1: 1000 Begin filtering dropped index+ 0 Begin filtering dropped index+ 1 Begin filtering dropped index+ 1 diff --git a/mysql-test/suite/rocksdb/r/drop_table2.result b/mysql-test/suite/rocksdb/r/drop_table2.result new file mode 100644 index 000000000000..c46d3522dd7c --- /dev/null +++ b/mysql-test/suite/rocksdb/r/drop_table2.result @@ -0,0 +1,53 @@ +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; +DROP TABLE IF EXISTS t4; +DROP TABLE IF EXISTS t5; +set global rocksdb_compact_cf = 'cf1'; +set global rocksdb_compact_cf = 'rev:cf2'; +set global rocksdb_signal_drop_index_thread = 1; +CREATE TABLE t1 ( +a int not null, +b int not null, +primary key (a,b) comment 'cf1', +key (b) comment 'rev:cf2' +) ENGINE=RocksDB; +CREATE TABLE t2 ( +a int not null, +b int not null, +primary key (a,b) comment 'cf1', +key (b) comment 'rev:cf2' +) ENGINE=RocksDB; +CREATE TABLE t3 ( +a int not null, +b int not null, +primary key (a,b) comment 'cf1', +key (b) comment 'rev:cf2' +) ENGINE=RocksDB; +CREATE TABLE t4 ( +a int not null, +b int not null, +primary key (a,b) comment 'cf1', +key (b) comment 'rev:cf2' +) ENGINE=RocksDB; +DELETE FROM t1; +DELETE FROM t2; +DELETE FROM t3; +DELETE FROM t4; +DELETE FROM t1; +DELETE FROM t4; +DELETE FROM t1; +DELETE FROM t4; +CREATE TABLE t5 ( +a int not null, +b int not null, +primary key (a,b) comment 'cf1', +key (b) comment 'rev:cf2' +) ENGINE=RocksDB; +DELETE FROM t5; +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; +Compacted diff --git a/mysql-test/suite/rocksdb/r/index.result b/mysql-test/suite/rocksdb/r/index.result index 14c308e5e389..ef59ce6e957f 100644 --- a/mysql-test/suite/rocksdb/r/index.result +++ b/mysql-test/suite/rocksdb/r/index.result @@ -5,8 +5,8 @@ KEY (a) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -15,9 +15,9 @@ KEY a_b (a,b) COMMENT 'a_b index' ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a_b 1 a A 250 NULL NULL YES BTREE a_b index -t1 1 a_b 2 b A 500 NULL NULL YES BTREE a_b index +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a_b 1 a A # NULL NULL YES BTREE a_b index +t1 1 a_b 2 b A # NULL NULL YES BTREE a_b index DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -27,16 +27,16 @@ KEY (b) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE -t1 1 b 1 b A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE +t1 1 b 1 b A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb; INSERT INTO t1 (a,b) VALUES (100,'z'); ALTER TABLE t1 ADD KEY (a) COMMENT 'simple index on a'; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE simple index on a +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE simple index on a ALTER TABLE t1 DROP KEY a; DROP TABLE t1; diff --git a/mysql-test/suite/rocksdb/r/index_key_block_size.result b/mysql-test/suite/rocksdb/r/index_key_block_size.result index 15d043d24e0f..b27ec8de111e 100644 --- a/mysql-test/suite/rocksdb/r/index_key_block_size.result +++ b/mysql-test/suite/rocksdb/r/index_key_block_size.result @@ -6,8 +6,8 @@ KEY (a) KEY_BLOCK_SIZE=8 ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -16,8 +16,8 @@ KEY ind1(b ASC) KEY_BLOCK_SIZE=0 ) ENGINE=rocksdb; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 ind1 1 b A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 ind1 1 b A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -25,7 +25,7 @@ PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size val ) ENGINE=rocksdb; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 b A 1000 1 NULL BTREE big key_block_size value +t1 0 PRIMARY 1 b A # 1 NULL BTREE big key_block_size value DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -34,9 +34,9 @@ KEY a_b(a,b) KEY_BLOCK_SIZE=8192 ) ENGINE=rocksdb; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a_b 1 a A 250 NULL NULL YES BTREE -t1 1 a_b 2 b A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a_b 1 a A # NULL NULL YES BTREE +t1 1 a_b 2 b A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -46,6 +46,6 @@ INSERT INTO t1 (a,b) VALUES (100,'z'); ALTER TABLE t1 ADD KEY(a) KEY_BLOCK_SIZE 8192; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 b A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 b A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE DROP TABLE t1; diff --git a/mysql-test/suite/rocksdb/r/index_primary.result b/mysql-test/suite/rocksdb/r/index_primary.result index ce9b3704f8b4..58d87aea98ca 100644 --- a/mysql-test/suite/rocksdb/r/index_primary.result +++ b/mysql-test/suite/rocksdb/r/index_primary.result @@ -4,7 +4,7 @@ b CHAR(8) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 a A 1000 NULL NULL BTREE +t1 0 PRIMARY 1 a A # NULL NULL BTREE INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); INSERT INTO t1 (a,b) VALUES (1,'c'); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' @@ -19,8 +19,8 @@ PRIMARY KEY (a,b) ) ENGINE=rocksdb; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 a A 500 NULL NULL BTREE -t1 0 PRIMARY 2 b A 1000 NULL NULL BTREE +t1 0 PRIMARY 1 a A # NULL NULL BTREE +t1 0 PRIMARY 2 b A # NULL NULL BTREE INSERT INTO t1 (a,b) VALUES (1,'a'),(1,'b'),(2,'a'),(2,'b'); INSERT INTO t1 (a,b) VALUES (1,'b'); ERROR 23000: Duplicate entry '1-b' for key 'PRIMARY' @@ -31,22 +31,22 @@ KEY (b) ) ENGINE=rocksdb; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 a A 1000 NULL NULL BTREE -t1 1 b 1 b A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 a A # NULL NULL BTREE +t1 1 b 1 b A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8) PRIMARY KEY ) ENGINE=rocksdb; SHOW INDEX IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 b A 1000 NULL NULL BTREE +t1 0 PRIMARY 1 b A # NULL NULL BTREE ALTER TABLE t1 DROP INDEX `PRIMARY`; ERROR 42000: This table type requires a primary key ALTER TABLE t1 ADD CONSTRAINT PRIMARY KEY pk (a); ERROR 42000: Multiple primary key defined SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 b A 1000 NULL NULL BTREE +t1 0 PRIMARY 1 b A # NULL NULL BTREE ALTER TABLE t1 DROP PRIMARY KEY; ERROR 42000: This table type requires a primary key DROP TABLE t1; diff --git a/mysql-test/suite/rocksdb/r/index_type_btree.result b/mysql-test/suite/rocksdb/r/index_type_btree.result index 7bc60f865158..69f16ee0beb3 100644 --- a/mysql-test/suite/rocksdb/r/index_type_btree.result +++ b/mysql-test/suite/rocksdb/r/index_type_btree.result @@ -5,8 +5,8 @@ KEY USING BTREE (a) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -15,9 +15,9 @@ KEY a_b USING BTREE (a,b) COMMENT 'a_b index' ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a_b 1 a A 250 NULL NULL YES BTREE a_b index -t1 1 a_b 2 b A 500 NULL NULL YES BTREE a_b index +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a_b 1 a A # NULL NULL YES BTREE a_b index +t1 1 a_b 2 b A # NULL NULL YES BTREE a_b index DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -27,16 +27,16 @@ KEY USING BTREE (b) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE -t1 1 b 1 b A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE +t1 1 b 1 b A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb; INSERT INTO t1 (a,b) VALUES (100,'z'); ALTER TABLE t1 ADD KEY (a) USING BTREE COMMENT 'simple index on a'; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE simple index on a +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE simple index on a ALTER TABLE t1 DROP KEY a; DROP TABLE t1; diff --git a/mysql-test/suite/rocksdb/r/index_type_hash.result b/mysql-test/suite/rocksdb/r/index_type_hash.result index 0c8030d6dd79..43953178d3b4 100644 --- a/mysql-test/suite/rocksdb/r/index_type_hash.result +++ b/mysql-test/suite/rocksdb/r/index_type_hash.result @@ -5,8 +5,8 @@ KEY USING HASH (a) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -15,9 +15,9 @@ KEY a_b USING HASH (a,b) COMMENT 'a_b index' ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a_b 1 a A 250 NULL NULL YES BTREE a_b index -t1 1 a_b 2 b A 500 NULL NULL YES BTREE a_b index +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a_b 1 a A # NULL NULL YES BTREE a_b index +t1 1 a_b 2 b A # NULL NULL YES BTREE a_b index DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), @@ -27,16 +27,16 @@ KEY USING HASH (b) ) ENGINE=rocksdb; SHOW KEYS IN t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE -t1 1 b 1 b A 500 NULL NULL YES BTREE +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE +t1 1 b 1 b A # NULL NULL YES BTREE DROP TABLE t1; CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=rocksdb; INSERT INTO t1 (a,b) VALUES (100,'z'); ALTER TABLE t1 ADD KEY (a) USING HASH COMMENT 'simple index on a'; SHOW INDEX FROM t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 0 PRIMARY 1 pk A 1000 NULL NULL BTREE -t1 1 a 1 a A 500 NULL NULL YES BTREE simple index on a +t1 0 PRIMARY 1 pk A # NULL NULL BTREE +t1 1 a 1 a A # NULL NULL YES BTREE simple index on a ALTER TABLE t1 DROP KEY a; DROP TABLE t1; diff --git a/mysql-test/suite/rocksdb/r/rocksdb.result b/mysql-test/suite/rocksdb/r/rocksdb.result index d6a24c0d8a29..82168f46d635 100644 --- a/mysql-test/suite/rocksdb/r/rocksdb.result +++ b/mysql-test/suite/rocksdb/r/rocksdb.result @@ -6,6 +6,8 @@ drop table if exists t11,t12,t13,t14,t15,t16,t17,t18,t19,t20; drop table if exists t21,t22,t23,t24,t25,t26,t27,t28,t29; drop table if exists t30,t31,t32,t33,t34,t35,t36,t37,t38,t39; drop table if exists t40,t41,t42,t43,t44,t45,t46,t47,t48,t49; +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; # # Issue #1: Don't update indexes if index values have not changed # @@ -904,7 +906,7 @@ rocksdb_max_total_wal_size 0 rocksdb_no_block_cache OFF rocksdb_override_cf_options rocksdb_paranoid_checks ON -rocksdb_pause_background_work OFF +rocksdb_pause_background_work ON rocksdb_perf_context_level 1 rocksdb_rate_limiter_bytes_per_sec 0 rocksdb_records_in_range 0 @@ -1314,6 +1316,9 @@ drop table t2; create table t1 (i int primary key auto_increment) engine=RocksDB; insert into t1 values (null); insert into t1 values (null); +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; insert into t1 values (null); select * from t1; i @@ -2167,3 +2172,4 @@ insert into t2 select concat('v-', 100 + A.a*100 + B.a), 12345 from t1 A, t1 B; update t2 set a=concat('x-', a) where a between 'v-1002' and 'v-1004'; drop table t1,t2; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_binary_indexes.result b/mysql-test/suite/rocksdb/r/type_binary_indexes.result index fadb72fe1d4d..5ae56ffba494 100644 --- a/mysql-test/suite/rocksdb/r/type_binary_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_binary_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (b BINARY, b20 BINARY(20) PRIMARY KEY, @@ -75,3 +77,4 @@ HEX(SUBSTRING(v16,7,3)) 723461 723461 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_bit_indexes.result b/mysql-test/suite/rocksdb/r/type_bit_indexes.result index 7f5bc8ad02d1..9947657feb7e 100644 --- a/mysql-test/suite/rocksdb/r/type_bit_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_bit_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a BIT, @@ -53,3 +55,4 @@ a+0 0 1 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_blob_indexes.result b/mysql-test/suite/rocksdb/r/type_blob_indexes.result index 8e732e153b95..37233bc15221 100644 --- a/mysql-test/suite/rocksdb/r/type_blob_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_blob_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (b BLOB , t TINYBLOB , @@ -150,3 +152,4 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT SUBSTRING(m,128) AS f FROM t1 IGNORE INDEX FOR ORDER BY (m) WHERE m = 'test1' ORDER BY f DESC; f DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_char_indexes.result b/mysql-test/suite/rocksdb/r/type_char_indexes.result index ebe190d2bece..8fb5607d9789 100644 --- a/mysql-test/suite/rocksdb/r/type_char_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_char_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( c CHAR, @@ -68,3 +70,4 @@ a char1 varchar1a varchar1b b char3 varchar1a varchar1b c char4 varchar3a varchar3b DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_date_time_indexes.result b/mysql-test/suite/rocksdb/r/type_date_time_indexes.result index 90750ce0ee8c..72c1be65ee5e 100644 --- a/mysql-test/suite/rocksdb/r/type_date_time_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_date_time_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( d DATE, @@ -114,3 +116,4 @@ y COUNT(*) 2001 1 2012 1 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_enum_indexes.result b/mysql-test/suite/rocksdb/r/type_enum_indexes.result index 25ae510f334c..1c2e923b5fec 100644 --- a/mysql-test/suite/rocksdb/r/type_enum_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_enum_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a ENUM('N.America','S.America','Africa','Europe','Australia','Asia','Antarctica'), @@ -64,3 +66,4 @@ test2 test3 test4 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_fixed_indexes.result b/mysql-test/suite/rocksdb/r/type_fixed_indexes.result index 24088cdda045..aa7a0ea49510 100644 --- a/mysql-test/suite/rocksdb/r/type_fixed_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_fixed_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( d1 DECIMAL(10,2) PRIMARY KEY, @@ -124,3 +126,4 @@ d2 COUNT(*) 3343303441.0000000000 1 60.1234500000 2 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_float_indexes.result b/mysql-test/suite/rocksdb/r/type_float_indexes.result index 186d18d5e8a1..d7d729b6ec52 100644 --- a/mysql-test/suite/rocksdb/r/type_float_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_float_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( f FLOAT PRIMARY KEY, @@ -184,3 +186,4 @@ f 17.5843 4644 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_int_indexes.result b/mysql-test/suite/rocksdb/r/type_int_indexes.result index 71df4b640c0e..e4c47f04c24c 100644 --- a/mysql-test/suite/rocksdb/r/type_int_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_int_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( i INT PRIMARY KEY, @@ -94,3 +96,4 @@ b+t 100000000000000100 1000000000000000100 DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_set_indexes.result b/mysql-test/suite/rocksdb/r/type_set_indexes.result index 60b664913361..3605462040cd 100644 --- a/mysql-test/suite/rocksdb/r/type_set_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_set_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 ( a SET('N.America','S.America','Africa','Antarctica','Australia','Europe','Asia'), @@ -75,3 +77,4 @@ a Africa,Europe,Asia S.America,Europe DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/r/type_text_indexes.result b/mysql-test/suite/rocksdb/r/type_text_indexes.result index a23373e2c0df..ddf26be25686 100644 --- a/mysql-test/suite/rocksdb/r/type_text_indexes.result +++ b/mysql-test/suite/rocksdb/r/type_text_indexes.result @@ -1,3 +1,5 @@ +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; DROP TABLE IF EXISTS t1; CREATE TABLE t1 (t TEXT , tt TINYTEXT , @@ -135,3 +137,4 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC; f DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/drop_table.test b/mysql-test/suite/rocksdb/t/drop_table.test index 88ad66542d9a..7b28474d9f25 100644 --- a/mysql-test/suite/rocksdb/t/drop_table.test +++ b/mysql-test/suite/rocksdb/t/drop_table.test @@ -98,7 +98,13 @@ set global rocksdb_compact_cf = 'rev:cf2'; # Signal thread to check for dropped indices set global rocksdb_signal_drop_index_thread = 1; ---sleep 1 + +let $show_rpl_debug_info= 1; # to force post-failure printout +let $wait_timeout= 300; # Override default 30 seconds with 300. +let $wait_condition = select count(*) = 0 + as c from information_schema.rocksdb_global_info + where TYPE = 'DDL_DROP_INDEX_ONGOING'; +--source include/wait_condition.inc # Get list of all indices needing to be dropped # Check total compacted-away rows for all indices diff --git a/mysql-test/suite/rocksdb/t/drop_table2.test b/mysql-test/suite/rocksdb/t/drop_table2.test new file mode 100644 index 000000000000..3742ab0e4440 --- /dev/null +++ b/mysql-test/suite/rocksdb/t/drop_table2.test @@ -0,0 +1,110 @@ +--source include/have_rocksdb.inc + +--disable_warnings +DROP TABLE IF EXISTS t1; +DROP TABLE IF EXISTS t2; +DROP TABLE IF EXISTS t3; +DROP TABLE IF EXISTS t4; +DROP TABLE IF EXISTS t5; +--enable_warnings + +# Start from clean slate +set global rocksdb_compact_cf = 'cf1'; +set global rocksdb_compact_cf = 'rev:cf2'; +set global rocksdb_signal_drop_index_thread = 1; +--source include/restart_mysqld.inc +--exec truncate --size=0 $MYSQLTEST_VARDIR/log/mysqld.1.err + +CREATE TABLE t1 ( + a int not null, + b int not null, + primary key (a,b) comment 'cf1', + key (b) comment 'rev:cf2' +) ENGINE=RocksDB; + +CREATE TABLE t2 ( + a int not null, + b int not null, + primary key (a,b) comment 'cf1', + key (b) comment 'rev:cf2' +) ENGINE=RocksDB; + +CREATE TABLE t3 ( + a int not null, + b int not null, + primary key (a,b) comment 'cf1', + key (b) comment 'rev:cf2' +) ENGINE=RocksDB; + +CREATE TABLE t4 ( + a int not null, + b int not null, + primary key (a,b) comment 'cf1', + key (b) comment 'rev:cf2' +) ENGINE=RocksDB; + +# Populate tables +let $max = 1000; +let $table = t1; +--source drop_table_repopulate_table.inc +let $table = t2; +--source drop_table_repopulate_table.inc +let $table = t3; +--source drop_table_repopulate_table.inc +let $table = t4; +--source drop_table_repopulate_table.inc + + +# Restart the server before t2's indices are deleted +--source include/restart_mysqld.inc + +let $table = t1; +--source drop_table_repopulate_table.inc +let $table = t4; +--source drop_table_repopulate_table.inc + + +# Insert enough data to trigger compactions that eliminate t2 and t3 +let $max = 50000; +let $table = t1; +--source drop_table_repopulate_table.inc +let $table = t4; +--source drop_table_repopulate_table.inc + + +# Restart the server before t4's indices are deleted +--source include/restart_mysqld.inc + +# Make sure new table gets unique indices +CREATE TABLE t5 ( + a int not null, + b int not null, + primary key (a,b) comment 'cf1', + key (b) comment 'rev:cf2' +) ENGINE=RocksDB; + +let $max = 1000; +let $table = t5; +--source drop_table_repopulate_table.inc + +let $output= $MYSQLTEST_VARDIR/tmp/size_output; + +--exec du -c $MYSQLTEST_VARDIR/mysqld.1/data/.rocksdb/*.sst |grep total |sed 's/[\t]total/ before/' > $output +drop table t1; +drop table t2; +drop table t3; +drop table t4; +drop table t5; + +let $show_rpl_debug_info= 1; # to force post-failure printout +let $wait_timeout= 300; # Override default 30 seconds with 300. +let $wait_condition = select count(*) = 0 + as c from information_schema.rocksdb_global_info + where TYPE = 'DDL_DROP_INDEX_ONGOING'; +--source include/wait_condition.inc + +# Check that space is reclaimed +--exec du -c $MYSQLTEST_VARDIR/mysqld.1/data/.rocksdb/*.sst |grep total |sed 's/[\t]total/ after/' >> $output +--exec perl suite/rocksdb/t/drop_table2_check.pl $output + +# Cleanup diff --git a/mysql-test/suite/rocksdb/t/drop_table2_check.pl b/mysql-test/suite/rocksdb/t/drop_table2_check.pl new file mode 100644 index 000000000000..8f43f4725b50 --- /dev/null +++ b/mysql-test/suite/rocksdb/t/drop_table2_check.pl @@ -0,0 +1,19 @@ +#!/usr/bin/perl + +my $a = 0; +my $b=0; +die unless($ARGV[0]); +open(my $f, "<", $ARGV[0]) or die $!; +while(readline($f)) { + if (/(\d+) before/) { + $a = $1; + } + + if (/(\d+) after/ ) { + $b = $1; + } +} + +if ($a > $b * 2) { + printf("Compacted\n"); +} diff --git a/mysql-test/suite/rocksdb/t/drop_table_compactions.pl b/mysql-test/suite/rocksdb/t/drop_table_compactions.pl index f7c5cb029103..b123ac5492fc 100755 --- a/mysql-test/suite/rocksdb/t/drop_table_compactions.pl +++ b/mysql-test/suite/rocksdb/t/drop_table_compactions.pl @@ -32,7 +32,6 @@ sub print_array { $dummy_idx= 0; } $prev= $_; - print "Compacted+ $dummy_idx: $a{$_}\n"; } print_array("Begin filtering dropped index+", sort {$a <=> $b} @b); print_array("Finished filtering dropped index+", sort {$a <=> $b} @c); diff --git a/mysql-test/suite/rocksdb/t/drop_table_sync.inc b/mysql-test/suite/rocksdb/t/drop_table_sync.inc new file mode 100644 index 000000000000..c6a3ccde7a63 --- /dev/null +++ b/mysql-test/suite/rocksdb/t/drop_table_sync.inc @@ -0,0 +1,6 @@ +let $show_rpl_debug_info= 1; # to force post-failure printout +let $wait_timeout= 300; # Override default 30 seconds with 300. +let $wait_condition = select count(*) = 0 + as c from information_schema.rocksdb_global_info + where TYPE = 'DDL_DROP_INDEX_ONGOING'; +--source include/wait_condition.inc diff --git a/mysql-test/suite/rocksdb/t/index-master.opt b/mysql-test/suite/rocksdb/t/index-master.opt deleted file mode 100644 index ba9364e15237..000000000000 --- a/mysql-test/suite/rocksdb/t/index-master.opt +++ /dev/null @@ -1 +0,0 @@ ---rocksdb_debug_optimizer_n_rows=1000 diff --git a/mysql-test/suite/rocksdb/t/index.inc b/mysql-test/suite/rocksdb/t/index.inc index 5786971ab0f7..6b4e4ff233bd 100644 --- a/mysql-test/suite/rocksdb/t/index.inc +++ b/mysql-test/suite/rocksdb/t/index.inc @@ -39,6 +39,7 @@ eval CREATE TABLE t1 (a INT, KEY $using_index_type (a) ) ENGINE=rocksdb; +--replace_column 7 # SHOW KEYS IN t1; DROP TABLE t1; @@ -48,6 +49,7 @@ eval CREATE TABLE t1 (a INT, KEY a_b $using_index_type (a,b) COMMENT 'a_b index' ) ENGINE=rocksdb; +--replace_column 7 # SHOW KEYS IN t1; DROP TABLE t1; @@ -58,6 +60,7 @@ eval CREATE TABLE t1 (a INT, KEY $using_index_type (b) ) ENGINE=rocksdb; +--replace_column 7 # SHOW KEYS IN t1; DROP TABLE t1; @@ -69,6 +72,7 @@ eval CREATE TABLE t1 (a INT, UNIQUE INDEX $using_index_type (a) ) ENGINE=rocksdb; +--replace_column 7 # SHOW KEYS IN t1; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); --error ER_DUP_ENTRY,ER_DUP_KEY @@ -76,6 +80,8 @@ INSERT INTO t1 (a,b) VALUES (1,'c'); DROP TABLE t1; +--source drop_table_sync.inc + --enable_parsing # @@ -86,6 +92,7 @@ CREATE TABLE t1 (a INT, b CHAR(8), pk INT AUTO_INCREMENT PRIMARY KEY) ENGINE=roc INSERT INTO t1 (a,b) VALUES (100,'z'); eval ALTER TABLE t1 ADD KEY (a) $using_index_type COMMENT 'simple index on a'; +--replace_column 7 # SHOW INDEX FROM t1; ALTER TABLE t1 DROP KEY a; DROP TABLE t1; @@ -98,6 +105,7 @@ eval CREATE TABLE t1 (a INT, UNIQUE INDEX $using_index_type (a) ) ENGINE=rocksdb; +--replace_column 7 # SHOW KEYS IN t1; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); --error ER_DUP_ENTRY,ER_DUP_KEY diff --git a/mysql-test/suite/rocksdb/t/index_key_block_size-master.opt b/mysql-test/suite/rocksdb/t/index_key_block_size-master.opt deleted file mode 100644 index ba9364e15237..000000000000 --- a/mysql-test/suite/rocksdb/t/index_key_block_size-master.opt +++ /dev/null @@ -1 +0,0 @@ ---rocksdb_debug_optimizer_n_rows=1000 diff --git a/mysql-test/suite/rocksdb/t/index_key_block_size.test b/mysql-test/suite/rocksdb/t/index_key_block_size.test index 3794889e8fb9..f156aec0021c 100644 --- a/mysql-test/suite/rocksdb/t/index_key_block_size.test +++ b/mysql-test/suite/rocksdb/t/index_key_block_size.test @@ -14,7 +14,7 @@ CREATE TABLE t1 (a INT, KEY (a) KEY_BLOCK_SIZE=8 ) ENGINE=rocksdb; -#--replace_column 6 # 7 # 10 # 11 # +--replace_column 7 # SHOW KEYS IN t1; DROP TABLE t1; @@ -24,7 +24,7 @@ CREATE TABLE t1 (a INT, KEY ind1(b ASC) KEY_BLOCK_SIZE=0 ) ENGINE=rocksdb; -# --replace_column 6 # 7 # 10 # 11 # +--replace_column 7 # SHOW INDEX IN t1; DROP TABLE t1; @@ -33,7 +33,7 @@ CREATE TABLE t1 (a INT, PRIMARY KEY ind2(b(1) DESC) KEY_BLOCK_SIZE=32768 COMMENT 'big key_block_size value' ) ENGINE=rocksdb; -#--replace_column 6 # 7 # 10 # 11 # +--replace_column 7 # SHOW INDEX IN t1; DROP TABLE t1; @@ -44,11 +44,13 @@ CREATE TABLE t1 (a INT, KEY a_b(a,b) KEY_BLOCK_SIZE=8192 ) ENGINE=rocksdb; -#--replace_column 6 # 7 # 10 # 11 # +--replace_column 7 # SHOW INDEX IN t1; DROP TABLE t1; +--source drop_table_sync.inc + # # ALTER TABLE # @@ -61,6 +63,7 @@ CREATE TABLE t1 (a INT, INSERT INTO t1 (a,b) VALUES (100,'z'); ALTER TABLE t1 ADD KEY(a) KEY_BLOCK_SIZE 8192; +--replace_column 7 # SHOW INDEX FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/rocksdb/t/index_primary-master.opt b/mysql-test/suite/rocksdb/t/index_primary-master.opt deleted file mode 100644 index ba9364e15237..000000000000 --- a/mysql-test/suite/rocksdb/t/index_primary-master.opt +++ /dev/null @@ -1 +0,0 @@ ---rocksdb_debug_optimizer_n_rows=1000 diff --git a/mysql-test/suite/rocksdb/t/index_primary.test b/mysql-test/suite/rocksdb/t/index_primary.test index c8da58a0ee86..83f0b49dd5b9 100644 --- a/mysql-test/suite/rocksdb/t/index_primary.test +++ b/mysql-test/suite/rocksdb/t/index_primary.test @@ -12,6 +12,7 @@ CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8) ) ENGINE=rocksdb; +--replace_column 7 # SHOW KEYS IN t1; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'); @@ -30,6 +31,7 @@ CREATE TABLE t1 (a INT, PRIMARY KEY (a,b) ) ENGINE=rocksdb; +--replace_column 7 # SHOW INDEX IN t1; INSERT INTO t1 (a,b) VALUES (1,'a'),(1,'b'),(2,'a'),(2,'b'); --error ER_DUP_ENTRY @@ -43,6 +45,7 @@ CREATE TABLE t1 (a INT KEY, KEY (b) ) ENGINE=rocksdb; +--replace_column 7 # SHOW INDEX IN t1; DROP TABLE t1; @@ -50,12 +53,14 @@ CREATE TABLE t1 (a INT, b CHAR(8) PRIMARY KEY ) ENGINE=rocksdb; +--replace_column 7 # SHOW INDEX IN t1; --error ER_REQUIRES_PRIMARY_KEY ALTER TABLE t1 DROP INDEX `PRIMARY`; --error ER_MULTIPLE_PRI_KEY ALTER TABLE t1 ADD CONSTRAINT PRIMARY KEY pk (a); +--replace_column 7 # SHOW KEYS IN t1; --error ER_REQUIRES_PRIMARY_KEY ALTER TABLE t1 DROP PRIMARY KEY; diff --git a/mysql-test/suite/rocksdb/t/index_type_btree-master.opt b/mysql-test/suite/rocksdb/t/index_type_btree-master.opt deleted file mode 100644 index ba9364e15237..000000000000 --- a/mysql-test/suite/rocksdb/t/index_type_btree-master.opt +++ /dev/null @@ -1 +0,0 @@ ---rocksdb_debug_optimizer_n_rows=1000 diff --git a/mysql-test/suite/rocksdb/t/index_type_hash-master.opt b/mysql-test/suite/rocksdb/t/index_type_hash-master.opt deleted file mode 100644 index ba9364e15237..000000000000 --- a/mysql-test/suite/rocksdb/t/index_type_hash-master.opt +++ /dev/null @@ -1 +0,0 @@ ---rocksdb_debug_optimizer_n_rows=1000 diff --git a/mysql-test/suite/rocksdb/t/rocksdb.test b/mysql-test/suite/rocksdb/t/rocksdb.test index 4ad8d06a0e5c..ef8c098b028e 100644 --- a/mysql-test/suite/rocksdb/t/rocksdb.test +++ b/mysql-test/suite/rocksdb/t/rocksdb.test @@ -13,6 +13,10 @@ drop table if exists t30,t31,t32,t33,t34,t35,t36,t37,t38,t39; drop table if exists t40,t41,t42,t43,t44,t45,t46,t47,t48,t49; --enable_warnings +# Disable background compaction to prevent stats from affect explain output +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --echo # --echo # Issue #1: Don't update indexes if index values have not changed --echo # @@ -1157,8 +1161,14 @@ create table t1 (i int primary key auto_increment) engine=RocksDB; insert into t1 values (null); insert into t1 values (null); + +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; + --source include/restart_mysqld.inc +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + insert into t1 values (null); select * from t1; @@ -1734,3 +1744,4 @@ update t2 set a=concat('x-', a) where a between 'v-1002' and 'v-1004'; drop table t1,t2; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_binary_indexes.test b/mysql-test/suite/rocksdb/t/type_binary_indexes.test index ad44f478c2cb..f4360ed629be 100644 --- a/mysql-test/suite/rocksdb/t/type_binary_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_binary_indexes.test @@ -10,6 +10,9 @@ # because unique keys are not supported ####################################### +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -93,3 +96,4 @@ SELECT HEX(SUBSTRING(v16,7,3)) FROM t1 FORCE INDEX (v16) WHERE v16 LIKE 'varchar DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_bit_indexes.test b/mysql-test/suite/rocksdb/t/type_bit_indexes.test index f08f20a7d009..e4f4bb81819e 100644 --- a/mysql-test/suite/rocksdb/t/type_bit_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_bit_indexes.test @@ -4,6 +4,9 @@ # BIT columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -107,3 +110,4 @@ DROP TABLE t1; --enable_parsing +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_blob_indexes.test b/mysql-test/suite/rocksdb/t/type_blob_indexes.test index 363ceb534183..fb8e2ee6f422 100644 --- a/mysql-test/suite/rocksdb/t/type_blob_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_blob_indexes.test @@ -4,6 +4,9 @@ # BLOB columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -109,3 +112,4 @@ SELECT SUBSTRING(m,128) AS f FROM t1 IGNORE INDEX FOR ORDER BY (m) WHERE m = 'te DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_char_indexes.test b/mysql-test/suite/rocksdb/t/type_char_indexes.test index 1579cf886b20..6ee2f03e74dc 100644 --- a/mysql-test/suite/rocksdb/t/type_char_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_char_indexes.test @@ -4,6 +4,9 @@ # CHAR and VARCHAR columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -101,3 +104,4 @@ SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_date_time_indexes.test b/mysql-test/suite/rocksdb/t/type_date_time_indexes.test index 65835f944afe..06cf86b7661a 100644 --- a/mysql-test/suite/rocksdb/t/type_date_time_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_date_time_indexes.test @@ -5,6 +5,9 @@ # (DATE, DATETIME, TIMESTAMP, TIME, YEAR) # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -151,3 +154,4 @@ SELECT y, COUNT(*) FROM t1 USE INDEX FOR GROUP BY () GROUP BY y; DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_enum_indexes.test b/mysql-test/suite/rocksdb/t/type_enum_indexes.test index b27e30ffa5d2..d7086a45fe15 100644 --- a/mysql-test/suite/rocksdb/t/type_enum_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_enum_indexes.test @@ -4,6 +4,9 @@ # ENUM columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -87,3 +90,4 @@ SELECT DISTINCT b FROM t1 IGNORE INDEX (b); DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_fixed_indexes.test b/mysql-test/suite/rocksdb/t/type_fixed_indexes.test index 1895d6a4c917..e9e6df58d21a 100644 --- a/mysql-test/suite/rocksdb/t/type_fixed_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_fixed_indexes.test @@ -4,6 +4,9 @@ # Fixed point columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -101,3 +104,4 @@ SELECT d2, COUNT(*) FROM t1 IGNORE INDEX FOR GROUP BY (d2) GROUP BY d2; DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_float_indexes.test b/mysql-test/suite/rocksdb/t/type_float_indexes.test index 9693b3656342..907bc614d499 100644 --- a/mysql-test/suite/rocksdb/t/type_float_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_float_indexes.test @@ -4,6 +4,9 @@ # Float type columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -168,3 +171,5 @@ EXPLAIN SELECT DISTINCT f FROM t1 ORDER BY f; SELECT DISTINCT f FROM t1 ORDER BY f; DROP TABLE t1; + +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_int_indexes.test b/mysql-test/suite/rocksdb/t/type_int_indexes.test index 3889ba89e507..c95c3d88b8a0 100644 --- a/mysql-test/suite/rocksdb/t/type_int_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_int_indexes.test @@ -4,6 +4,9 @@ # INT column types with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -69,3 +72,4 @@ DROP TABLE t1; ##--enable_parsing +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_set_indexes.test b/mysql-test/suite/rocksdb/t/type_set_indexes.test index a79f9a5c87b2..79232255d255 100644 --- a/mysql-test/suite/rocksdb/t/type_set_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_set_indexes.test @@ -4,6 +4,9 @@ # SET columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -98,3 +101,4 @@ DROP TABLE t1; --enable_parsing +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/mysql-test/suite/rocksdb/t/type_text_indexes.test b/mysql-test/suite/rocksdb/t/type_text_indexes.test index f31dfe6cf423..a0daea9b96cc 100644 --- a/mysql-test/suite/rocksdb/t/type_text_indexes.test +++ b/mysql-test/suite/rocksdb/t/type_text_indexes.test @@ -4,6 +4,9 @@ # TEXT columns with indexes # +SET @ORIG_PAUSE_BACKGROUND_WORK = @@ROCKSDB_PAUSE_BACKGROUND_WORK; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = 1; + --disable_warnings DROP TABLE IF EXISTS t1; --enable_warnings @@ -107,3 +110,4 @@ SELECT SUBSTRING(m,128) AS f FROM t1 WHERE m = 'test1' ORDER BY f DESC; DROP TABLE t1; +SET GLOBAL ROCKSDB_PAUSE_BACKGROUND_WORK = @ORIG_PAUSE_BACKGROUND_WORK; diff --git a/rocksdb b/rocksdb index 84f98792d6e0..7b12ae97d429 160000 --- a/rocksdb +++ b/rocksdb @@ -1 +1 @@ -Subproject commit 84f98792d6e0747c79bf21bb6b212caca53509d6 +Subproject commit 7b12ae97d4293c74f435e8b1f81d1a06492685cc diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index c20e2d4ba762..613b4c3b6145 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -1096,7 +1096,6 @@ class Rdb_CompactionFilter : public rocksdb::CompactionFilter explicit Rdb_CompactionFilter(uint32_t _cf_id) : cf_id(_cf_id) {} ~Rdb_CompactionFilter() { - print_compaction_status(); } // keys are passed in sorted order within the same sst. @@ -1120,7 +1119,6 @@ class Rdb_CompactionFilter : public rocksdb::CompactionFilter { if (num_deleted > 0) { - print_compaction_status(); num_deleted= 0; } should_delete= dict_manager.is_drop_index_ongoing(gl_index_id); @@ -1133,17 +1131,12 @@ class Rdb_CompactionFilter : public rocksdb::CompactionFilter return should_delete; } + virtual bool IgnoreSnapshots() const override { return true; } + virtual const char* Name() const override { return "Rdb_CompactionFilter"; } private: - void print_compaction_status() const - { - if (num_deleted > 0) - sql_print_information("RocksDB: Compacting away elements from dropped " - "index (%u,%u): %llu", prev_index.cf_id, - prev_index.index_id, num_deleted); - } // Column family for this compaction filter const uint32_t cf_id; @@ -5684,7 +5677,8 @@ int ha_rocksdb::info(uint flag) 0; if (x > stats.records) x = stats.records; - if (x == 0 && rocksdb_debug_optimizer_no_zero_cardinality) + if ((x == 0 && rocksdb_debug_optimizer_no_zero_cardinality) || + rocksdb_debug_optimizer_n_rows > 0) { // Fake cardinality implementation. For example, (idx1, idx2, idx3) index // will have rec_per_key for (idx1)=4, (idx1,2)=2, and (idx1,2,3)=1. @@ -6031,21 +6025,28 @@ int ha_rocksdb::start_stmt(THD *thd, thr_lock_type lock_type) return 0; } -static rocksdb::Range get_range( - RDBSE_KEYDEF* keydef, - uchar buf[RDBSE_KEYDEF::INDEX_NUMBER_SIZE*2], - int offset1, int offset2) +rocksdb::Range get_range( + uint32_t i, uchar buf[RDBSE_KEYDEF::INDEX_NUMBER_SIZE*2], int offset1, + int offset2) { uchar* buf_begin = buf; uchar* buf_end = buf+RDBSE_KEYDEF::INDEX_NUMBER_SIZE; - store_index_number(buf_begin, keydef->get_index_number() + offset1); - store_index_number(buf_end, keydef->get_index_number() + offset2); + store_index_number(buf_begin, i + offset1); + store_index_number(buf_end, i + offset2); return rocksdb::Range( rocksdb::Slice((const char*) buf_begin, RDBSE_KEYDEF::INDEX_NUMBER_SIZE), rocksdb::Slice((const char*) buf_end, RDBSE_KEYDEF::INDEX_NUMBER_SIZE)); } +static rocksdb::Range get_range( + RDBSE_KEYDEF* keydef, + uchar buf[RDBSE_KEYDEF::INDEX_NUMBER_SIZE*2], + int offset1, int offset2) +{ + return get_range(keydef->get_index_number(), buf, offset1, offset2); +} + rocksdb::Range get_range( RDBSE_KEYDEF* keydef, uchar buf[RDBSE_KEYDEF::INDEX_NUMBER_SIZE*2]) { @@ -6120,13 +6121,30 @@ void* drop_index_thread(void*) rocksdb::ColumnFamilyHandle* cfh= cf_manager.get_cf(d.cf_id); DBUG_ASSERT(cfh); bool is_reverse_cf= cf_flags & RDBSE_KEYDEF::REVERSE_CF_FLAG; - std::unique_ptr it( - rdb->NewIterator(read_opts, cfh)); bool index_removed= false; uchar key_buf[RDBSE_KEYDEF::INDEX_NUMBER_SIZE]= {0}; store_big_uint4(key_buf, d.index_id); rocksdb::Slice key = rocksdb::Slice((char*)key_buf, sizeof(key_buf)); + uchar buf[RDBSE_KEYDEF::INDEX_NUMBER_SIZE*2]; + rocksdb::Range range = get_range(d.index_id, buf, is_reverse_cf?1:0, + is_reverse_cf?0:1); + rocksdb::CompactRangeOptions compact_range_options; + compact_range_options.bottommost_level_compaction = + rocksdb::BottommostLevelCompaction::kForce; + compact_range_options.exclusive_manual_compaction = false; + rocksdb::Status status = rdb->CompactRange( + compact_range_options, cfh, &range.start, &range.limit); + if (!status.ok()) + { + if (status.IsShutdownInProgress()) + { + break; + } + rocksdb_handle_io_error(status, ROCKSDB_IO_ERROR_BG_THREAD); + } + std::unique_ptr it( + rdb->NewIterator(read_opts, cfh)); it->Seek(key); if (is_reverse_cf) { @@ -6147,6 +6165,7 @@ void* drop_index_thread(void*) { if (memcmp(it->key().data(), key_buf, RDBSE_KEYDEF::INDEX_NUMBER_SIZE)) { + // Key does not have same prefix index_removed= true; } }