You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
Similar to what was done in D49035, a new sysvar was added called `gap_lock_exceptions` that takes a comma separated list of regexes that specify which tables should skip gap lock detection. If it is skipped, then we do not raise errors, and we do not log to the gaplock log.
In order to do this, I've moved some logic from the collations check to `sql/handler.cc`. I've also made changes the mutex that protected the table list into a rwlock.
Fixes#232
Test Plan: mtr
Reviewers: yoshinorim, hermanlee4, jkedgar
Reviewed By: jkedgar
Subscribers: webscalesql-eng
Differential Revision: https://reviews.facebook.net/D56937
insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
415
+
create table gap4 (
416
+
pk int primary key,
417
+
a int,
418
+
b int,
419
+
key(a)
420
+
) ENGINE=innodb;
421
+
insert into gap4 values (1,1,1), (2,2,2), (3,3,3), (4,4,4);
422
+
create table gap5 like gap4;
423
+
insert into gap5 values (1,1,1), (2,2,2), (3,3,3), (4,4,4);
424
+
set session gap_lock_raise_error=1;
425
+
set session gap_lock_write_log=1;
426
+
set session autocommit=0;
427
+
select * from gap1 limit 1 for update;
428
+
ERROR HY000: Using Gap Lock without full primary key in multi-table or multi-statement transactions is not allowed. You need either 1: Execute 'SET SESSION gap_lock_raise_error=0' if you are sure that your application does not rely on Gap Lock. 2: Rewrite queries to use all primary key columns in WHERE equal conditions. 3: Rewrite to single-table, single-statement transaction. Query: select * from gap1 limit 1 for update
429
+
select * from gap1 where value != 100 limit 1 for update;
430
+
ERROR HY000: Using Gap Lock without full primary key in multi-table or multi-statement transactions is not allowed. You need either 1: Execute 'SET SESSION gap_lock_raise_error=0' if you are sure that your application does not rely on Gap Lock. 2: Rewrite queries to use all primary key columns in WHERE equal conditions. 3: Rewrite to single-table, single-statement transaction. Query: select * from gap1 where value != 100 limit 1 for update
431
+
set global gap_lock_write_log= 0;
432
+
set global gap_lock_raise_error= 0;
433
+
drop table if exists gap1, gap2, gap3, gap4, gap5;
insert into gap3 values (1,1), (2,2),(3,3),(4,4),(5,5);
415
+
create table gap4 (
416
+
pk int primary key,
417
+
a int,
418
+
b int,
419
+
key(a)
420
+
) ENGINE=rocksdb;
421
+
insert into gap4 values (1,1,1), (2,2,2), (3,3,3), (4,4,4);
422
+
create table gap5 like gap4;
423
+
insert into gap5 values (1,1,1), (2,2,2), (3,3,3), (4,4,4);
424
+
set session gap_lock_raise_error=1;
425
+
set session gap_lock_write_log=1;
426
+
set session autocommit=0;
427
+
select * from gap1 limit 1 for update;
428
+
ERROR HY000: Using Gap Lock without full primary key in multi-table or multi-statement transactions is not allowed. You need either 1: Execute 'SET SESSION gap_lock_raise_error=0' if you are sure that your application does not rely on Gap Lock. 2: Rewrite queries to use all primary key columns in WHERE equal conditions. 3: Rewrite to single-table, single-statement transaction. Query: select * from gap1 limit 1 for update
429
+
select * from gap1 where value != 100 limit 1 for update;
430
+
ERROR HY000: Using Gap Lock without full primary key in multi-table or multi-statement transactions is not allowed. You need either 1: Execute 'SET SESSION gap_lock_raise_error=0' if you are sure that your application does not rely on Gap Lock. 2: Rewrite queries to use all primary key columns in WHERE equal conditions. 3: Rewrite to single-table, single-statement transaction. Query: select * from gap1 where value != 100 limit 1 for update
431
+
set global gap_lock_write_log= 0;
432
+
set global gap_lock_raise_error= 0;
433
+
drop table if exists gap1, gap2, gap3, gap4, gap5;
0 commit comments