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.
Handle large write batch for intrinsic tmp tables
Summary: If the intrinsic tmp tables goes beyond some threshold, then we commit the write batch accumulated so far and start new transaction handling the write batch. **Changes** * Added a variable rocksdb_max_intrinsic_tmp_table_write_count which controls the size of write batch allowed for intrinsic tmp table. Once we cross that threshold, we will commit the current transaction and then start a new transaction. * If there are valid open iterators before we commit intrinsic tmp table transaction, then we refresh all iterators back to previous position after committing transaction. Recursive cte opens multiple iterators for same transaction and we need to refresh all iterators after we commit the current write batch for transaction. * I also refreshed the iterators after the first write to the write batch. This is done to handle the special case where we start rocksdb iterator on new transaction(with empty write batch). Then iterator will only see the already committed data, but ignores any new data added in write batch later. So we are pro-actively refresh the iterator after first write in write batch. * Added a status variable rocksdb_intrinsic_tmp_table_commits to count number of intrinsic tmp table commits. * create_ondisk_from_heap method uses table->record[1] for insertion. Myrocks encode_value_slice relies on table->record[0] for value encoding. We have reposition the fields in write_row specifically for intrinsic tmp table to point to record[1]. Better way to fix this is to remove the dependency on record[1] from encode_value_slice method and add dependency on input buf from write_row. Reviewed By: luqun Differential Revision: D37835016 --------------------------------------------------------------------------------------- Temporarily disable some of rocksdb.tmp_table test Summary: RocksDB tmp table needs bug fixes, and meanwhile disabling some of the rocksdb.tmp_table tests so that it won't report failures. Reviewed By: lth Differential Revision: D41391615 --------------------------------------------------------------------------------------- set m_read_opts.ignore_range_deletions properly (facebook#1218) Summary: ignore_range_deletions should be set to true when range del is not enabled Pull Request resolved: facebook#1218 Reviewed By: Pushapgl Differential Revision: D39115879 Pulled By: yoshinorim
- Loading branch information
Showing
16 changed files
with
443 additions
and
166 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
[innodb_intrinsic_table] | ||
enable_rocksdb_intrinsic_tmp_table= OFF | ||
loose-rocksdb_enable_tmp_table = OFF | ||
loose-rocksdb_enable_tmp_table= OFF | ||
|
||
[rocksdb_intrinsic_table] | ||
enable_rocksdb_intrinsic_tmp_table= ON | ||
loose-rocksdb_enable_tmp_table = ON | ||
loose-rocksdb_enable_delete_range_for_drop_index = ON | ||
loose-rocksdb_enable_tmp_table= ON | ||
loose-rocksdb_enable_delete_range_for_drop_index= ON | ||
loose-rocksdb_max_intrinsic_tmp_table_write_count= 3 |
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
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
46 changes: 46 additions & 0 deletions
46
mysql-test/suite/rocksdb_sys_vars/r/rocksdb_max_intrinsic_tmp_table_write_count_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,46 @@ | ||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO valid_values VALUES(10); | ||
INSERT INTO valid_values VALUES(20); | ||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
SET @start_global_value = @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
1000 | ||
'# Setting to valid values in global scope#' | ||
"Trying to set variable @@global.rocksdb_max_intrinsic_tmp_table_write_count to 10" | ||
SET @@global.rocksdb_max_intrinsic_tmp_table_write_count = 10; | ||
SELECT @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
@@global.rocksdb_max_intrinsic_tmp_table_write_count | ||
10 | ||
"Setting the global scope variable back to default" | ||
SET @@global.rocksdb_max_intrinsic_tmp_table_write_count = DEFAULT; | ||
SELECT @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
@@global.rocksdb_max_intrinsic_tmp_table_write_count | ||
1000 | ||
"Trying to set variable @@global.rocksdb_max_intrinsic_tmp_table_write_count to 20" | ||
SET @@global.rocksdb_max_intrinsic_tmp_table_write_count = 20; | ||
SELECT @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
@@global.rocksdb_max_intrinsic_tmp_table_write_count | ||
20 | ||
"Setting the global scope variable back to default" | ||
SET @@global.rocksdb_max_intrinsic_tmp_table_write_count = DEFAULT; | ||
SELECT @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
@@global.rocksdb_max_intrinsic_tmp_table_write_count | ||
1000 | ||
"Trying to set variable @@session.rocksdb_max_intrinsic_tmp_table_write_count to 444. It should fail because it is not session." | ||
SET @@session.rocksdb_max_intrinsic_tmp_table_write_count = 444; | ||
ERROR HY000: Variable 'rocksdb_max_intrinsic_tmp_table_write_count' is a GLOBAL variable and should be set with SET GLOBAL | ||
'# Testing with invalid values in global scope #' | ||
"Trying to set variable @@global.rocksdb_max_intrinsic_tmp_table_write_count to 'aaa'" | ||
SET @@global.rocksdb_max_intrinsic_tmp_table_write_count = 'aaa'; | ||
Got one of the listed errors | ||
SELECT @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
@@global.rocksdb_max_intrinsic_tmp_table_write_count | ||
1000 | ||
SET @@global.rocksdb_max_intrinsic_tmp_table_write_count = @start_global_value; | ||
SELECT @@global.rocksdb_max_intrinsic_tmp_table_write_count; | ||
@@global.rocksdb_max_intrinsic_tmp_table_write_count | ||
1000 | ||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
16 changes: 16 additions & 0 deletions
16
mysql-test/suite/rocksdb_sys_vars/t/rocksdb_max_intrinsic_tmp_table_write_count_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,16 @@ | ||
--source include/have_rocksdb.inc | ||
|
||
CREATE TABLE valid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO valid_values VALUES(10); | ||
INSERT INTO valid_values VALUES(20); | ||
|
||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
|
||
--let $sys_var=rocksdb_max_intrinsic_tmp_table_write_count | ||
--let $read_only=0 | ||
--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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--loose-rocksdb_max_intrinsic_tmp_table_write_count=1000000 |
Oops, something went wrong.