-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDEV-26391 BF abortable mariabackup execution
This commit changes backup execution (namely the block ddl phase), so that node is not paused from cluster. Instead, the following backup execution is declared as vulnerable for possible cluster level conflicts, especially with DDL statement applying. With this, the mariabackup execution may be aborted, if DDL statements happen during backup execution. This abortable backup execution is optional feature and may be enabled/disabled by wsrep_mode: BF_ABORT_MARIABACKUP. Note that old style node desync and pause, despite of WSREP_MODE_BF_MARIABACKUP is needed if node is operating as SST donor. Reviewed-by: Jan Lindström <jan.lindstrom@mariadb.com>
- Loading branch information
Showing
10 changed files
with
53 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,8 +35,10 @@ | |
#include "sql_handler.h" // mysql_ha_cleanup_no_free | ||
#include <my_sys.h> | ||
#include <strfunc.h> // strconvert() | ||
#include "debug_sync.h" | ||
#ifdef WITH_WSREP | ||
#include "wsrep_server_state.h" | ||
#include "wsrep_mysqld.h" | ||
#endif /* WITH_WSREP */ | ||
|
||
static const char *stage_names[]= | ||
|
@@ -291,16 +293,26 @@ static bool backup_block_ddl(THD *thd) | |
|
||
#ifdef WITH_WSREP | ||
/* | ||
We desync the node for BACKUP STAGE because applier threads | ||
if user is specifically choosing to allow BF aborting for BACKUP STAGE BLOCK_DDL lock | ||
holder, then do not desync and pause the node from cluster replication. | ||
e.g. mariabackup uses BACKUP STATE BLOCK_DDL; and will be abortable by this. | ||
But, If node is processing as SST donor or WSREP_MODE_BF_MARIABACKUP mode is not set, | ||
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); | ||
if (!wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP) || | ||
server_state.state() == Wsrep_server_state::s_donor) | ||
{ | ||
if (server_state.desync_and_pause().is_undefined()) { | ||
DBUG_RETURN(1); | ||
} | ||
thd->wsrep_desynced_backup_stage= true; | ||
} | ||
thd->wsrep_desynced_backup_stage= true; | ||
else | ||
WSREP_INFO("Server not desynched from group because WSREP_MODE_BF_MARIABACKUP used."); | ||
} | ||
#endif /* WITH_WSREP */ | ||
|
||
|
@@ -340,6 +352,18 @@ static bool backup_block_ddl(THD *thd) | |
/* There can't be anything more that needs to be logged to ddl log */ | ||
THD_STAGE_INFO(thd, org_stage); | ||
stop_ddl_logging(); | ||
#ifdef WITH_WSREP | ||
// Allow tests to block the applier thread using the DBUG facilities | ||
DBUG_EXECUTE_IF("sync.wsrep_after_mdl_block_ddl", | ||
{ | ||
const char act[]= | ||
"now " | ||
"signal signal.wsrep_apply_toi"; | ||
DBUG_ASSERT(!debug_sync_set_action(thd, | ||
STRING_WITH_LEN(act))); | ||
};); | ||
#endif /* WITH_WSREP */ | ||
|
||
DBUG_RETURN(0); | ||
err: | ||
THD_STAGE_INFO(thd, org_stage); | ||
|
@@ -399,7 +423,8 @@ bool backup_end(THD *thd) | |
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) | ||
if (WSREP_NNULL(thd) && thd->wsrep_desynced_backup_stage && | ||
!wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP)) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
janlindstrom
Contributor
|
||
{ | ||
Wsrep_server_state &server_state= Wsrep_server_state::instance(); | ||
server_state.resume_and_resync(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I think you also need to consider whether the node was being used as an SST donor (with
wsrep_sst_method = mariabackup
), since I find that a node never returns fromDonor/Desynced
toSynced
after a serving as an SST donor.