summaryrefslogtreecommitdiff
path: root/sql/backup.cc
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2021-08-02 10:11:41 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2021-08-02 10:11:41 +0200
commit6efb5e9f5e3cd3ec811ae832a67e1878c14f0dea (patch)
treeb7c1a18b8bbc638ee12951d1d04db6d21bebcaed /sql/backup.cc
parent07674e6a741a82d2e30f9798f699209a6c34dfef (diff)
parentec8882b9ddbba2f9fc3571a1ac2ade0dabf412d9 (diff)
downloadmariadb-git-6efb5e9f5e3cd3ec811ae832a67e1878c14f0dea.tar.gz
Merge branch '10.5' into 10.6
Diffstat (limited to 'sql/backup.cc')
-rw-r--r--sql/backup.cc24
1 files changed, 24 insertions, 0 deletions
diff --git a/sql/backup.cc b/sql/backup.cc
index 5367a75b094..84c3788a4d4 100644
--- a/sql/backup.cc
+++ b/sql/backup.cc
@@ -35,6 +35,7 @@
#include "sql_handler.h" // mysql_ha_cleanup_no_free
#include <my_sys.h>
#include <strfunc.h> // strconvert()
+#include "wsrep_mysqld.h"
static const char *stage_names[]=
{"START", "FLUSH", "BLOCK_DDL", "BLOCK_COMMIT", "END", 0};
@@ -282,6 +283,21 @@ static bool backup_block_ddl(THD *thd)
(void) flush_tables(thd, FLUSH_NON_TRANS_TABLES);
thd->clear_error();
+#ifdef WITH_WSREP
+ /*
+ We desync the node for BACKUP STAGE because applier threads
+ bypass backup MDL locks (see MDL_lock::can_grant_lock)
+ */
+ if (WSREP_NNULL(thd))
+ {
+ Wsrep_server_state &server_state= Wsrep_server_state::instance();
+ if (server_state.desync_and_pause().is_undefined()) {
+ DBUG_RETURN(1);
+ }
+ thd->wsrep_desynced_backup_stage= true;
+ }
+#endif /* WITH_WSREP */
+
/*
block new DDL's, in addition to all previous blocks
We didn't do this lock above, as we wanted DDL's to be executed while
@@ -361,6 +377,14 @@ bool backup_end(THD *thd)
backup_flush_ticket= 0;
thd->current_backup_stage= BACKUP_FINISHED;
thd->mdl_context.release_lock(old_ticket);
+#ifdef WITH_WSREP
+ if (WSREP_NNULL(thd) && thd->wsrep_desynced_backup_stage)
+ {
+ Wsrep_server_state &server_state= Wsrep_server_state::instance();
+ server_state.resume_and_resync();
+ thd->wsrep_desynced_backup_stage= false;
+ }
+#endif /* WITH_WSREP */
}
DBUG_RETURN(0);
}