Skip to content
Permalink
Browse files
MDEV-7702 Spiral patch 004_mariadb-10.0.15.slave-trx-retry.diff
This is about adding more options to force slave retries

Two new variables has been added:
slave_transaction_retry_errors
- Tells the slave thread to retry transaction for replication when a
  query event returns an error from the provided list. Deadlock and
  elapsed lock wait timeout errors are automatically added to this list
slave-transaction-retry-interval
- Interval of the slave SQL thread will retry a transaction
  in case it failed with a deadlock or elapsed lock wait
  timeout or listed in slave_transaction_retry_errors

Other changes:
- Simplifed code for slave_skip_errors (to be aligned with
  slave_transaction_retry_errors)
- Renamed print_slave_skip_errors() to make_slave_skip_errors_printable()
- Remove printing error from init_slave_skip_errors as my_bitmap_init()
  will do that if needed.
- Generalize has_temporary_error()
  • Loading branch information
montywi committed Dec 3, 2017
1 parent 3907ff2 commit b016e1b
Show file tree
Hide file tree
Showing 13 changed files with 595 additions and 64 deletions.
@@ -1118,8 +1118,19 @@ The following options may be given as the first argument:
(Defaults to on; use --skip-slave-sql-verify-checksum to disable.)
--slave-transaction-retries=#
Number of times the slave SQL thread will retry a
transaction in case it failed with a deadlock or elapsed
lock wait timeout, before giving up and stopping
transaction in case it failed with a deadlock, elapsed
lock wait timeout or listed in
slave_transaction_retry_errors, before giving up and
stopping
--slave-transaction-retry-errors=name
Tells the slave thread to retry transaction for
replication when a query event returns an error from the
provided list. Deadlock and elapsed lock wait timeout
errors are automatically added to this list
--slave-transaction-retry-interval=#
Interval of the slave SQL thread will retry a transaction
in case it failed with a deadlock or elapsed lock wait
timeout or listed in slave_transaction_retry_errors
--slave-type-conversions=name
Set of slave type conversions that are enabled. If the
variable is empty, no conversions are allowed and it is
@@ -1585,9 +1596,11 @@ slave-parallel-mode conservative
slave-parallel-threads 0
slave-parallel-workers 0
slave-run-triggers-for-rbr NO
slave-skip-errors (No default value)
slave-skip-errors OFF
slave-sql-verify-checksum TRUE
slave-transaction-retries 10
slave-transaction-retry-errors 1213,1205
slave-transaction-retry-interval 0
slave-type-conversions
slow-launch-time 2
slow-query-log FALSE
@@ -0,0 +1,21 @@
select @@global.slave_transaction_retry_errors;
@@global.slave_transaction_retry_errors
1213,1205,10,20,400
select @@session.slave_transaction_retry_errors;
ERROR HY000: Variable 'slave_transaction_retry_errors' is a GLOBAL variable
show global variables like 'slave_transaction_retry_errors';
Variable_name Value
slave_transaction_retry_errors 1213,1205,10,20,400
show session variables like 'slave_transaction_retry_errors';
Variable_name Value
slave_transaction_retry_errors 1213,1205,10,20,400
select * from information_schema.global_variables where variable_name='slave_transaction_retry_errors';
VARIABLE_NAME VARIABLE_VALUE
SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400
select * from information_schema.session_variables where variable_name='slave_transaction_retry_errors';
VARIABLE_NAME VARIABLE_VALUE
SLAVE_TRANSACTION_RETRY_ERRORS 1213,1205,10,20,400
set global slave_transaction_retry_errors=1;
ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable
set session slave_transaction_retry_errors=1;
ERROR HY000: Variable 'slave_transaction_retry_errors' is a read only variable
@@ -0,0 +1,126 @@
SET @start_global_value = @@global.slave_transaction_retry_interval;
SELECT @start_global_value;
@start_global_value
0
'#--------------------FN_DYNVARS_149_01-------------------------#'
SET @@global.slave_transaction_retry_interval = 50;
SET @@global.slave_transaction_retry_interval = DEFAULT;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
0
'#--------------------FN_DYNVARS_149_02-------------------------#'
SET @@global.slave_transaction_retry_interval = DEFAULT;
SELECT @@global.slave_transaction_retry_interval = 10;
@@global.slave_transaction_retry_interval = 10
0
'#--------------------FN_DYNVARS_149_03-------------------------#'
SET @@global.slave_transaction_retry_interval = 0;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
0
SET @@global.slave_transaction_retry_interval = 1;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
1
SET @@global.slave_transaction_retry_interval = 15;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
15
SET @@global.slave_transaction_retry_interval = 1024;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
1024
SET @@global.slave_transaction_retry_interval = 2147483648;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '2147483648'
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
3600
SET @@global.slave_transaction_retry_interval = 2147483648*2-1;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295'
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
3600
SET @@global.slave_transaction_retry_interval = 2147483649*2;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967298'
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
3600
SET @@global.slave_transaction_retry_interval = 4294967295;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4294967295'
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
3600
'#--------------------FN_DYNVARS_149_04-------------------------#'
SET @@slave_transaction_retry_interval = 2;
ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
SET @@session.slave_transaction_retry_interval = 3;
ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
SET @@local.slave_transaction_retry_interval = 4;
ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
'#------------------FN_DYNVARS_149_05-----------------------#'
SET @@global.slave_transaction_retry_interval = -1;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '-1'
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
0
SET @@global.slave_transaction_retry_interval = 2147483649*2147483649;
Warnings:
Warning 1292 Truncated incorrect slave_transaction_retry_interval value: '4611686022722355201'
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
3600
SET @@global.slave_transaction_retry_interval = 65530.34;
ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
SET @@global.slave_transaction_retry_interval = '100';
ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
SET @@global.slave_transaction_retry_interval = 7483649.56;
ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
SET @@global.slave_transaction_retry_interval = ON;
ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
SET @@global.slave_transaction_retry_interval = OFF;
ERROR 42000: Incorrect argument type to variable 'slave_transaction_retry_interval'
'#------------------FN_DYNVARS_149_06-----------------------#'
SET @@global.slave_transaction_retry_interval = 3000;
SELECT @@global.slave_transaction_retry_interval = VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME='slave_transaction_retry_interval';
@@global.slave_transaction_retry_interval = VARIABLE_VALUE
1
'#------------------FN_DYNVARS_149_07-----------------------#'
SELECT count(VARIABLE_VALUE)
FROM INFORMATION_SCHEMA.SESSION_VARIABLES
WHERE VARIABLE_NAME='slave_transaction_retry_interval';
count(VARIABLE_VALUE)
1
'#------------------FN_DYNVARS_149_08-----------------------#'
SET @@global.slave_transaction_retry_interval = TRUE;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
1
SET @@global.slave_transaction_retry_interval = FALSE;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
0
'#---------------------FN_DYNVARS_149_09----------------------#'
SET @@global.slave_transaction_retry_interval = 60*60;
SELECT @@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval;
@@slave_transaction_retry_interval = @@global.slave_transaction_retry_interval
1
'#---------------------FN_DYNVARS_149_10----------------------#'
SET slave_transaction_retry_interval = 2048;
ERROR HY000: Variable 'slave_transaction_retry_interval' is a GLOBAL variable and should be set with SET GLOBAL
SELECT slave_transaction_retry_interval;
ERROR 42S22: Unknown column 'slave_transaction_retry_interval' in 'field list'
SELECT @@slave_transaction_retry_interval;
@@slave_transaction_retry_interval
3600
SET global slave_transaction_retry_interval = 99;
SET @@global.slave_transaction_retry_interval = @start_global_value;
SELECT @@global.slave_transaction_retry_interval;
@@global.slave_transaction_retry_interval
0
@@ -1176,10 +1176,19 @@
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -4426,7 +4426,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
-VARIABLE_TYPE BIGINT UNSIGNED
+VARIABLE_TYPE INT UNSIGNED
VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3600
@@ -4257,7 +4257,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2
VARIABLE_SCOPE GLOBAL
@@ -1188,7 +1197,7 @@
VARIABLE_COMMENT If creating the thread takes longer than this value (in seconds), the Slow_launch_threads counter will be incremented
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 31536000
@@ -4485,7 +4485,7 @@
@@ -4316,7 +4316,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Each thread that needs to do a sort allocates a buffer of this size
NUMERIC_MIN_VALUE 1024
@@ -1197,7 +1206,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -4790,7 +4790,7 @@
@@ -4621,7 +4621,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 256
VARIABLE_SCOPE GLOBAL
@@ -1206,7 +1215,7 @@
VARIABLE_COMMENT The soft upper limit for number of cached stored routines for one connection.
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 524288
@@ -4888,7 +4888,7 @@
@@ -4719,7 +4719,7 @@
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 400
VARIABLE_SCOPE GLOBAL
@@ -1215,7 +1224,7 @@
VARIABLE_COMMENT The number of cached table definitions
NUMERIC_MIN_VALUE 400
NUMERIC_MAX_VALUE 524288
@@ -4902,7 +4902,7 @@
@@ -4733,7 +4733,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 2000
VARIABLE_SCOPE GLOBAL
@@ -1224,7 +1233,7 @@
VARIABLE_COMMENT The number of cached open tables
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 1048576
@@ -4972,7 +4972,7 @@
@@ -4761,7 +4761,7 @@
GLOBAL_VALUE_ORIGIN AUTO
DEFAULT_VALUE 256
VARIABLE_SCOPE GLOBAL
@@ -1233,7 +1242,7 @@
VARIABLE_COMMENT How many threads we should keep in a cache for reuse. These are freed after 5 minutes of idle time
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 16384
@@ -4986,7 +4986,7 @@
@@ -4775,7 +4775,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
@@ -1242,7 +1251,7 @@
VARIABLE_COMMENT Permits the application to give the threads system a hint for the desired number of threads that should be run at the same time.This variable has no effect, and is deprecated. It will be removed in a future release.
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 512
@@ -5191,15 +5191,15 @@
@@ -4980,15 +4980,15 @@
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME TMP_DISK_TABLE_SIZE
@@ -1262,7 +1271,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5213,7 +5213,7 @@
@@ -5002,7 +5002,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size.
NUMERIC_MIN_VALUE 1024
@@ -1271,7 +1280,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5227,7 +5227,7 @@
@@ -5016,7 +5016,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table.
NUMERIC_MIN_VALUE 1024
@@ -1280,7 +1289,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5238,7 +5238,7 @@
@@ -5027,7 +5027,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 8192
VARIABLE_SCOPE SESSION
@@ -1289,7 +1298,7 @@
VARIABLE_COMMENT Allocation block size for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
@@ -5252,7 +5252,7 @@
@@ -5041,7 +5041,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 4096
VARIABLE_SCOPE SESSION
@@ -1298,7 +1307,7 @@
VARIABLE_COMMENT Persistent buffer for transactions to be stored in binary log
NUMERIC_MIN_VALUE 1024
NUMERIC_MAX_VALUE 134217728
@@ -5350,7 +5350,7 @@
@@ -5139,7 +5139,7 @@
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 28800
VARIABLE_SCOPE SESSION
@@ -1307,7 +1316,7 @@
VARIABLE_COMMENT The number of seconds the server waits for activity on a connection before closing it
NUMERIC_MIN_VALUE 1
NUMERIC_MAX_VALUE 31536000
@@ -5455,7 +5455,7 @@
@@ -5243,7 +5243,7 @@
COMMAND_LINE_ARGUMENT OPTIONAL
VARIABLE_NAME OPEN_FILES_LIMIT
VARIABLE_SCOPE GLOBAL
@@ -1316,7 +1325,7 @@
VARIABLE_COMMENT If this is not 0, then mysqld will use this value to reserve file descriptors to use with setrlimit(). If this value is 0 or autoset then mysqld will reserve max_connections*5 or max_connections + table_cache*2 (whichever is larger) number of file descriptors
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
@@ -5468,7 +5468,7 @@
@@ -5256,7 +5256,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1325,7 +1334,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5478,7 +5478,7 @@
@@ -5266,7 +5266,7 @@
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Sets the internal state of the RAND() generator for replication purposes
NUMERIC_MIN_VALUE 0
@@ -1334,7 +1343,7 @@
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
@@ -5573,7 +5573,7 @@
@@ -5351,7 +5351,7 @@
VARIABLE_NAME LOG_TC_SIZE
GLOBAL_VALUE_ORIGIN AUTO
VARIABLE_SCOPE GLOBAL
@@ -4399,13 +4399,41 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 10
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout, before giving up and stopping
VARIABLE_COMMENT Number of times the slave SQL thread will retry a transaction in case it failed with a deadlock, elapsed lock wait timeout or listed in slave_transaction_retry_errors, before giving up and stopping
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 4294967295
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_TRANSACTION_RETRY_ERRORS
SESSION_VALUE NULL
GLOBAL_VALUE 1213,1205
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE VARCHAR
VARIABLE_COMMENT Tells the slave thread to retry transaction for replication when a query event returns an error from the provided list. Deadlock and elapsed lock wait timeout errors are automatically added to this list
NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST NULL
READ_ONLY YES
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_TRANSACTION_RETRY_INTERVAL
SESSION_VALUE NULL
GLOBAL_VALUE 0
GLOBAL_VALUE_ORIGIN COMPILE-TIME
DEFAULT_VALUE 0
VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE BIGINT UNSIGNED
VARIABLE_COMMENT Interval of the slave SQL thread will retry a transaction in case it failed with a deadlock or elapsed lock wait timeout or listed in slave_transaction_retry_errors
NUMERIC_MIN_VALUE 0
NUMERIC_MAX_VALUE 3600
NUMERIC_BLOCK_SIZE 1
ENUM_VALUE_LIST NULL
READ_ONLY NO
COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME SLAVE_TYPE_CONVERSIONS
SESSION_VALUE NULL
GLOBAL_VALUE
@@ -0,0 +1 @@
--slave_transaction_retry_errors="10,20, 5000, 400"

0 comments on commit b016e1b

Please sign in to comment.