DROP TABLE IF EXISTS t1;
connect  con1,localhost,root,,;
connect  con2,localhost,root,,;
connection con1;
CREATE TABLE t1 (id INT, value int, PRIMARY KEY (id), INDEX (value)) ENGINE=RocksDB;
INSERT INTO t1 VALUES (1,1);
select variable_value into @p from information_schema.global_status where variable_name='rocksdb_number_sst_entry_put';
select variable_value into @s from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete';
START TRANSACTION WITH CONSISTENT SNAPSHOT;
connection con2;
connection con1;
select case when variable_value-@p < 1000 then 'true' else variable_value-@p end from information_schema.global_status where variable_name='rocksdb_number_sst_entry_put';
case when variable_value-@p < 1000 then 'true' else variable_value-@p end
true
select case when variable_value-@s < 100 then 'true' else variable_value-@s end from information_schema.global_status where variable_name='rocksdb_number_sst_entry_singledelete';
case when variable_value-@s < 100 then 'true' else variable_value-@s end
true
SELECT * FROM t1;
id	value
1	1
INSERT INTO t1 values (2, 2);
ERROR HY000: Can't execute updates when you started a transaction with START TRANSACTION WITH CONSISTENT [ROCKSDB] SNAPSHOT.
ROLLBACK;
SELECT * FROM t1;
id	value
1	10001
INSERT INTO t1 values (2, 2);
SELECT * FROM t1 ORDER BY id;
id	value
1	10001
2	2
BEGIN;
connection con2;
connection con1;
SELECT COUNT(*) FROM t1;
COUNT(*)
9998
COMMIT;
connection default;
disconnect con1;
disconnect con2;
OPTIMIZE TABLE t1;
Table	Op	Msg_type	Msg_text
test.t1	optimize	status	OK
DROP TABLE t1;
reset master;
