diff options
author | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-01-19 10:00:05 +0200 |
---|---|---|
committer | Jan Lindström <jan.lindstrom@mariadb.com> | 2021-01-21 11:41:29 +0200 |
commit | be5fce16a0d4104b216818438ca624bfaa19497a (patch) | |
tree | adf181973fad34ffa10c19d22e33fbbb7cfd872b /sql/wsrep_sst.cc | |
parent | 9377e9ba0c8c2b6a89d47e545eb292a6973ad2fb (diff) | |
download | mariadb-git-be5fce16a0d4104b216818438ca624bfaa19497a.tar.gz |
MDEV-24596 : Assertion `state_ == s_exec || state_ == s_quitting' failed in wsrep::client_state::disable_streaming
There were multiple problems here
* wsrep_trx_fragment_size should not be set when wsrep is disabled or provider is not loaded
* wsrep_trx_fragment_unit should not be set when wsrep is disabled or provider is not loaded
* wsrep_debug has no effect if wsrep is disabled or provider is not loaded
* wsrep_start_position should not be set when wsrep is disabled or provider is not loaded any other value than default
* wsrep_start_position should be changed only when we are joiner or initialized
* wsrep_start_position should be allowed to set only a value that exits, thus
we need to add error handling to wsrep_sst_complete
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r-- | sql/wsrep_sst.cc | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index c024f08dd22..227cd6b4769 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -308,12 +308,37 @@ bool wsrep_before_SE() } // Signal end of SST -static void wsrep_sst_complete (THD* thd, - int const rcode) +static bool wsrep_sst_complete (THD* thd, + int const rcode, + wsrep::gtid const sst_gtid) { Wsrep_client_service client_service(thd, thd->wsrep_cs()); - Wsrep_server_state::instance().sst_received(client_service, rcode); + Wsrep_server_state& server_state= Wsrep_server_state::instance(); + enum wsrep::server_state::state state= server_state.state(); + bool failed= false; + + // Do not call sst_received if we are not in joiner or + // initialized state on server. This is because it + // assumes we are on those states. Give error if we are + // in incorrect state. + if ((state == Wsrep_server_state::s_joiner || + state == Wsrep_server_state::s_initialized)) + Wsrep_server_state::instance().sst_received(client_service, + rcode); + else + { + char start_pos_buf[FN_REFLEN]; + ssize_t len= wsrep::print_to_c_str(sst_gtid, start_pos_buf, FN_REFLEN-1); + start_pos_buf[len]='\0'; + WSREP_ERROR("SST failed for position %s initialized %d server_state %s", + start_pos_buf, + server_state.is_initialized(), + wsrep::to_c_string(state)); + failed= true; + } + wsrep_joiner_monitor_end(); + return failed; } /* @@ -325,13 +350,15 @@ static void wsrep_sst_complete (THD* thd, @param seqno [IN] Initial state sequence number @param state [IN] Always NULL, also ignored by wsrep provider (?) @param state_len [IN] Always 0, also ignored by wsrep provider (?) + @return true when successful, false if error */ -void wsrep_sst_received (THD* thd, +bool wsrep_sst_received (THD* thd, const wsrep_uuid_t& uuid, wsrep_seqno_t const seqno, const void* const state, size_t const state_len) { + bool error= false; /* To keep track of whether the local uuid:seqno should be updated. Also, note that local state (uuid:seqno) is updated/checkpointed only after we get an @@ -371,8 +398,10 @@ void wsrep_sst_received (THD* thd, if (WSREP_ON) { int const rcode(seqno < 0 ? seqno : 0); - wsrep_sst_complete(thd,rcode); + error= wsrep_sst_complete(thd,rcode, sst_gtid); } + + return error; } static int sst_scan_uuid_seqno (const char* str, @@ -653,7 +682,7 @@ err: /* Read committed isolation to avoid gap locking */ thd->variables.tx_isolation= ISO_READ_COMMITTED; - wsrep_sst_complete (thd, -err); + wsrep_sst_complete (thd, -err, ret_gtid); delete thd; my_thread_end(); |