summaryrefslogtreecommitdiff
path: root/extra/mariabackup
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2018-11-28 01:02:46 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2018-11-28 01:02:46 +0200
commitbabb000a36f7a003cc0338cc7f8f01d0beaa5032 (patch)
tree1064292241b0af40ec8fd56000191df7ffcd5da1 /extra/mariabackup
parent4b88d5ee516fc7d2e51f55409623c63a1bde25f3 (diff)
parent4a92165ff04d6c0557eb99cc21ff88998337e376 (diff)
downloadmariadb-git-babb000a36f7a003cc0338cc7f8f01d0beaa5032.tar.gz
Merge 10.2 into 10.3
Diffstat (limited to 'extra/mariabackup')
-rw-r--r--extra/mariabackup/fil_cur.cc9
-rw-r--r--extra/mariabackup/xtrabackup.cc64
2 files changed, 15 insertions, 58 deletions
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index ea4cce92dda..d37c8e2f752 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -109,7 +109,6 @@ xb_fil_node_close_file(
ut_a(fil_system.n_open > 0);
fil_system.n_open--;
- fil_n_file_opened--;
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
fil_is_user_tablespace_id(node->space->id)) {
@@ -159,8 +158,11 @@ xb_fil_cur_open(
/* In the backup mode we should already have a tablespace handle created
by fil_ibd_load() unless it is a system
tablespace. Otherwise we open the file here. */
- if (cursor->is_system() || srv_operation == SRV_OPERATION_RESTORE_DELTA
- || xb_close_files) {
+ if (!node->is_open()) {
+ ut_ad(cursor->is_system()
+ || srv_operation == SRV_OPERATION_RESTORE_DELTA
+ || xb_close_files);
+
node->handle = os_file_create_simple_no_error_handling(
0, node->name,
OS_FILE_OPEN,
@@ -178,7 +180,6 @@ xb_fil_cur_open(
mutex_enter(&fil_system.mutex);
fil_system.n_open++;
- fil_n_file_opened++;
if (node->space->purpose == FIL_TYPE_TABLESPACE &&
fil_is_user_tablespace_id(node->space->id)) {
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 9ceb2800e73..59426b51127 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -3094,11 +3094,8 @@ xb_load_single_table_tablespace(
ut_a(space != NULL);
- if (!fil_node_create(file->filepath(), ulint(n_pages), space,
- false, false)) {
- ut_error;
- }
-
+ space->add(file->filepath(), OS_FILE_CLOSED, ulint(n_pages),
+ false, false);
/* by opening the tablespace we forcing node and space objects
in the cache to be populated with fields from space header */
space->open();
@@ -3775,22 +3772,17 @@ xb_filters_free()
}
/*********************************************************************//**
-Creates or opens the log files and closes them.
-@return DB_SUCCESS or error code */
+Create log file metadata. */
static
-ulint
+void
open_or_create_log_file(
/*====================*/
fil_space_t* space,
- ibool* log_file_created, /*!< out: TRUE if new log file
- created */
ulint i) /*!< in: log file number in group */
{
char name[10000];
ulint dirnamelen;
- *log_file_created = FALSE;
-
os_normalize_path(srv_log_group_home_dir);
dirnamelen = strlen(srv_log_group_home_dir);
@@ -3802,14 +3794,13 @@ open_or_create_log_file(
name[dirnamelen++] = OS_PATH_SEPARATOR;
}
- sprintf(name + dirnamelen, "%s%lu", "ib_logfile", (ulong) i);
+ sprintf(name + dirnamelen, "%s%zu", "ib_logfile", i);
ut_a(fil_validate());
- ut_a(fil_node_create(name, ulint(srv_log_file_size >> srv_page_size_shift),
- space, false, false));
-
- return(DB_SUCCESS);
+ space->add(name, OS_FILE_CLOSED,
+ ulint(srv_log_file_size >> srv_page_size_shift),
+ false, false);
}
/***********************************************************************
@@ -4069,13 +4060,6 @@ fail:
xb_filters_init();
- {
- ibool log_file_created;
- ibool log_created = FALSE;
- ibool log_opened = FALSE;
- ulint err;
- ulint i;
-
xb_fil_io_init();
srv_n_file_io_threads = srv_n_read_io_threads;
@@ -4088,36 +4072,8 @@ fail:
"innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0,
FIL_TYPE_LOG, NULL);
- for (i = 0; i < srv_n_log_files; i++) {
- err = open_or_create_log_file(space, &log_file_created, i);
- if (err != DB_SUCCESS) {
- goto fail;
- }
-
- if (log_file_created) {
- log_created = TRUE;
- } else {
- log_opened = TRUE;
- }
- if ((log_opened && log_created)) {
- msg(
- "mariabackup: Error: all log files must be created at the same time.\n"
- "mariabackup: All log files must be created also in database creation.\n"
- "mariabackup: If you want bigger or smaller log files, shut down the\n"
- "mariabackup: database and make sure there were no errors in shutdown.\n"
- "mariabackup: Then delete the existing log files. Edit the .cnf file\n"
- "mariabackup: and start the database again.\n");
-
- goto fail;
- }
- }
-
- /* log_file_created must not be TRUE, if online */
- if (log_file_created) {
- msg("mariabackup: Something wrong with source files...\n");
- goto fail;
- }
-
+ for (ulint i = 0; i < srv_n_log_files; i++) {
+ open_or_create_log_file(space, i);
}
/* create extra LSN dir if it does not exist. */