Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
MDEV-15822: WSREP: BF lock wait long for trx
In Galera BF (brute force) transactions may not wait for lock requests and normally BF-transaction would select transaction holding conflicting locks as a victim for rollback. However, background statistic calculation transaction is InnoDB internal transaction and it has no thd i.e. it can't be selected as a victim. If background statistics calculation transaction holds conflicting locks to statistics tables it will cause BF lock wait long error message. Correct way to handle background statistics calculation is to acquire thd for transaction but that change is too big for GA-releases and there are other reported problems on background statistics calculation. This fix avoids adding a table to background statistics calculation if
- Loading branch information
Jan Lindström
committed
Jul 25, 2018
1 parent
a0d33dc
commit 57cde8c
Showing
4 changed files
with
167 additions
and
3 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 |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| SELECT @@innodb_stats_persistent; | ||
| @@innodb_stats_persistent | ||
| 1 | ||
| CREATE TABLE t1 (f1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, f2 INTEGER DEFAULT NULL) ENGINE=InnoDB; | ||
| INSERT INTO t1(f1) values (NULL); | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| SELECT count(1) from t1; | ||
| count(1) | ||
| 16384 | ||
| SET AUTOCOMMIT=OFF; | ||
| INSERT INTO t1 VALUES (9999999,NULL); | ||
| SELECT SLEEP(1000);; | ||
| ALTER TABLE t1 CHANGE f2 f2 INTEGER NOT NULL DEFAULT 1; | ||
| Warnings: | ||
| Warning 1265 Data truncated for column 'f2' at row 1 | ||
| Warning 1265 Data truncated for column 'f2' at row 2 | ||
| Warning 1265 Data truncated for column 'f2' at row 3 | ||
| Warning 1265 Data truncated for column 'f2' at row 4 | ||
| Warning 1265 Data truncated for column 'f2' at row 5 | ||
| Warning 1265 Data truncated for column 'f2' at row 6 | ||
| Warning 1265 Data truncated for column 'f2' at row 7 | ||
| Warning 1265 Data truncated for column 'f2' at row 8 | ||
| Warning 1265 Data truncated for column 'f2' at row 9 | ||
| Warning 1265 Data truncated for column 'f2' at row 10 | ||
| Warning 1265 Data truncated for column 'f2' at row 11 | ||
| Warning 1265 Data truncated for column 'f2' at row 12 | ||
| Warning 1265 Data truncated for column 'f2' at row 13 | ||
| Warning 1265 Data truncated for column 'f2' at row 14 | ||
| Warning 1265 Data truncated for column 'f2' at row 15 | ||
| Warning 1265 Data truncated for column 'f2' at row 16 | ||
| Warning 1265 Data truncated for column 'f2' at row 17 | ||
| Warning 1265 Data truncated for column 'f2' at row 18 | ||
| Warning 1265 Data truncated for column 'f2' at row 19 | ||
| Warning 1265 Data truncated for column 'f2' at row 20 | ||
| Warning 1265 Data truncated for column 'f2' at row 21 | ||
| Warning 1265 Data truncated for column 'f2' at row 22 | ||
| Warning 1265 Data truncated for column 'f2' at row 23 | ||
| Warning 1265 Data truncated for column 'f2' at row 24 | ||
| Warning 1265 Data truncated for column 'f2' at row 25 | ||
| Warning 1265 Data truncated for column 'f2' at row 26 | ||
| Warning 1265 Data truncated for column 'f2' at row 27 | ||
| Warning 1265 Data truncated for column 'f2' at row 28 | ||
| Warning 1265 Data truncated for column 'f2' at row 29 | ||
| Warning 1265 Data truncated for column 'f2' at row 30 | ||
| Warning 1265 Data truncated for column 'f2' at row 31 | ||
| Warning 1265 Data truncated for column 'f2' at row 32 | ||
| Warning 1265 Data truncated for column 'f2' at row 33 | ||
| Warning 1265 Data truncated for column 'f2' at row 34 | ||
| Warning 1265 Data truncated for column 'f2' at row 35 | ||
| Warning 1265 Data truncated for column 'f2' at row 36 | ||
| Warning 1265 Data truncated for column 'f2' at row 37 | ||
| Warning 1265 Data truncated for column 'f2' at row 38 | ||
| Warning 1265 Data truncated for column 'f2' at row 39 | ||
| Warning 1265 Data truncated for column 'f2' at row 40 | ||
| Warning 1265 Data truncated for column 'f2' at row 41 | ||
| Warning 1265 Data truncated for column 'f2' at row 42 | ||
| Warning 1265 Data truncated for column 'f2' at row 43 | ||
| Warning 1265 Data truncated for column 'f2' at row 44 | ||
| Warning 1265 Data truncated for column 'f2' at row 45 | ||
| Warning 1265 Data truncated for column 'f2' at row 46 | ||
| Warning 1265 Data truncated for column 'f2' at row 47 | ||
| Warning 1265 Data truncated for column 'f2' at row 48 | ||
| Warning 1265 Data truncated for column 'f2' at row 49 | ||
| Warning 1265 Data truncated for column 'f2' at row 50 | ||
| Warning 1265 Data truncated for column 'f2' at row 51 | ||
| Warning 1265 Data truncated for column 'f2' at row 52 | ||
| Warning 1265 Data truncated for column 'f2' at row 53 | ||
| Warning 1265 Data truncated for column 'f2' at row 54 | ||
| Warning 1265 Data truncated for column 'f2' at row 55 | ||
| Warning 1265 Data truncated for column 'f2' at row 56 | ||
| Warning 1265 Data truncated for column 'f2' at row 57 | ||
| Warning 1265 Data truncated for column 'f2' at row 58 | ||
| Warning 1265 Data truncated for column 'f2' at row 59 | ||
| Warning 1265 Data truncated for column 'f2' at row 60 | ||
| Warning 1265 Data truncated for column 'f2' at row 61 | ||
| Warning 1265 Data truncated for column 'f2' at row 62 | ||
| Warning 1265 Data truncated for column 'f2' at row 63 | ||
| Warning 1265 Data truncated for column 'f2' at row 64 | ||
| ERROR 40001: Deadlock found when trying to get lock; try restarting transaction | ||
| wsrep_local_aborts_increment | ||
| 1 | ||
| DROP TABLE t1; |
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 @@ | ||
| --innodb_stats_persistent=ON |
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,49 @@ | ||
| --source include/galera_cluster.inc | ||
| --source include/have_innodb.inc | ||
|
|
||
| # | ||
| # Test a local transaction being aborted by a slave one while it is running a SLEEP() | ||
| # | ||
|
|
||
| SELECT @@innodb_stats_persistent; | ||
|
|
||
| CREATE TABLE t1 (f1 INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY, f2 INTEGER DEFAULT NULL) ENGINE=InnoDB; | ||
| INSERT INTO t1(f1) values (NULL); | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| INSERT INTO t1(f1) select NULL from t1; | ||
| SELECT count(1) from t1; | ||
|
|
||
| --connection node_2 | ||
| SET AUTOCOMMIT=OFF; | ||
| --let $wsrep_local_bf_aborts_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` | ||
| INSERT INTO t1 VALUES (9999999,NULL); | ||
| --send SELECT SLEEP(1000); | ||
|
|
||
| --connection node_1 | ||
| ALTER TABLE t1 CHANGE f2 f2 INTEGER NOT NULL DEFAULT 1; | ||
|
|
||
| --connection node_2 | ||
| --error ER_LOCK_DEADLOCK | ||
| --reap | ||
|
|
||
| --let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` | ||
|
|
||
| # Check that wsrep_local_bf_aborts has been incremented by exactly 1 | ||
| --disable_query_log | ||
| --eval SELECT $wsrep_local_bf_aborts_after - $wsrep_local_bf_aborts_before = 1 AS wsrep_local_aborts_increment; | ||
| --enable_query_log | ||
|
|
||
| DROP TABLE t1; | ||
|
|
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