Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
076a99e
MDEV-37949: Implement innodb_log_archive
dr-m Mar 17, 2026
5b5c71f
Merge MDEV-37949
dr-m Mar 24, 2026
e4549fe
fixup! 076a99e1189e737120f1628854177c5942e96c89
dr-m Mar 27, 2026
d7aa6da
Merge MDEV-37949 fixup
dr-m Mar 27, 2026
a65676f
Merge 12.3
dr-m Mar 27, 2026
b38bc40
MDEV-39225 Assertion failures with innodb_log_file_size>4g
dr-m Mar 31, 2026
d00d220
Merge MDEV-37949 fixup
dr-m Mar 31, 2026
4018e39
fixup! b38bc40e153d81c8d6ef66d3856f44def0dcf369
dr-m Apr 1, 2026
4ec24e4
Merge MDEV-39225 fixup
dr-m Apr 1, 2026
7b93c8a
fixup! 4018e39988f301b2c138d0d0e3e88e0e77ba3e6d
dr-m Apr 2, 2026
b23f598
Merge 12.3
dr-m Apr 2, 2026
9b5239f
Merge MDEV-39225 fixup
dr-m Apr 2, 2026
8f402eb
WIP MDEV-39162: Reduce innodb_log_archive=ON contention
dr-m Apr 2, 2026
72fe787
squash! 8f402eb43a0c8b7997b3830016c84e3fc1f8b7ed
dr-m Apr 7, 2026
613696a
Merge 12.3
dr-m Apr 8, 2026
b182d72
WIP MDEV-14992 BACKUP SERVER
dr-m Apr 8, 2026
f475b63
fixup! b182d721372bbb85b90118ace5065f5a279a3586
dr-m Apr 8, 2026
5870d49
fixup! b182d721372bbb85b90118ace5065f5a279a3586
dr-m Apr 13, 2026
39aab26
Invoke log_sys.backup_stop() earlier
dr-m Apr 13, 2026
693b7df
Hard-link or rename the InnoDB log
dr-m Apr 15, 2026
6ba4697
Copy log files between file systems, in the backup thread
dr-m Apr 16, 2026
96e56c9
unsung heroes are unsigned, not unsinged
dr-m Apr 16, 2026
36f92a4
fixup! 6ba469723b9da7aa5f77ef54071551ef232acda4
dr-m Apr 17, 2026
dc3dcfd
fixup! 36f92a4c34ff52468423c3597678dbbb043bbae8
dr-m Apr 17, 2026
48de279
fixup! b182d721372bbb85b90118ace5065f5a279a3586
dr-m Apr 17, 2026
13de67d
fixup! 36f92a4c34ff52468423c3597678dbbb043bbae8
dr-m Apr 17, 2026
bd5bf37
squash! 076a99e1189e737120f1628854177c5942e96c89
dr-m Apr 17, 2026
ee3edbd
Merge MDEV-37949
dr-m Apr 17, 2026
a71ace1
Twist CreateHardLink() params
dr-m Apr 17, 2026
d26acaf
fixup! b182d721372bbb85b90118ace5065f5a279a3586
dr-m Apr 17, 2026
6cb2a07
fixup! 48de279004b9a9089a0e449f393722a5c1be423e
dr-m Apr 17, 2026
5230908
Keep track of the last copied log file
dr-m Apr 17, 2026
b21761a
Try to avoid a sharing violation on Windows
dr-m Apr 17, 2026
6f2dad8
Protect backup by log_sys.latch.wr_lock(), and make Windows happy
dr-m Apr 20, 2026
fb3042d
Save InnoDB backup context in trx_t
dr-m Apr 21, 2026
af27ca1
Duplicate the last log file
dr-m Apr 21, 2026
5cd3b53
fixup! af27ca1d34e400502c4255dd210844945c68947a
dr-m Apr 22, 2026
04ac34d
fixup! 5cd3b53fe9f5a0484929e13a6017a113e574a1e6
dr-m Apr 22, 2026
bcbda03
fixup! 04ac34d118319063c5381d6bb907fa13a679fc2c
dr-m Apr 22, 2026
b0f350f
MDEV-39092 Copy Aria data and logs as part of backup
mariadb-andrzejjarzabek Apr 22, 2026
c143ff2
MDEV-39092 BACKUP SERVER of ENGINE=Aria to the local file system
mariadb-andrzejjarzabek Apr 23, 2026
c77278b
MDEV-39092 BACKUP SERVER of ENGINE=Aria to the local file system
mariadb-andrzejjarzabek Apr 29, 2026
8d0dc79
MDEV-39061 mariadb-backup compatible wrappers for BACKUP SERVER
Thirunarayanan May 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions extra/mariabackup/backup_copy.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ copy_back()
if it exists. */

ds_tmp = ds_create(dst_dir, DS_TYPE_LOCAL);
if (!(ret = copy_or_move_file(ds_tmp, LOG_FILE_NAME, LOG_FILE_NAME,
if (!(ret = copy_or_move_file(ds_tmp, "ib_logfile0", "ib_logfile0",
dst_dir, 1))) {
goto cleanup;
}
Expand Down Expand Up @@ -1890,7 +1890,7 @@ copy_back()
}

/* skip the redo log (it was already copied) */
if (!strcmp(filename, LOG_FILE_NAME)) {
if (!strcmp(filename, "ib_logfile0")) {
continue;
}

Expand Down
12 changes: 8 additions & 4 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2745,7 +2745,7 @@ static bool innodb_init()
srv_log_group_home_dir= xtrabackup_target_dir;

bool ret;
const std::string ib_logfile0{get_log_file_path()};
const std::string ib_logfile0{log_sys.get_circular_path()};
os_file_delete_if_exists_func(ib_logfile0.c_str(), nullptr);
os_file_t file= os_file_create_func(ib_logfile0.c_str(),
OS_FILE_CREATE,
Expand Down Expand Up @@ -4925,6 +4925,8 @@ static bool backup_wait_for_commit_lsn()
lsn_t last_lsn= recv_sys.lsn;

/* read the latest checkpoint lsn */
log_sys.last_checkpoint_lsn= 0;
recv_sys.file_checkpoint= 0;
if (recv_sys.find_checkpoint() == DB_SUCCESS && log_sys.is_latest())
{
metadata_to_lsn= log_sys.last_checkpoint_lsn;
Expand Down Expand Up @@ -5550,6 +5552,7 @@ static bool xtrabackup_backup_func()

srv_n_purge_threads = 1;
srv_read_only_mode = TRUE;
recv_sys.rpo = LSN_MAX;

srv_operation = SRV_OPERATION_BACKUP;
log_file_op = backup_file_op;
Expand Down Expand Up @@ -5642,10 +5645,11 @@ static bool xtrabackup_backup_func()

/* open the log file */
memset(&stat_info, 0, sizeof(MY_STAT));
dst_log_file = ds_open(backup_datasinks.m_redo, LOG_FILE_NAME, &stat_info);
dst_log_file =
ds_open(backup_datasinks.m_redo, "ib_logfile0", &stat_info);
if (dst_log_file == NULL) {
msg("Error: failed to open the target stream for '%s'.",
LOG_FILE_NAME);
msg("Error: failed to open the target stream"
" for 'ib_logfile0'.");
goto fail;
}

Expand Down
80 changes: 80 additions & 0 deletions include/my_backup.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/*****************************************************************************
Copyright (c) 2026 MariaDB plc.

This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA

*****************************************************************************/

#pragma once

#include <stdint.h>

#ifndef _WIN32
#include <sys/types.h>
#endif // _WIN32


#ifdef __cplusplus
extern "C" {
#endif

typedef IF_WIN(const char*,int) Backup_target;

#ifndef _WIN32
/** Copy a file in its entirety.
@param src source file descriptor
@param dst target to append src to
@return error code (negative)
@retval 0 on success */
int my_copy_file_fd(int src, int dst);

/** Copy a file given a known length to be copied.
@param src source file descriptor
@param dst target to append src to
@param size amount of data to be copied
@return error code (negative)
@retval 0 on success */
int my_copy_file_length_fd(int src, int dst, off_t size);

#endif // _WIN32

#ifdef __cplusplus
}
namespace backup
{

using Target= Backup_target;

inline void* to_void_ptr(const Target &tgt) noexcept
{
return IF_WIN(const_cast<char*>, reinterpret_cast<void*>)(tgt);
}

inline Target to_target(void* ptr) noexcept
{
return IF_WIN(static_cast<const char*>(ptr),
int(reinterpret_cast<uintptr_t>(ptr)));
}

# ifndef _WIN32

/* Same as my_copy_file_fd but for C++ code. */
int copy_file(int src, int dst) noexcept;

/* Same as for my_copy_file_length_fd but for C++ code. */
int copy_file(int src, int dst, off_t size) noexcept;

# endif // _WIN32
}

#endif // __cplusplus
1 change: 1 addition & 0 deletions libmysqld/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc
../sql/opt_hints.cc ../sql/opt_hints.h
../sql/opt_trace_ddl_info.cc ../sql/opt_trace_ddl_info.h
../sql/sql_path.cc
../sql/sql_backup.cc
${GEN_SOURCES}
${MYSYS_LIBWRAP_SOURCE}
)
Expand Down
1 change: 1 addition & 0 deletions mysql-test/collections/buildbot_suites.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ innodb,^
versioning,^
plugins,^
mariabackup,^
backup,^
roles,^
auth_gssapi,^
mysql_sha2,^
Expand Down
56 changes: 56 additions & 0 deletions mysql-test/include/have_mariabackup_wrapper.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# ==== Purpose ====
#
# Redirect `$XTRABACKUP` so existing test invocations like
#
# --exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf \
# --backup --target-dir=$targetdir
#
# run through scripts/mariabackup/mariabackup.sh — the BACKUP SERVER
# compatibility wrapper — without any change to the test body.
#
#
# Skip the test if any of these are missing:
# - the wrapper script
# - bash
# - the mariadb client (wrapper shells out to it)
#
# ==== Usage ====
#
# --source include/have_mariabackup_wrapper.inc
# # ... rest of the test, using $XTRABACKUP as usual ...
#
# ==== Exposed variables ====
#
# $XTRABACKUP — now points at mariabackup.sh

--source include/linux.inc

--let MARIABACKUP_WRAPPER=$MYSQL_TEST_DIR/../scripts/mariabackup/mariabackup.sh

--error 0,1
perl;
use strict;
use warnings;
use File::Basename;

my $wrapper = $ENV{MARIABACKUP_WRAPPER};
exit 1 unless $wrapper && -x $wrapper;

chomp(my $bash = `command -v bash 2>/dev/null`);
exit 1 unless $bash && -x $bash;

# Prepend its directory to PATH so the bare `mariadb` invocation
# inside the wrapper resolves.
my ($mariadb) = split /\s+/, ($ENV{MYSQL} // '');
exit 1 unless $mariadb && -x $mariadb;
$ENV{PATH} = dirname($mariadb) . ":$ENV{PATH}";

exit 0;
EOF

if ($errno)
{
--skip mariabackup.sh wrapper unavailable (script, bash, or mariadb client missing)
}

--let XTRABACKUP=$MARIABACKUP_WRAPPER
4 changes: 4 additions & 0 deletions mysql-test/include/innodb_encrypt_log.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
# (see include/innodb_encrypt_log.combinations)

--source include/have_innodb.inc
if ($MTR_COMBINATION_CRYPT)
{
--source ../suite/encryption/include/skip_innodb_log_archive.inc
}
2 changes: 1 addition & 1 deletion mysql-test/main/analyze_engine_stats2.result
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ repeat(uuid(), 7)
from seq_1_to_16384;
commit;
SET GLOBAL innodb_fast_shutdown=0;
# restart
# restart: --innodb-log-recovery-start=0
set log_slow_verbosity='engine';
set long_query_time=0.0;
set @js='$analyze_output';
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/analyze_engine_stats2.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ from seq_1_to_16384;
commit;

SET GLOBAL innodb_fast_shutdown=0;
# Avoid any crash recovery that would load pages.
--let $restart_parameters=--innodb-log-recovery-start=0
source include/restart_mysqld.inc;
set log_slow_verbosity='engine';
set long_query_time=0.0;
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/main/analyze_stmt_prefetch_count.result
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ commit;
# (in the test's .opt file we've disabled buffer pool saving/loading
# and also tried to disable any background activity)
SET GLOBAL innodb_fast_shutdown=0;
# restart
# restart: --innodb-log-recovery-start=0
set @innodb_pages_read0=
(select variable_value
from information_schema.session_status
Expand Down
2 changes: 2 additions & 0 deletions mysql-test/main/analyze_stmt_prefetch_count.test
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ commit;
--echo # (in the test's .opt file we've disabled buffer pool saving/loading
--echo # and also tried to disable any background activity)
SET GLOBAL innodb_fast_shutdown=0;
# Avoid any crash recovery that would load pages.
--let $restart_parameters=--innodb-log-recovery-start=0
--source include/restart_mysqld.inc

set @innodb_pages_read0=
Expand Down
6 changes: 6 additions & 0 deletions mysql-test/main/backup_server.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
BACKUP SERVER TO '$datadir/some_directory';
ERROR HY000: Incorrect arguments to BACKUP SERVER TO
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
ERROR HY000: Can't create directory 'MYSQLTEST_VARDIR/some_directory' (Errcode: 17 "File exists")
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
10 changes: 10 additions & 0 deletions mysql-test/main/backup_server.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
--let $datadir=`select @@datadir`
--error ER_WRONG_ARGUMENTS
evalp BACKUP SERVER TO '$datadir/some_directory';
evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 21
evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
--rmdir $MYSQLTEST_VARDIR/some_directory
evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
--rmdir $MYSQLTEST_VARDIR/some_directory
17 changes: 17 additions & 0 deletions mysql-test/main/backup_server_locking.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
ERROR HY000: Can't create directory 'MYSQLTEST_VARDIR/some_directory' (Errcode: 17 "File exists")
BACKUP STAGE START;
connect backup,localhost,root;
SET STATEMENT max_statement_time=0.1 FOR
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
ERROR 70100: Query was interrupted: execution time limit 0.1 sec exceeded
connection default;
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
ERROR HY000: Can't execute the command as you have a BACKUP STAGE active
BACKUP STAGE END;
connection backup;
SET STATEMENT max_statement_time=0.1 FOR
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
ERROR HY000: Can't create directory 'MYSQLTEST_VARDIR/some_directory' (Errcode: 17 "File exists")
disconnect backup;
connection default;
31 changes: 31 additions & 0 deletions mysql-test/main/backup_server_locking.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
--source include/not_embedded.inc
--source include/count_sessions.inc

--mkdir $MYSQLTEST_VARDIR/some_directory
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 21
evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';

BACKUP STAGE START;
--connect (backup,localhost,root)
--error ER_STATEMENT_TIMEOUT
evalp SET STATEMENT max_statement_time=0.1 FOR
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';

--connection default

--error ER_BACKUP_LOCK_IS_ACTIVE
evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';

BACKUP STAGE END;
--connection backup
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--error 21
evalp SET STATEMENT max_statement_time=0.1 FOR
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
--disconnect backup
--connection default

--rmdir $MYSQLTEST_VARDIR/some_directory

--source include/wait_until_count_sessions.inc
27 changes: 27 additions & 0 deletions mysql-test/main/grant_backup_server.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
CREATE USER user1@localhost IDENTIFIED BY '';
connect con1,localhost,user1;
BACKUP SERVER TO 'some_directory';
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
disconnect con1;
connection default;
GRANT SELECT ON test.* TO user1@localhost;
connect con1,localhost,user1;
BACKUP SERVER TO 'some_directory';
ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
disconnect con1;
connection default;
GRANT RELOAD ON test.* TO user1@localhost;
ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
GRANT RELOAD ON *.* TO user1@localhost;
connect con1,localhost,user1;
BACKUP SERVER TO 'some_directory';
ERROR 42000: Access denied; you need (at least one of) the SELECT privilege(s) for this operation
disconnect con1;
connection default;
GRANT SELECT ON *.* TO user1@localhost;
connect con1,localhost,user1;
BACKUP SERVER TO '$datadir/some_directory';
ERROR HY000: Incorrect arguments to BACKUP SERVER TO
disconnect con1;
connection default;
DROP USER user1@localhost;
29 changes: 29 additions & 0 deletions mysql-test/main/grant_backup_server.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--source include/not_embedded.inc
CREATE USER user1@localhost IDENTIFIED BY '';
--connect con1,localhost,user1
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP SERVER TO 'some_directory';
--disconnect con1
--connection default
GRANT SELECT ON test.* TO user1@localhost;
--connect con1,localhost,user1
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP SERVER TO 'some_directory';
--disconnect con1
--connection default
--error ER_WRONG_USAGE
GRANT RELOAD ON test.* TO user1@localhost;
GRANT RELOAD ON *.* TO user1@localhost;
--connect con1,localhost,user1
--error ER_SPECIFIC_ACCESS_DENIED_ERROR
BACKUP SERVER TO 'some_directory';
--disconnect con1
--connection default
GRANT SELECT ON *.* TO user1@localhost;
--connect con1,localhost,user1
--let $datadir=`select @@datadir`
--error ER_WRONG_ARGUMENTS
evalp BACKUP SERVER TO '$datadir/some_directory';
--disconnect con1
--connection default
DROP USER user1@localhost;
2 changes: 1 addition & 1 deletion mysql-test/main/mysqld--help.result
Original file line number Diff line number Diff line change
Expand Up @@ -2056,7 +2056,7 @@ performance-schema-max-socket-classes 10
performance-schema-max-socket-instances -1
performance-schema-max-sql-text-length 1024
performance-schema-max-stage-classes 170
performance-schema-max-statement-classes 227
performance-schema-max-statement-classes 228
performance-schema-max-statement-stack 10
performance-schema-max-table-handles -1
performance-schema-max-table-instances -1
Expand Down
Loading