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.
Add rocksdb transaction options for write policy and commit time writ…
…ebatch Summary: This adds two sysvars for MyRocks that controls rocksdb transactions: TransactionDBOptions::write_policy - This is a read only variable that determines when data is written into the database. The default is COMMITTED which means data is written at commit time. TransactionOptions::use_only_the_last_commit_time_batch_for_recovery - This is a dynamic variable that determines whether the commit time write batch is written into the database or not. If the commit time write batch is only useful for recovery, writting to WAL is enough. Differential Revision: D6905729 (facebook@ad6a74d) fbshipit-source-id: ac183b6378d
- Loading branch information
Showing
6 changed files
with
197 additions
and
0 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
121 changes: 121 additions & 0 deletions
121
mysql-test/suite/rocksdb_sys_vars/r/rocksdb_commit_time_batch_for_recovery_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,121 @@ | ||
CREATE TABLE valid_values (value varchar(255)); | ||
INSERT INTO valid_values VALUES(1); | ||
INSERT INTO valid_values VALUES(0); | ||
INSERT INTO valid_values VALUES('on'); | ||
INSERT INTO valid_values VALUES('off'); | ||
CREATE TABLE invalid_values (value varchar(255)); | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
INSERT INTO invalid_values VALUES('\'bbb\''); | ||
SET @start_global_value = @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
0 | ||
SET @start_session_value = @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
SELECT @start_session_value; | ||
@start_session_value | ||
0 | ||
'# Setting to valid values in global scope#' | ||
"Trying to set variable @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to 1" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = 1; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
1 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to 0" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = 0; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to on" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = on; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
1 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to off" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = off; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
'# Setting to valid values in session scope#' | ||
"Trying to set variable @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to 1" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = 1; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
1 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to 0" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = 0; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to on" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = on; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
1 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to off" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = off; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = DEFAULT; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
'# Testing with invalid values in global scope #' | ||
"Trying to set variable @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to 'aaa'" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = 'aaa'; | ||
Got one of the listed errors | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY to 'bbb'" | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = 'bbb'; | ||
Got one of the listed errors | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
SET @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = @start_global_value; | ||
SELECT @@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@global.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
SET @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY = @start_session_value; | ||
SELECT @@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY; | ||
@@session.ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
0 | ||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
15 changes: 15 additions & 0 deletions
15
mysql-test/suite/rocksdb_sys_vars/r/rocksdb_write_policy_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,15 @@ | ||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO valid_values VALUES(2); | ||
INSERT INTO valid_values VALUES(1); | ||
INSERT INTO valid_values VALUES(0); | ||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
SET @start_global_value = @@global.ROCKSDB_WRITE_POLICY; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_WRITE_POLICY to 444. It should fail because it is readonly." | ||
SET @@global.ROCKSDB_WRITE_POLICY = 444; | ||
ERROR HY000: Variable 'rocksdb_write_policy' is a read only variable | ||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
20 changes: 20 additions & 0 deletions
20
mysql-test/suite/rocksdb_sys_vars/t/rocksdb_commit_time_batch_for_recovery_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)); | ||
INSERT INTO valid_values VALUES(1); | ||
INSERT INTO valid_values VALUES(0); | ||
INSERT INTO valid_values VALUES('on'); | ||
INSERT INTO valid_values VALUES('off'); | ||
|
||
CREATE TABLE invalid_values (value varchar(255)); | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
INSERT INTO invalid_values VALUES('\'bbb\''); | ||
|
||
--let $sys_var=ROCKSDB_COMMIT_TIME_BATCH_FOR_RECOVERY | ||
--let $read_only=0 | ||
--let $session=1 | ||
--let $sticky=1 | ||
--source ../include/rocksdb_sys_var.inc | ||
|
||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
17 changes: 17 additions & 0 deletions
17
mysql-test/suite/rocksdb_sys_vars/t/rocksdb_write_policy_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,17 @@ | ||
--source include/have_rocksdb.inc | ||
|
||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO valid_values VALUES(2); | ||
INSERT INTO valid_values VALUES(1); | ||
INSERT INTO valid_values VALUES(0); | ||
|
||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
|
||
--let $sys_var=ROCKSDB_WRITE_POLICY | ||
--let $read_only=1 | ||
--let $session=0 | ||
--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