Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Skip transaction api for replication threads
Summary: Replication threads are guaranteed to run only the transactions in parallel that are not conflicting. This enables us to enhance performance by using simple rocksdb write batches. This diff makes the following changes: A base class Rdb_transaction is created which handles transaction connection to rocksdb. Moved the current Rdb_transaction class to Rdb_transaction_impl which uses rocksdb tx api. Created a new class Rdb_writebatch_impl using rocksdb write batches. Test Plan: Enabled rpl_skip_tx_api by default here to make sure we run all the tests in new mode. Will add a test running replication along with some conflicting delete queries. Performance testing showed 50% improvemen in replication thread write rate. Reviewers: yoshinorim, horuff, jkedgar, hermanlee4 Reviewed By: hermanlee4 Subscribers: vasilep, webscalesql-eng Differential Revision: https://reviews.facebook.net/D60921
- Loading branch information
1 parent
2f5848e
commit cd14963
Showing
7 changed files
with
672 additions
and
296 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
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
68 changes: 68 additions & 0 deletions
68
mysql-test/suite/rocksdb_sys_vars/r/rocksdb_rpl_skip_tx_api_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,68 @@ | ||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
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)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
SET @start_global_value = @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
1 | ||
'# Setting to valid values in global scope#' | ||
"Trying to set variable @@global.ROCKSDB_RPL_SKIP_TX_API to 1" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = 1; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = DEFAULT; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
"Trying to set variable @@global.ROCKSDB_RPL_SKIP_TX_API to 0" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = 0; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = DEFAULT; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
"Trying to set variable @@global.ROCKSDB_RPL_SKIP_TX_API to on" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = on; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = DEFAULT; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
"Trying to set variable @@global.ROCKSDB_RPL_SKIP_TX_API to off" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = off; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = DEFAULT; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
"Trying to set variable @@session.ROCKSDB_RPL_SKIP_TX_API to 444. It should fail because it is not session." | ||
SET @@session.ROCKSDB_RPL_SKIP_TX_API = 444; | ||
ERROR HY000: Variable 'rocksdb_rpl_skip_tx_api' is a GLOBAL variable and should be set with SET GLOBAL | ||
'# Testing with invalid values in global scope #' | ||
"Trying to set variable @@global.ROCKSDB_RPL_SKIP_TX_API to 'aaa'" | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = 'aaa'; | ||
Got one of the listed errors | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
SET @@global.ROCKSDB_RPL_SKIP_TX_API = @start_global_value; | ||
SELECT @@global.ROCKSDB_RPL_SKIP_TX_API; | ||
@@global.ROCKSDB_RPL_SKIP_TX_API | ||
1 | ||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
18 changes: 18 additions & 0 deletions
18
mysql-test/suite/rocksdb_sys_vars/t/rocksdb_rpl_skip_tx_api_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,18 @@ | ||
--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(0); | ||
INSERT INTO valid_values VALUES('on'); | ||
INSERT INTO valid_values VALUES('off'); | ||
|
||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
|
||
--let $sys_var=ROCKSDB_RPL_SKIP_TX_API | ||
--let $read_only=0 | ||
--let $session=0 | ||
--source suite/sys_vars/inc/rocksdb_sys_var.inc | ||
|
||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
Oops, something went wrong.