Skip to content
/ server Public
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
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
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
5 changes: 3 additions & 2 deletions mysql-test/mariadb-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ END
main-
archive-
atomic-
backup-
binlog-
binlog_encryption-
binlog_in_engine-
Expand Down Expand Up @@ -327,7 +328,7 @@ END
my $opt_debug_sync_timeout= 300; # Default timeout for WAIT_FOR actions.
my $warn_seconds = 60;

my $rebootstrap_re= '--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path|force_rebootstrap';
my $rebootstrap_re= '--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_](group[-_]home[-_]dir|archive)|data[-_]home[-_]dir)|data[-_]file[-_]path|force_rebootstrap';

sub testcase_timeout ($) { return $opt_testcase_timeout * 60; }
sub check_timeout ($) { return testcase_timeout($_[0]); }
Expand Down Expand Up @@ -3146,7 +3147,7 @@ sub mysql_install_db {
# need to be given to the bootstrap process as well as the
# server process.
foreach my $extra_opt ( @opt_extra_mysqld_opt ) {
if ($extra_opt =~ /--innodb/) {
if ($extra_opt =~ /--((loose|skip)[-_])*innodb/) {
mtr_add_arg($args, $extra_opt);
}
}
Expand Down
21 changes: 21 additions & 0 deletions mysql-test/suite/backup/backup_innodb.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
CREATE TABLE t(i INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t VALUES(1);
BEGIN;
DELETE FROM t;
connect backup,localhost,root;
BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
disconnect backup;
connection default;
COMMIT;
SELECT * FROM t;
i
ibdata1
mysql
test
undo001
undo002
undo003
# restart
SELECT * FROM t;
i
DROP TABLE t;
25 changes: 25 additions & 0 deletions mysql-test/suite/backup/backup_innodb.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--source include/have_innodb.inc

CREATE TABLE t(i INT PRIMARY KEY) ENGINE=INNODB;
INSERT INTO t VALUES(1);
BEGIN;
DELETE FROM t;

--connect backup,localhost,root
evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory';
--disconnect backup
--connection default

COMMIT;
SELECT * FROM t;

let $datadir=`SELECT @@datadir`;
--source include/shutdown_mysqld.inc
--list_files $MYSQLTEST_VARDIR/some_directory
#--rmdir $datadir
#--move_file $MYSQLTEST_VARDIR/some_directory $datadir
--rmdir $MYSQLTEST_VARDIR/some_directory
--source include/start_mysqld.inc

SELECT * FROM t;
DROP TABLE t;
10 changes: 10 additions & 0 deletions mysql-test/suite/backup/suite.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package My::Suite::Backup;

@ISA = qw(My::Suite);
use My::Find;
use File::Basename;
use strict;

return "Not run for embedded server" if $::opt_embedded_server;

bless { };
15 changes: 15 additions & 0 deletions mysql-test/suite/binlog_in_engine/recovery.result
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,21 @@ binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (1)
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: innodb_read_only prevents crash recovery' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: Plugin initialization aborted' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'Plugin \'InnoDB\' registration as a STORAGE ENGINE failed' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'unknown option \'--innodb-invalid-option\'' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `mtr`; INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'\\[ERROR\\] Aborting' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (2)
binlog-000000.ibb # Query # # use `test`; INSERT INTO t1 VALUES (3)
binlog-000000.ibb # Xid # # COMMIT /* XID */
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/binlog_in_engine/recovery.test
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ INSERT INTO t1 VALUES (1);

--let $no_checkpoint_flush= 1
--let no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/binlog_in_engine/recovery_large.test
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ while ($i < $pre_count) {

--let $no_checkpoint_flush= 1
--let $no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc
--let $file= query_get_value(SHOW MASTER STATUS, File, 1)
--let $pos= query_get_value(SHOW MASTER STATUS, Position, 1)
Expand Down
25 changes: 25 additions & 0 deletions mysql-test/suite/binlog_in_engine/recovery_no_prealloc.result
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,31 @@ binlog-000000.ibb # Annotate_rows # # INSERT INTO t1 VALUES (2, REPEAT('2', 2000
binlog-000000.ibb # Table_map # # table_id: # (test.t1)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Xid # # COMMIT /* XID */
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: innodb_read_only prevents crash recovery' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'InnoDB: Plugin initialization aborted' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'Plugin \'InnoDB\' registration as a STORAGE ENGINE failed' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'unknown option \'--innodb-invalid-option\'' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
binlog-000000.ibb # Gtid # # BEGIN GTID #-#-#
binlog-000000.ibb # Annotate_rows # # INSERT INTO test_suppressions (pattern) VALUES ( NAME_CONST('pattern',_utf8mb4'\\[ERROR\\] Aborting' COLLATE 'utf8mb4_uca1400_ai_ci'))
binlog-000000.ibb # Table_map # # table_id: # (mtr.test_suppressions)
binlog-000000.ibb # Write_rows_v1 # # table_id: # flags: STMT_END_F
binlog-000000.ibb # Query # # COMMIT
include/show_binlog_events.inc
Log_name Pos Event_type Server_id End_log_pos Info
binlog-000001.ibb # Gtid # # BEGIN GTID #-#-#
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ INSERT INTO t1 VALUES (2, REPEAT('2', 200000));

--let $no_checkpoint_flush= 1
--let no_checkpoint_kill= 1
--source ../../suite/innodb/include/no_checkpoint_prepare.inc
--source ../../suite/innodb/include/no_checkpoint_start.inc

# Then fill up rest of binlog-000000.ibb, and some but not all of
Expand Down
12 changes: 12 additions & 0 deletions mysql-test/suite/encryption/include/skip_innodb_log_archive.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
--disable_query_log
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed\\.");
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("InnoDB: Plugin initialization aborted");
SET STATEMENT sql_log_bin=0 FOR
call mtr.add_suppression("InnoDB: ib_0.*\\.log does not match innodb_encrypt_log");
--enable_query_log
if (`SELECT COUNT(*)=0 FROM information_schema.global_variables where variable_name='innodb_log_archive' and variable_value='OFF'`)
{
--skip Test requires innodb_log_archive=OFF
}
2 changes: 1 addition & 1 deletion mysql-test/suite/encryption/r/doublewrite_debug.result
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ set global innodb_buf_flush_list_now = 1;
# restart
FOUND 1 /InnoDB: Encrypted page \[page id: space=[1-9]*, page number=3\] in file .*test.t1.ibd looks corrupted/ in mysqld.1.err
select * from t1;
ERROR 42000: Unknown storage engine 'InnoDB'
Got one of the listed errors
# shutdown server
# remove datadir
# xtrabackup move back
Expand Down
Loading
Loading