forked from facebook/mysql-5.6
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Taking row locks with unique_checks = 0
Summary: We should take row locks even with unique checks are disabled. Differential Revision: D24745386
- Loading branch information
1 parent
6a432a7
commit eddb59d
Showing
9 changed files
with
234 additions
and
16 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
32 changes: 32 additions & 0 deletions
32
mysql-test/suite/rocksdb_rpl/r/rocksdb_skip_locks_if_skip_unique_check.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,32 @@ | ||
include/master-slave.inc | ||
Warnings: | ||
Note #### Sending passwords in plain text without SSL/TLS is extremely insecure. | ||
Note #### Storing MySQL user name or password information in the master info repository is not secure and is therefore not recommended. Please consider using the USER and PASSWORD connection options for START SLAVE; see the 'START SLAVE Syntax' in the MySQL Manual for more information. | ||
[connection master] | ||
create table t1 (a int primary key, b int) engine = rocksdb; | ||
set @@unique_checks = 0; | ||
insert into t1 values(1, 1); | ||
insert into t1 values(2, 2); | ||
include/sync_slave_sql_with_master.inc | ||
begin; | ||
update t1 set b = 20 where a = 2; | ||
set @@unique_checks = 0; | ||
insert into t1 values(2, 200); | ||
rollback; | ||
set @@global.rocksdb_skip_locks_if_skip_unique_check = 1; | ||
stop replica; | ||
start replica; | ||
begin; | ||
update t1 set b = 10 where a = 1; | ||
set @@unique_checks = 0; | ||
insert into t1 values(1, 100); | ||
include/sync_slave_sql_with_master.inc | ||
rollback; | ||
select * from t1; | ||
a b | ||
1 100 | ||
2 200 | ||
set @@global.rocksdb_skip_locks_if_skip_unique_check = 0; | ||
drop table t1; | ||
include/sync_slave_sql_with_master.inc | ||
include/rpl_end.inc |
48 changes: 48 additions & 0 deletions
48
mysql-test/suite/rocksdb_rpl/t/rocksdb_skip_locks_if_skip_unique_check.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,48 @@ | ||
source include/master-slave.inc; | ||
source include/have_rocksdb.inc; | ||
|
||
connection master; | ||
create table t1 (a int primary key, b int) engine = rocksdb; | ||
set @@unique_checks = 0; | ||
insert into t1 values(1, 1); | ||
insert into t1 values(2, 2); | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
connection slave; | ||
begin; | ||
update t1 set b = 20 where a = 2; | ||
|
||
connection master; | ||
set @@unique_checks = 0; | ||
insert into t1 values(2, 200); | ||
|
||
connection slave; | ||
let $wait_condition= | ||
select count(*)= 1 from information_schema.processlist | ||
where state = 'Waiting for row lock'; | ||
source include/wait_condition.inc; | ||
rollback; | ||
|
||
|
||
# Now let's check if locks are not taken when # rocksdb_skip_locks_if_skip_unique_check is enabled | ||
connection slave; | ||
set @@global.rocksdb_skip_locks_if_skip_unique_check = 1; | ||
stop replica; start replica; | ||
begin; | ||
update t1 set b = 10 where a = 1; | ||
|
||
connection master; | ||
set @@unique_checks = 0; | ||
insert into t1 values(1, 100); | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
connection slave; | ||
rollback; | ||
select * from t1; | ||
set @@global.rocksdb_skip_locks_if_skip_unique_check = 0; | ||
|
||
connection master; | ||
drop table t1; | ||
source include/sync_slave_sql_with_master.inc; | ||
|
||
source include/rpl_end.inc; |
100 changes: 100 additions & 0 deletions
100
mysql-test/suite/rocksdb_sys_vars/r/rocksdb_skip_locks_if_skip_unique_check_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,100 @@ | ||
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'); | ||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
INSERT INTO invalid_values VALUES('\'bbb\''); | ||
SET @start_global_value = @@global.ROCKSDB_BULK_LOAD; | ||
SELECT @start_global_value; | ||
@start_global_value | ||
0 | ||
SET @start_session_value = @@session.ROCKSDB_BULK_LOAD; | ||
SELECT @start_session_value; | ||
@start_session_value | ||
0 | ||
'# Setting to valid values in global scope#' | ||
"Trying to set variable @@global.ROCKSDB_BULK_LOAD to 1" | ||
SET @@global.ROCKSDB_BULK_LOAD = 1; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
1 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_BULK_LOAD = DEFAULT; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_BULK_LOAD to 0" | ||
SET @@global.ROCKSDB_BULK_LOAD = 0; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_BULK_LOAD = DEFAULT; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_BULK_LOAD to on" | ||
SET @@global.ROCKSDB_BULK_LOAD = on; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
1 | ||
"Setting the global scope variable back to default" | ||
SET @@global.ROCKSDB_BULK_LOAD = DEFAULT; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
'# Setting to valid values in session scope#' | ||
"Trying to set variable @@session.ROCKSDB_BULK_LOAD to 1" | ||
SET @@session.ROCKSDB_BULK_LOAD = 1; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
1 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_BULK_LOAD = DEFAULT; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
0 | ||
"Trying to set variable @@session.ROCKSDB_BULK_LOAD to 0" | ||
SET @@session.ROCKSDB_BULK_LOAD = 0; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
0 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_BULK_LOAD = DEFAULT; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
0 | ||
"Trying to set variable @@session.ROCKSDB_BULK_LOAD to on" | ||
SET @@session.ROCKSDB_BULK_LOAD = on; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
1 | ||
"Setting the session scope variable back to default" | ||
SET @@session.ROCKSDB_BULK_LOAD = DEFAULT; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
0 | ||
'# Testing with invalid values in global scope #' | ||
"Trying to set variable @@global.ROCKSDB_BULK_LOAD to 'aaa'" | ||
SET @@global.ROCKSDB_BULK_LOAD = 'aaa'; | ||
Got one of the listed errors | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
"Trying to set variable @@global.ROCKSDB_BULK_LOAD to 'bbb'" | ||
SET @@global.ROCKSDB_BULK_LOAD = 'bbb'; | ||
Got one of the listed errors | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
SET @@global.ROCKSDB_BULK_LOAD = @start_global_value; | ||
SELECT @@global.ROCKSDB_BULK_LOAD; | ||
@@global.ROCKSDB_BULK_LOAD | ||
0 | ||
SET @@session.ROCKSDB_BULK_LOAD = @start_session_value; | ||
SELECT @@session.ROCKSDB_BULK_LOAD; | ||
@@session.ROCKSDB_BULK_LOAD | ||
0 | ||
DROP TABLE valid_values; | ||
DROP TABLE invalid_values; |
18 changes: 18 additions & 0 deletions
18
mysql-test/suite/rocksdb_sys_vars/t/rocksdb_skip_locks_if_skip_unique_check_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'); | ||
|
||
CREATE TABLE invalid_values (value varchar(255)) ENGINE=myisam; | ||
INSERT INTO invalid_values VALUES('\'aaa\''); | ||
INSERT INTO invalid_values VALUES('\'bbb\''); | ||
|
||
--let $sys_var=ROCKSDB_BULK_LOAD | ||
--let $read_only=0 | ||
--let $session=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