summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2023-02-03 16:00:11 +1100
committerDaniel Black <daniel@mariadb.org>2023-02-07 20:14:26 +1100
commitecc93c9824886bb7a06afe9022bf694a60e35cee (patch)
tree2e007fb3341b58dc410a4835d1cbe39666923714
parent762fe015c15cdf5e0bdc57ac1f9f6f71e7484560 (diff)
downloadmariadb-git-ecc93c9824886bb7a06afe9022bf694a60e35cee.tar.gz
MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered'
Normalize innodb_flush_method, the same as the service, before attempting to print it.
-rw-r--r--extra/mariabackup/xtrabackup.cc11
-rw-r--r--mysql-test/suite/mariabackup/full_backup_win.result12
-rw-r--r--mysql-test/suite/mariabackup/full_backup_win.test24
3 files changed, 47 insertions, 0 deletions
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index bb440eec7f8..f7a5d00b92c 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -1896,6 +1896,17 @@ xb_get_one_option(int optid,
break;
case OPT_INNODB_FLUSH_METHOD:
+#ifdef _WIN32
+ /* From: storage/innobase/handler/ha_innodb.cc:innodb_init_params */
+ switch (srv_file_flush_method) {
+ case SRV_ALL_O_DIRECT_FSYNC + 1 /* "async_unbuffered"="unbuffered" */:
+ srv_file_flush_method= SRV_ALL_O_DIRECT_FSYNC;
+ break;
+ case SRV_ALL_O_DIRECT_FSYNC + 2 /* "normal"="fsync" */:
+ srv_file_flush_method= SRV_FSYNC;
+ break;
+ }
+#endif
ut_a(srv_file_flush_method
<= IF_WIN(SRV_ALL_O_DIRECT_FSYNC, SRV_O_DIRECT_NO_FSYNC));
ADD_PRINT_PARAM_OPT(innodb_flush_method_names[srv_file_flush_method]);
diff --git a/mysql-test/suite/mariabackup/full_backup_win.result b/mysql-test/suite/mariabackup/full_backup_win.result
new file mode 100644
index 00000000000..940c7056d3f
--- /dev/null
+++ b/mysql-test/suite/mariabackup/full_backup_win.result
@@ -0,0 +1,12 @@
+#
+# MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered'
+#
+# xtrabackup backup
+# xtrabackup prepare
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/suite/mariabackup/full_backup_win.test b/mysql-test/suite/mariabackup/full_backup_win.test
new file mode 100644
index 00000000000..5a1d1c38026
--- /dev/null
+++ b/mysql-test/suite/mariabackup/full_backup_win.test
@@ -0,0 +1,24 @@
+--source include/windows.inc
+
+let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
+
+--echo #
+--echo # MDEV-30492 Crash when use mariabackup.exe with config 'innodb_flush_method=async_unbuffered'
+--echo #
+
+echo # xtrabackup backup;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb_flush_method=normal --backup --target-dir=$targetdir;
+--enable_result_log
+
+echo # xtrabackup prepare;
+--disable_result_log
+exec $XTRABACKUP --prepare --innodb-flush-method=async_unbuffered --target-dir=$targetdir;
+-- source include/restart_and_restore.inc
+--enable_result_log
+
+rmdir $targetdir;
+
+--echo #
+--echo # End of 10.4 tests
+--echo #