-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
MDEV-14992 BACKUP SERVER to mounted file system #4817
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
dr-m
wants to merge
7
commits into
main
Choose a base branch
from
MDEV-14992
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9199727
MDEV-39770 log_t::persist(): Assertion is_opened() == archive failed
dr-m 7f207a2
WIP MDEV-14992 BACKUP SERVER
dr-m c0e48fc
WIP MDEV-39092, and back up non-InnoDB files
dr-m c90f391
fixup! c0e48fc966d3d3926bade68c7c5bfdb9fe88ad3a
dr-m e2e57f2
Correctly copy the last one or two log files
dr-m e096bd3
fixup! e2e57f2c81f9d691947634168a37bf3fdfe530d9
dr-m 32cea98
fixup! 7f207a291cb8b9903c08a05b0daa0a7eb90c3921
dr-m File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ innodb,^ | |
| versioning,^ | ||
| plugins,^ | ||
| mariabackup,^ | ||
| backup,^ | ||
| roles,^ | ||
| auth_gssapi,^ | ||
| mysql_sha2,^ | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -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'; |
This file contains hidden or 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 |
|---|---|---|
| @@ -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 |
This file contains hidden or 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 |
|---|---|---|
| @@ -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; |
This file contains hidden or 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 |
|---|---|---|
| @@ -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 |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| Prepare database | ||
| CREATE TABLE tinno (i INTEGER) ENGINE=InnoDB; | ||
| INSERT INTO tinno VALUES (1), (2), (3), (4); | ||
| CREATE TABLE tariatr (i INTEGER) ENGINE=Aria TRANSACTIONAL=1; | ||
| INSERT INTO tariatr VALUES (2), (3), (5), (7); | ||
| CREATE TABLE tariant (i INTEGER) ENGINE=Aria TRANSACTIONAL=0; | ||
| INSERT INTO tariant VALUES (1), (1), (2), (3), (5); | ||
| Back up the database | ||
| BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory'; | ||
| Restore the database | ||
| # restart: --datadir=MYSQLTEST_VARDIR/some_directory | ||
| Check contents after restore | ||
| SELECT * FROM tinno; | ||
| i | ||
| 1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| SELECT * FROM tariatr; | ||
| i | ||
| 2 | ||
| 3 | ||
| 5 | ||
| 7 | ||
| SELECT * FROM tariant; | ||
| i | ||
| 1 | ||
| 1 | ||
| 2 | ||
| 3 | ||
| 5 | ||
| Warnings: | ||
| Error 145 Got error '145 "Table was marked as crashed and should be repaired"' for './test/tariant' | ||
| Warning 1034 1 client is using or hasn't closed the table properly | ||
| Note 1034 Table is fixed | ||
| Restart database in original data directory | ||
| # restart | ||
| Clean up | ||
| DROP TABLE tinno; | ||
| DROP TABLE tariatr; | ||
| DROP TABLE tariant; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| --source include/not_windows.inc | ||
| --source include/have_innodb.inc | ||
|
|
||
| --echo Prepare database | ||
| CREATE TABLE tinno (i INTEGER) ENGINE=InnoDB; | ||
| INSERT INTO tinno VALUES (1), (2), (3), (4); | ||
| CREATE TABLE tariatr (i INTEGER) ENGINE=Aria TRANSACTIONAL=1; | ||
| INSERT INTO tariatr VALUES (2), (3), (5), (7); | ||
| CREATE TABLE tariant (i INTEGER) ENGINE=Aria TRANSACTIONAL=0; | ||
| INSERT INTO tariant VALUES (1), (1), (2), (3), (5); | ||
|
|
||
| --echo Back up the database | ||
| evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory'; | ||
|
|
||
| --echo Restore the database | ||
| --disable_query_log | ||
| call mtr.add_suppression("InnoDB: Did not find any checkpoint after LSN="); | ||
| call mtr.add_suppression("InnoDB: Renaming ib_[0-9]+.log to ib_logfile0"); | ||
| call mtr.add_suppression("mariadbd: Got error '145 \"Table was marked as crashed and should be repaired\"' for "); | ||
| call mtr.add_suppression("Checking table: "); | ||
| --enable_query_log | ||
| --let $restart_parameters=--datadir=$MYSQLTEST_VARDIR/some_directory | ||
| --source include/restart_mysqld.inc | ||
|
|
||
| --echo Check contents after restore | ||
| SELECT * FROM tinno; | ||
| SELECT * FROM tariatr; | ||
| SELECT * FROM tariant; | ||
|
|
||
| --echo Restart database in original data directory | ||
| --let $restart_parameters= | ||
| --source include/restart_mysqld.inc | ||
|
|
||
| --echo Clean up | ||
| DROP TABLE tinno; | ||
| DROP TABLE tariatr; | ||
| DROP TABLE tariant; | ||
| --rmdir $MYSQLTEST_VARDIR/some_directory |
This file contains hidden or 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 |
|---|---|---|
| @@ -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; |
This file contains hidden or 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 |
|---|---|---|
| @@ -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; |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -180,6 +180,7 @@ END | |
| main- | ||
| archive- | ||
| atomic- | ||
| backup- | ||
| binlog- | ||
| binlog_encryption- | ||
| binlog_in_engine- | ||
|
|
||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --- backup_innodb.result | ||
| +++ backup_innodb,debug.result | ||
| @@ -10,7 +10,13 @@ | ||
| BEGIN; | ||
| DELETE FROM t; | ||
| connect backup,localhost,root; | ||
| +SET DEBUG_SYNC='innodb_backup_start SIGNAL start WAIT_FOR resume'; | ||
| BACKUP SERVER TO 'MYSQLTEST_VARDIR/some_directory'; | ||
| +connection default; | ||
| +SET DEBUG_SYNC='now WAIT_FOR start'; | ||
| +INSERT INTO t(a) SELECT * FROM seq_1_to_30000; | ||
| +SET DEBUG_SYNC='now SIGNAL resume'; | ||
| +connection backup; | ||
| disconnect backup; | ||
| connection default; | ||
| ROLLBACK; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [archived] | ||
| innodb_log_archive=ON | ||
| [circular] | ||
| innodb_log_archive=OFF |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| CREATE TABLE t(a INT PRIMARY KEY, b CHAR(255) DEFAULT '' NOT NULL, INDEX(b)) | ||
| ENGINE=INNODB; | ||
| BEGIN; | ||
| INSERT INTO t SET a=1; | ||
| BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory'; | ||
| ROLLBACK; | ||
| SELECT * FROM t; | ||
| a b | ||
| 1 | ||
| BEGIN; | ||
| DELETE FROM t; | ||
| connect backup,localhost,root; | ||
| BACKUP SERVER TO 'MYSQLTEST_VARDIR/some_directory'; | ||
| disconnect backup; | ||
| connection default; | ||
| ROLLBACK; | ||
| SELECT * FROM t; | ||
| a b | ||
| 1 | ||
| DELETE FROM t; | ||
| # restart: --datadir=MYSQLTEST_VARDIR/some_directory | ||
| SELECT * FROM t; | ||
| a b | ||
| 1 | ||
| # restart | ||
| SELECT * FROM t; | ||
| a b | ||
| DROP TABLE t; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| --source include/have_sequence.inc | ||
| --source include/have_innodb.inc | ||
| --source include/maybe_debug.inc | ||
|
|
||
| CREATE TABLE t(a INT PRIMARY KEY, b CHAR(255) DEFAULT '' NOT NULL, INDEX(b)) | ||
| ENGINE=INNODB; | ||
| BEGIN; | ||
| INSERT INTO t SET a=1; | ||
|
|
||
| evalp BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory'; | ||
| --rmdir $MYSQLTEST_VARDIR/some_directory | ||
| ROLLBACK; | ||
| # BACKUP SERVER will implicitly commit the current transaction | ||
| SELECT * FROM t; | ||
|
|
||
| BEGIN; | ||
| DELETE FROM t; | ||
|
|
||
| --connect backup,localhost,root | ||
| if ($have_debug) { | ||
| SET DEBUG_SYNC='innodb_backup_start SIGNAL start WAIT_FOR resume'; | ||
| --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
| send_eval BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory'; | ||
| --connection default | ||
| SET DEBUG_SYNC='now WAIT_FOR start'; | ||
| INSERT INTO t(a) SELECT * FROM seq_1_to_30000; | ||
| SET DEBUG_SYNC='now SIGNAL resume'; | ||
| --connection backup | ||
| # FIXME: outside PMEM we may get ER_ERROR_ON_RENAME | ||
| --reap | ||
| } | ||
| if (!$have_debug) { | ||
| --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR | ||
| eval BACKUP SERVER TO '$MYSQLTEST_VARDIR/some_directory'; | ||
| } | ||
|
|
||
| --disconnect backup | ||
| --connection default | ||
| ROLLBACK; | ||
| SELECT * FROM t; | ||
| DELETE FROM t; | ||
|
|
||
| let $datadir=`SELECT @@datadir`; | ||
| --let $restart_parameters=--datadir=$MYSQLTEST_VARDIR/some_directory | ||
| --source include/restart_mysqld.inc | ||
|
|
||
| SELECT * FROM t; | ||
| --let $restart_parameters= | ||
| --source include/restart_mysqld.inc | ||
| SELECT * FROM t; | ||
| DROP TABLE t; | ||
|
|
||
| --rmdir $MYSQLTEST_VARDIR/some_directory | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -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 { }; |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.