summaryrefslogtreecommitdiff
path: root/storage/innobase/srv
diff options
context:
space:
mode:
authorVlad Lesin <vlad_lesin@mail.ru>2020-04-03 00:43:09 +0300
committerVlad Lesin <vlad_lesin@mail.ru>2020-04-07 15:05:38 +0300
commit5836191c8f0658d5d75484766fdcc3d838b0a5c1 (patch)
treef55ca1a7ea0d0dbdf0757bb18bd9fd6d1f651081 /storage/innobase/srv
parentcd88a606f5c50db2c6ffe79c8a1a2fa00c06d4c4 (diff)
downloadmariadb-git-5836191c8f0658d5d75484766fdcc3d838b0a5c1.tar.gz
MDEV-21168: Active XA transactions stop slave from working after backup
was restored. Optionally rollback prepared XA's on "mariabackup --prepare". The fix MUST NOT be ported on 10.5+, as MDEV-742 fix solves the issue for slaves.
Diffstat (limited to 'storage/innobase/srv')
-rw-r--r--storage/innobase/srv/srv0start.cc33
1 files changed, 14 insertions, 19 deletions
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 75bdf17eab7..41a1d42f649 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -874,6 +874,7 @@ srv_undo_tablespaces_init(bool create_new_db)
break;
}
/* fall through */
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_EXPORT:
ut_ad(!create_new_db);
@@ -1280,6 +1281,7 @@ srv_shutdown_all_bg_threads()
case SRV_OPERATION_RESTORE_DELTA:
break;
case SRV_OPERATION_NORMAL:
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_EXPORT:
if (!buf_page_cleaner_is_active
@@ -1471,8 +1473,7 @@ innobase_start_or_create_for_mysql()
unsigned i = 0;
ut_ad(srv_operation == SRV_OPERATION_NORMAL
- || srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT);
+ || is_mariabackup_restore_or_export());
if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) {
srv_read_only_mode = true;
@@ -1950,14 +1951,9 @@ innobase_start_or_create_for_mysql()
srv_read_only_mode);
if (err == DB_NOT_FOUND) {
- if (i == 0) {
- if (srv_operation
- == SRV_OPERATION_RESTORE
- || srv_operation
- == SRV_OPERATION_RESTORE_EXPORT) {
- return(DB_SUCCESS);
- }
- }
+ if (i == 0
+ && is_mariabackup_restore_or_export())
+ return (DB_SUCCESS);
/* opened all files */
break;
@@ -1984,10 +1980,7 @@ innobase_start_or_create_for_mysql()
if (i == 0) {
if (size == 0
- && (srv_operation
- == SRV_OPERATION_RESTORE
- || srv_operation
- == SRV_OPERATION_RESTORE_EXPORT)) {
+ && is_mariabackup_restore_or_export()) {
/* Tolerate an empty ib_logfile0
from a previous run of
mariabackup --prepare. */
@@ -2217,6 +2210,7 @@ files_checked:
switch (srv_operation) {
case SRV_OPERATION_NORMAL:
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
case SRV_OPERATION_RESTORE_EXPORT:
/* Initialize the change buffer. */
err = dict_boot();
@@ -2321,8 +2315,7 @@ files_checked:
recv_recovery_from_checkpoint_finish();
- if (srv_operation == SRV_OPERATION_RESTORE
- || srv_operation == SRV_OPERATION_RESTORE_EXPORT) {
+ if (is_mariabackup_restore_or_export()) {
/* After applying the redo log from
SRV_OPERATION_BACKUP, flush the changes
to the data files and truncate or delete the log.
@@ -2337,8 +2330,7 @@ files_checked:
fil_close_log_files(true);
log_group_close_all();
if (err == DB_SUCCESS) {
- bool trunc = srv_operation
- == SRV_OPERATION_RESTORE;
+ bool trunc = is_mariabackup_restore();
/* Delete subsequent log files. */
delete_log_files(logfilename, dirnamelen,
srv_n_log_files_found, trunc);
@@ -2632,7 +2624,9 @@ files_checked:
srv_start_state_set(SRV_START_STATE_MASTER);
}
- if (!srv_read_only_mode && srv_operation == SRV_OPERATION_NORMAL
+ if (!srv_read_only_mode
+ && (srv_operation == SRV_OPERATION_NORMAL
+ || srv_operation == SRV_OPERATION_RESTORE_ROLLBACK_XA)
&& srv_force_recovery < SRV_FORCE_NO_BACKGROUND) {
srv_undo_sources = true;
/* Create the dict stats gathering thread */
@@ -2787,6 +2781,7 @@ innodb_shutdown()
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_DELTA:
case SRV_OPERATION_RESTORE_EXPORT:
+ case SRV_OPERATION_RESTORE_ROLLBACK_XA:
fil_close_all_files();
break;
case SRV_OPERATION_NORMAL: