forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issues 1200 and 1295, add rocksdb_compact_lzero_now global variab…
…le (facebook#1309) Summary: This fixes issue 1295 and has a workaround for issue 1200. facebook#1200 facebook#1295 The fix for issue 1295 is to get the value of the base level from RocksDB rather than assuming that L0 compacts into L1 because L1 might not be the base level when dynamic leveled compaction is used -- in that case the base level can be Ln where n > 1 because L1 isn't needed yet. There are two workarounds for issue 1200. The hacky one is to sleep for 1 second between requesting memtable flush and L0 -> base_level compaction. The alternative is to add a new global variable, rocksdb_compact_lzero_now, that when set will request L0 -> base_level compaction. This allows a client to first set rocksdb_force_flush_memtable_now, wait for that to finish, then set rocksdb_compact_lzero_now. Other changes: * rocksdb_force_flush_memtable_now default value changed to OFF to match what is done for rocksdb_force_flush_memtable_and_lzero_now and rocksdb_compact_lzero_now * confirm that the value to which these variables are set can be parsed, that wasn't done for all of them * don't raise an error when these are set to OFF, that will be a no-op Note: these variables are triggers, an action is taken when this is done: set global var = ON | true | 1 But these variables always show the value 0 (OFF, false). Their value doesn't change. Pull Request resolved: facebook#1309 Differential Revision: D45789784
- Loading branch information
Showing
9 changed files
with
278 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
mysql-test/suite/rocksdb_sys_vars/r/rocksdb_compact_lzero_now_basic.result
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO valid_values VALUES(1); | ||
INSERT INTO valid_values VALUES('on'); | ||
INSERT INTO valid_values VALUES('true'); | ||
INSERT INTO valid_values VALUES(0); | ||
INSERT INTO valid_values VALUES('off'); | ||
INSERT INTO valid_values VALUES('false'); | ||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
SET @start_global_value = @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
0 | ||
'# Setting to valid values in global scope#' | ||
"Trying to set variable @@global.ROCKSDB_COMPACT_LZERO_NOW to 1" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = 1; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMPACT_LZERO_NOW to on" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = on; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMPACT_LZERO_NOW to true" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = true; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMPACT_LZERO_NOW to 0" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = 0; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMPACT_LZERO_NOW to off" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = off; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMPACT_LZERO_NOW to false" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = false; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
"Trying to set variable @@session.ROCKSDB_COMPACT_LZERO_NOW to 444. It should fail because it is not session." | ||
SET @@session.ROCKSDB_COMPACT_LZERO_NOW = 444; | ||
ERROR HY000: Variable 'rocksdb_compact_lzero_now' is a GLOBAL variable and should be set with SET GLOBAL | ||
'# Testing with invalid values in global scope #' | ||
SET @@global.ROCKSDB_COMPACT_LZERO_NOW = @start_global_value; | ||
SELECT @@global.ROCKSDB_COMPACT_LZERO_NOW; | ||
@@global.ROCKSDB_COMPACT_LZERO_NOW | ||
0 | ||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
mysql-test/suite/rocksdb_sys_vars/t/rocksdb_compact_lzero_now_basic.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--source include/have_rocksdb.inc | ||
|
||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO valid_values VALUES(1); | ||
INSERT INTO valid_values VALUES('on'); | ||
INSERT INTO valid_values VALUES('true'); | ||
INSERT INTO valid_values VALUES(0); | ||
INSERT INTO valid_values VALUES('off'); | ||
INSERT INTO valid_values VALUES('false'); | ||
|
||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
|
||
--let $sys_var=ROCKSDB_COMPACT_LZERO_NOW | ||
--let $read_only=0 | ||
--let $session=0 | ||
--let $sticky=1 | ||
--source ../include/rocksdb_sys_var.inc | ||
|
||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.