diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-25 12:44:24 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-01-25 12:44:24 +0200 |
commit | 961c7938bb4df7a19ccd8def1e57669f7600d3e5 (patch) | |
tree | b3d208be6d95ea3e4d1ba81c78392517ffe8f7fd /sql/wsrep_sst.cc | |
parent | 5adcb2e7b8f08cc459e478e5b118d924fbe18c86 (diff) | |
parent | 3467f6376472ce695e36746ba5b3c13cb5fcbb9f (diff) | |
download | mariadb-git-961c7938bb4df7a19ccd8def1e57669f7600d3e5.tar.gz |
Merge 10.4 into 10.5
Diffstat (limited to 'sql/wsrep_sst.cc')
-rw-r--r-- | sql/wsrep_sst.cc | 44 |
1 files changed, 38 insertions, 6 deletions
diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 93ec040079f..746c7f517a5 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -309,12 +309,40 @@ 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; + 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'; + + // 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); + WSREP_INFO("SST succeeded for position %s", start_pos_buf); + } + else + { + 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; } /* @@ -326,13 +354,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 @@ -372,8 +402,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, @@ -655,7 +687,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(); |