mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 12:02:42 +01:00
MDEV-22285 : Assertion `xid_seqno > wsrep_seqno' failed in trx_rseg_update_wsrep_checkpoint on SET @@global.wsrep_start_position
Actual assertion mentioned on MDEV seems to be already fixed but setting seqno to -2 will trigger a different assertion mysqld: /home/jan/mysql/10.4-bugs/wsrep-lib/src/server_state.cpp:702: void wsrep::server_state::sst_received(wsrep::client_service&, int): Assertion `state_ == s_joiner || state_ == s_initialized' failed. Fixed this by not allowing user to set seqno < -1 (-1 is special seqno meaning undefined and seqno is initialized to it). MariaDB releases 10.2 and 10.3 already do not allow to set seqno < -1.
This commit is contained in:
parent
4afab3c725
commit
b87828b6c8
3 changed files with 78 additions and 14 deletions
|
@ -1,7 +1,6 @@
|
||||||
#
|
#
|
||||||
# wsrep_start_position
|
# wsrep_start_position
|
||||||
#
|
#
|
||||||
# save the initial value
|
|
||||||
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
|
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
|
||||||
# default
|
# default
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@ -11,46 +10,90 @@ SELECT @@global.wsrep_start_position;
|
||||||
# scope
|
# scope
|
||||||
SELECT @@session.wsrep_start_position;
|
SELECT @@session.wsrep_start_position;
|
||||||
ERROR HY000: Variable 'wsrep_start_position' is a GLOBAL variable
|
ERROR HY000: Variable 'wsrep_start_position' is a GLOBAL variable
|
||||||
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
|
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
@@global.wsrep_start_position
|
@@global.wsrep_start_position
|
||||||
00000000-0000-0000-0000-000000000000:-1
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
|
|
||||||
# valid values
|
# valid values
|
||||||
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
|
|
||||||
SELECT @@global.wsrep_start_position;
|
|
||||||
@@global.wsrep_start_position
|
|
||||||
00000000-0000-0000-0000-000000000000:-2
|
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
|
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
@@global.wsrep_start_position
|
@@global.wsrep_start_position
|
||||||
12345678-1234-1234-1234-123456789012:100
|
12345678-1234-1234-1234-123456789012:100
|
||||||
SET @@global.wsrep_start_position=default;
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:0
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
@@global.wsrep_start_position
|
@@global.wsrep_start_position
|
||||||
00000000-0000-0000-0000-000000000000:-1
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
|
|
||||||
# invalid values
|
# invalid values
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
|
||||||
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:-2'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2A';
|
||||||
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:-2A'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0A';
|
||||||
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '00000000-0000-0000-0000-000000000000:0A'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
|
SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '000000000000000-0000-0000-0000-000000000000:-1'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '000000000000000-0000-0000-0000-000000000000:-1'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
|
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-12345-123456789012:100'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-12345-123456789012:100'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
|
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-123-12345-123456789012:0'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-123-12345-123456789012:0'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
|
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:_99999'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:_99999'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
|
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:a'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of '12345678-1234-1234-1234-123456789012:a'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='OFF';
|
SET @@global.wsrep_start_position='OFF';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'OFF'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'OFF'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position=ON;
|
SET @@global.wsrep_start_position=ON;
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'ON'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'ON'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='';
|
SET @@global.wsrep_start_position='';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of ''
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of ''
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position=NULL;
|
SET @@global.wsrep_start_position=NULL;
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'NULL'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'NULL'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
SET @@global.wsrep_start_position='junk';
|
SET @@global.wsrep_start_position='junk';
|
||||||
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'junk'
|
ERROR 42000: Variable 'wsrep_start_position' can't be set to the value of 'junk'
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
@@global.wsrep_start_position
|
||||||
|
00000000-0000-0000-0000-000000000000:-1
|
||||||
|
|
||||||
# restore the initial value
|
# restore the initial value
|
||||||
SET @@global.wsrep_start_position = @wsrep_start_position_global_saved;
|
SET @@global.wsrep_start_position = @wsrep_start_position_global_saved;
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
--echo # wsrep_start_position
|
--echo # wsrep_start_position
|
||||||
--echo #
|
--echo #
|
||||||
|
|
||||||
--echo # save the initial value
|
|
||||||
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
|
SET @wsrep_start_position_global_saved = @@global.wsrep_start_position;
|
||||||
|
|
||||||
--echo # default
|
--echo # default
|
||||||
|
@ -14,40 +13,59 @@ SELECT @@global.wsrep_start_position;
|
||||||
--echo # scope
|
--echo # scope
|
||||||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
|
||||||
SELECT @@session.wsrep_start_position;
|
SELECT @@session.wsrep_start_position;
|
||||||
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
|
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
|
|
||||||
|
|
||||||
--echo
|
--echo
|
||||||
--echo # valid values
|
--echo # valid values
|
||||||
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
|
|
||||||
SELECT @@global.wsrep_start_position;
|
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
|
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:100';
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
SET @@global.wsrep_start_position=default;
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-1';
|
||||||
SELECT @@global.wsrep_start_position;
|
SELECT @@global.wsrep_start_position;
|
||||||
|
|
||||||
--echo
|
--echo
|
||||||
--echo # invalid values
|
--echo # invalid values
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:-2A';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
|
SET @@global.wsrep_start_position='00000000-0000-0000-0000-000000000000:0A';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
|
SET @@global.wsrep_start_position='000000000000000-0000-0000-0000-000000000000:-1';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
|
SET @@global.wsrep_start_position='12345678-1234-1234-12345-123456789012:100';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
|
SET @@global.wsrep_start_position='12345678-1234-123-12345-123456789012:0';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
|
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:_99999';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
|
SET @@global.wsrep_start_position='12345678-1234-1234-1234-123456789012:a';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='OFF';
|
SET @@global.wsrep_start_position='OFF';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position=ON;
|
SET @@global.wsrep_start_position=ON;
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='';
|
SET @@global.wsrep_start_position='';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position=NULL;
|
SET @@global.wsrep_start_position=NULL;
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
--error ER_WRONG_VALUE_FOR_VAR
|
--error ER_WRONG_VALUE_FOR_VAR
|
||||||
SET @@global.wsrep_start_position='junk';
|
SET @@global.wsrep_start_position='junk';
|
||||||
|
SELECT @@global.wsrep_start_position;
|
||||||
|
|
||||||
--echo
|
--echo
|
||||||
--echo # restore the initial value
|
--echo # restore the initial value
|
||||||
|
|
|
@ -212,8 +212,11 @@ bool wsrep_start_position_verify (const char* start_str)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
char* endptr;
|
char* endptr;
|
||||||
wsrep_seqno_t const seqno __attribute__((unused)) // to avoid GCC warnings
|
wsrep_seqno_t const seqno(strtoll(&start_str[uuid_len + 1], &endptr, 10));
|
||||||
(strtoll(&start_str[uuid_len + 1], &endptr, 10));
|
|
||||||
|
// Do not allow seqno < -1
|
||||||
|
if (*endptr == '\0' && seqno < -1)
|
||||||
|
return true;
|
||||||
|
|
||||||
// Remaining string was seqno.
|
// Remaining string was seqno.
|
||||||
if (*endptr == '\0') return false;
|
if (*endptr == '\0') return false;
|
||||||
|
|
Loading…
Reference in a new issue