mirror of
https://github.com/MariaDB/server.git
synced 2025-12-09 08:01:34 +03:00
MDEV-18212 mariabackup: Make output format uniform whenever possible
This commit is contained in:
@@ -57,19 +57,19 @@ MYSQL_ADD_EXECUTABLE(mariabackup
|
|||||||
xtrabackup.cc
|
xtrabackup.cc
|
||||||
innobackupex.cc
|
innobackupex.cc
|
||||||
changed_page_bitmap.cc
|
changed_page_bitmap.cc
|
||||||
datasink.c
|
datasink.cc
|
||||||
ds_buffer.c
|
ds_buffer.cc
|
||||||
ds_compress.c
|
ds_compress.cc
|
||||||
ds_local.cc
|
ds_local.cc
|
||||||
ds_stdout.c
|
ds_stdout.cc
|
||||||
ds_tmpfile.c
|
ds_tmpfile.cc
|
||||||
ds_xbstream.c
|
ds_xbstream.cc
|
||||||
fil_cur.cc
|
fil_cur.cc
|
||||||
quicklz/quicklz.c
|
quicklz/quicklz.c
|
||||||
read_filt.cc
|
read_filt.cc
|
||||||
write_filt.cc
|
write_filt.cc
|
||||||
wsrep.cc
|
wsrep.cc
|
||||||
xbstream_write.c
|
xbstream_write.cc
|
||||||
backup_mysql.cc
|
backup_mysql.cc
|
||||||
backup_copy.cc
|
backup_copy.cc
|
||||||
encryption_plugin.cc
|
encryption_plugin.cc
|
||||||
@@ -96,13 +96,13 @@ ENDIF()
|
|||||||
# xbstream binary
|
# xbstream binary
|
||||||
########################################################################
|
########################################################################
|
||||||
MYSQL_ADD_EXECUTABLE(mbstream
|
MYSQL_ADD_EXECUTABLE(mbstream
|
||||||
ds_buffer.c
|
ds_buffer.cc
|
||||||
ds_local.cc
|
ds_local.cc
|
||||||
ds_stdout.c
|
ds_stdout.cc
|
||||||
datasink.c
|
datasink.cc
|
||||||
xbstream.c
|
xbstream.cc
|
||||||
xbstream_read.c
|
xbstream_read.cc
|
||||||
xbstream_write.c
|
xbstream_write.cc
|
||||||
COMPONENT backup
|
COMPONENT backup
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ datadir_iter_next_database(datadir_iter_t *it)
|
|||||||
if (os_file_closedir(it->dbdir) != 0) {
|
if (os_file_closedir(it->dbdir) != 0) {
|
||||||
|
|
||||||
msg("Warning: could not"
|
msg("Warning: could not"
|
||||||
" close database directory %s\n", it->dbpath);
|
" close database directory %s", it->dbpath);
|
||||||
|
|
||||||
it->err = DB_ERROR;
|
it->err = DB_ERROR;
|
||||||
|
|
||||||
@@ -278,7 +278,7 @@ datadir_iter_next_database(datadir_iter_t *it)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (check_if_skip_database_by_path(it->dbpath)) {
|
if (check_if_skip_database_by_path(it->dbpath)) {
|
||||||
msg("Skipping db: %s\n", it->dbpath);
|
msg("Skipping db: %s", it->dbpath);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -522,19 +522,15 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
|
|||||||
/* The following call prints an error message */
|
/* The following call prints an error message */
|
||||||
os_file_get_last_error(TRUE);
|
os_file_get_last_error(TRUE);
|
||||||
|
|
||||||
msg("[%02u] error: cannot open "
|
msg(thread_n,"error: cannot open "
|
||||||
"file %s\n",
|
"file %s", cursor->abs_path);
|
||||||
thread_n, cursor->abs_path);
|
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) {
|
if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) {
|
||||||
msg("[%02u] error: cannot stat %s\n",
|
msg(thread_n, "error: cannot stat %s", cursor->abs_path);
|
||||||
thread_n, cursor->abs_path);
|
|
||||||
|
|
||||||
datafile_close(cursor);
|
datafile_close(cursor);
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -728,9 +724,8 @@ directory_exists(const char *dir, bool create)
|
|||||||
|
|
||||||
if (mkdirp(dir, 0777, MYF(0)) < 0) {
|
if (mkdirp(dir, 0777, MYF(0)) < 0) {
|
||||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||||
msg("Can not create directory %s: %s\n", dir, errbuf);
|
msg("Can not create directory %s: %s", dir, errbuf);
|
||||||
return(false);
|
return(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -739,7 +734,7 @@ directory_exists(const char *dir, bool create)
|
|||||||
|
|
||||||
if (os_dir == NULL) {
|
if (os_dir == NULL) {
|
||||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||||
msg("Can not open directory %s: %s\n", dir,
|
msg("Can not open directory %s: %s", dir,
|
||||||
errbuf);
|
errbuf);
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
@@ -768,7 +763,7 @@ directory_exists_and_empty(const char *dir, const char *comment)
|
|||||||
os_dir = os_file_opendir(dir, FALSE);
|
os_dir = os_file_opendir(dir, FALSE);
|
||||||
|
|
||||||
if (os_dir == NULL) {
|
if (os_dir == NULL) {
|
||||||
msg("%s can not open directory %s\n", comment, dir);
|
msg("%s can not open directory %s", comment, dir);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,7 +772,7 @@ directory_exists_and_empty(const char *dir, const char *comment)
|
|||||||
os_file_closedir(os_dir);
|
os_file_closedir(os_dir);
|
||||||
|
|
||||||
if (!empty) {
|
if (!empty) {
|
||||||
msg("%s directory %s is not empty!\n", comment, dir);
|
msg("%s directory %s is not empty!", comment, dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
return(empty);
|
return(empty);
|
||||||
@@ -826,7 +821,7 @@ datafile_copy_backup(const char *filepath, uint thread_n)
|
|||||||
of the filters value. */
|
of the filters value. */
|
||||||
|
|
||||||
if (check_if_skip_table(filepath)) {
|
if (check_if_skip_table(filepath)) {
|
||||||
msg_ts("[%02u] Skipping %s.\n", thread_n, filepath);
|
msg(thread_n,"Skipping %s.", filepath);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -892,14 +887,13 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
|
|||||||
|
|
||||||
dstfile = ds_open(ds_data, filename, &stat);
|
dstfile = ds_open(ds_data, filename, &stat);
|
||||||
if (dstfile == NULL) {
|
if (dstfile == NULL) {
|
||||||
msg("[%02u] error: "
|
msg("error: Can't open the destination stream for %s",
|
||||||
"cannot open the destination stream for %s\n",
|
filename);
|
||||||
0, filename);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
action = xb_get_copy_action("Writing");
|
action = xb_get_copy_action("Writing");
|
||||||
msg_ts("[%02u] %s %s\n", 0, action, filename);
|
msg("%s %s", action, filename);
|
||||||
|
|
||||||
if (buf_len == -1) {
|
if (buf_len == -1) {
|
||||||
goto error;
|
goto error;
|
||||||
@@ -910,7 +904,7 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* close */
|
/* close */
|
||||||
msg_ts("[%02u] ...done\n", 0);
|
msg(" ...done");
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
if (ds_close(dstfile)) {
|
if (ds_close(dstfile)) {
|
||||||
@@ -926,7 +920,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_close:
|
error_close:
|
||||||
msg("[%02u] Error: backup file failed.\n", 0);
|
msg("Error: backup file failed.");
|
||||||
return(false); /*ERROR*/
|
return(false); /*ERROR*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,7 +980,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
|
|||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
ret = data_threads[i].ret && ret;
|
ret = data_threads[i].ret && ret;
|
||||||
if (!data_threads[i].ret) {
|
if (!data_threads[i].ret) {
|
||||||
msg("Error: thread %u failed.\n", i);
|
msg("Error: thread %u failed.", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1021,14 +1015,12 @@ copy_file(ds_ctxt_t *datasink,
|
|||||||
|
|
||||||
dstfile = ds_open(datasink, dst_path, &cursor.statinfo);
|
dstfile = ds_open(datasink, dst_path, &cursor.statinfo);
|
||||||
if (dstfile == NULL) {
|
if (dstfile == NULL) {
|
||||||
msg("[%02u] error: "
|
msg(thread_n,"error: "
|
||||||
"cannot open the destination stream for %s\n",
|
"cannot open the destination stream for %s", dst_name);
|
||||||
thread_n, dst_name);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("[%02u] %s %s to %s\n",
|
msg(thread_n, "%s %s to %s", xb_get_copy_action(), src_file_path, dstfile->path);
|
||||||
thread_n, xb_get_copy_action(), src_file_path, dstfile->path);
|
|
||||||
|
|
||||||
/* The main copy loop */
|
/* The main copy loop */
|
||||||
while ((res = datafile_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
|
while ((res = datafile_read(&cursor)) == XB_FIL_CUR_SUCCESS) {
|
||||||
@@ -1043,7 +1035,7 @@ copy_file(ds_ctxt_t *datasink,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* close */
|
/* close */
|
||||||
msg_ts("[%02u] ...done\n", thread_n);
|
msg(thread_n," ...done");
|
||||||
datafile_close(&cursor);
|
datafile_close(&cursor);
|
||||||
if (ds_close(dstfile)) {
|
if (ds_close(dstfile)) {
|
||||||
goto error_close;
|
goto error_close;
|
||||||
@@ -1057,7 +1049,7 @@ error:
|
|||||||
}
|
}
|
||||||
|
|
||||||
error_close:
|
error_close:
|
||||||
msg("[%02u] Error: copy_file() failed.\n", thread_n);
|
msg(thread_n,"Error: copy_file() failed.");
|
||||||
return(false); /*ERROR*/
|
return(false); /*ERROR*/
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,36 +1081,34 @@ move_file(ds_ctxt_t *datasink,
|
|||||||
|
|
||||||
if (file_exists(dst_file_path_abs)) {
|
if (file_exists(dst_file_path_abs)) {
|
||||||
msg("Error: Move file %s to %s failed: Destination "
|
msg("Error: Move file %s to %s failed: Destination "
|
||||||
"file exists\n",
|
"file exists", src_file_path, dst_file_path_abs);
|
||||||
src_file_path, dst_file_path_abs);
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("[%02u] Moving %s to %s\n",
|
msg(thread_n,"Moving %s to %s", src_file_path, dst_file_path_abs);
|
||||||
thread_n, src_file_path, dst_file_path_abs);
|
|
||||||
|
|
||||||
if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) {
|
if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) {
|
||||||
if (my_errno == EXDEV) {
|
if (my_errno == EXDEV) {
|
||||||
bool ret;
|
bool ret;
|
||||||
ret = copy_file(datasink, src_file_path,
|
ret = copy_file(datasink, src_file_path,
|
||||||
dst_file_path, thread_n);
|
dst_file_path, thread_n);
|
||||||
msg_ts("[%02u] Removing %s\n", thread_n, src_file_path);
|
msg(thread_n,"Removing %s", src_file_path);
|
||||||
if (unlink(src_file_path) != 0) {
|
if (unlink(src_file_path) != 0) {
|
||||||
my_strerror(errbuf, sizeof(errbuf), errno);
|
my_strerror(errbuf, sizeof(errbuf), errno);
|
||||||
msg("Error: unlink %s failed: %s\n",
|
msg("Error: unlink %s failed: %s",
|
||||||
src_file_path,
|
src_file_path,
|
||||||
errbuf);
|
errbuf);
|
||||||
}
|
}
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||||
msg("Can not move file %s to %s: %s\n",
|
msg("Can not move file %s to %s: %s",
|
||||||
src_file_path, dst_file_path_abs,
|
src_file_path, dst_file_path_abs,
|
||||||
errbuf);
|
errbuf);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("[%02u] ...done\n", thread_n);
|
msg(thread_n," ...done");
|
||||||
|
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -1270,13 +1260,13 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
prep_mode ? 1 : 2);
|
prep_mode ? 1 : 2);
|
||||||
rsync_tmpfile = fopen(rsync_tmpfile_name, "w");
|
rsync_tmpfile = fopen(rsync_tmpfile_name, "w");
|
||||||
if (rsync_tmpfile == NULL) {
|
if (rsync_tmpfile == NULL) {
|
||||||
msg("Error: can't create file %s\n",
|
msg("Error: can't create file %s",
|
||||||
rsync_tmpfile_name);
|
rsync_tmpfile_name);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Starting %s non-InnoDB tables and files\n",
|
msg("Starting %s non-InnoDB tables and files",
|
||||||
prep_mode ? "prep copy of" : "to backup");
|
prep_mode ? "prep copy of" : "to backup");
|
||||||
|
|
||||||
datadir_node_init(&node);
|
datadir_node_init(&node);
|
||||||
@@ -1292,7 +1282,7 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
ret = datafile_copy_backup(node.filepath, 1);
|
ret = datafile_copy_backup(node.filepath, 1);
|
||||||
}
|
}
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
msg("Failed to copy file %s\n", node.filepath);
|
msg("Failed to copy file %s", node.filepath);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
} else if (!prep_mode) {
|
} else if (!prep_mode) {
|
||||||
@@ -1302,7 +1292,7 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
"%s/db.opt", node.filepath);
|
"%s/db.opt", node.filepath);
|
||||||
if (!(ret = backup_file_printf(
|
if (!(ret = backup_file_printf(
|
||||||
trim_dotslash(path), "%s", ""))) {
|
trim_dotslash(path), "%s", ""))) {
|
||||||
msg("Failed to create file %s\n", path);
|
msg("Failed to create file %s", path);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1327,13 +1317,13 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
cmd << "rsync -t . --files-from=" << rsync_tmpfile_name
|
cmd << "rsync -t . --files-from=" << rsync_tmpfile_name
|
||||||
<< " " << xtrabackup_target_dir;
|
<< " " << xtrabackup_target_dir;
|
||||||
|
|
||||||
msg_ts("Starting rsync as: %s\n", cmd.str().c_str());
|
msg("Starting rsync as: %s", cmd.str().c_str());
|
||||||
if ((err = system(cmd.str().c_str()) && !prep_mode) != 0) {
|
if ((err = system(cmd.str().c_str()) && !prep_mode) != 0) {
|
||||||
msg_ts("Error: rsync failed with error code %d\n", err);
|
msg("Error: rsync failed with error code %d", err);
|
||||||
ret = false;
|
ret = false;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
msg_ts("rsync finished successfully.\n");
|
msg("rsync finished successfully.");
|
||||||
|
|
||||||
if (!prep_mode && !opt_no_lock) {
|
if (!prep_mode && !opt_no_lock) {
|
||||||
char path[FN_REFLEN];
|
char path[FN_REFLEN];
|
||||||
@@ -1349,7 +1339,7 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
|
|
||||||
rsync_tmpfile = fopen(rsync_tmpfile_name, "r");
|
rsync_tmpfile = fopen(rsync_tmpfile_name, "r");
|
||||||
if (rsync_tmpfile == NULL) {
|
if (rsync_tmpfile == NULL) {
|
||||||
msg("Error: can't open file %s\n",
|
msg("Error: can't open file %s",
|
||||||
rsync_tmpfile_name);
|
rsync_tmpfile_name);
|
||||||
ret = false;
|
ret = false;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -1365,7 +1355,7 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
snprintf(dst_path, sizeof(dst_path),
|
snprintf(dst_path, sizeof(dst_path),
|
||||||
"%s/%s", xtrabackup_target_dir,
|
"%s/%s", xtrabackup_target_dir,
|
||||||
path);
|
path);
|
||||||
msg_ts("Removing %s\n", dst_path);
|
msg("Removing %s", dst_path);
|
||||||
unlink(dst_path);
|
unlink(dst_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1375,7 +1365,7 @@ backup_files(const char *from, bool prep_mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Finished %s non-InnoDB tables and files\n",
|
msg("Finished %s non-InnoDB tables and files",
|
||||||
prep_mode ? "a prep copy of" : "backing up");
|
prep_mode ? "a prep copy of" : "backing up");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
@@ -1447,7 +1437,7 @@ bool backup_start()
|
|||||||
rocksdb_create_checkpoint();
|
rocksdb_create_checkpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Waiting for log copy thread to read lsn %llu\n", (ulonglong)server_lsn_after_lock);
|
msg("Waiting for log copy thread to read lsn %llu", (ulonglong)server_lsn_after_lock);
|
||||||
backup_wait_for_lsn(server_lsn_after_lock);
|
backup_wait_for_lsn(server_lsn_after_lock);
|
||||||
backup_fix_ddl();
|
backup_fix_ddl();
|
||||||
|
|
||||||
@@ -1490,7 +1480,7 @@ bool backup_start()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (have_flush_engine_logs && !opt_no_lock) {
|
if (have_flush_engine_logs && !opt_no_lock) {
|
||||||
msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...\n");
|
msg("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...");
|
||||||
xb_mysql_query(mysql_connection,
|
xb_mysql_query(mysql_connection,
|
||||||
"FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS", false);
|
"FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS", false);
|
||||||
}
|
}
|
||||||
@@ -1514,7 +1504,7 @@ void backup_release()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opt_safe_slave_backup && sql_thread_started) {
|
if (opt_safe_slave_backup && sql_thread_started) {
|
||||||
msg("Starting slave SQL thread\n");
|
msg("Starting slave SQL thread");
|
||||||
xb_mysql_query(mysql_connection,
|
xb_mysql_query(mysql_connection,
|
||||||
"START SLAVE SQL_THREAD", false);
|
"START SLAVE SQL_THREAD", false);
|
||||||
}
|
}
|
||||||
@@ -1540,12 +1530,12 @@ bool backup_finish()
|
|||||||
rocksdb_backup_checkpoint();
|
rocksdb_backup_checkpoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Backup created in directory '%s'\n", xtrabackup_target_dir);
|
msg("Backup created in directory '%s'", xtrabackup_target_dir);
|
||||||
if (mysql_binlog_position != NULL) {
|
if (mysql_binlog_position != NULL) {
|
||||||
msg("MySQL binlog position: %s\n", mysql_binlog_position);
|
msg("MySQL binlog position: %s", mysql_binlog_position);
|
||||||
}
|
}
|
||||||
if (mysql_slave_position && opt_slave_info) {
|
if (mysql_slave_position && opt_slave_info) {
|
||||||
msg("MySQL slave binlog position: %s\n",
|
msg("MySQL slave binlog position: %s",
|
||||||
mysql_slave_position);
|
mysql_slave_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1605,7 +1595,7 @@ ibx_copy_incremental_over_full()
|
|||||||
|
|
||||||
if (!(ret = copy_file(ds_data, node.filepath,
|
if (!(ret = copy_file(ds_data, node.filepath,
|
||||||
node.filepath_rel, 1))) {
|
node.filepath_rel, 1))) {
|
||||||
msg("Failed to copy file %s\n",
|
msg("Failed to copy file %s",
|
||||||
node.filepath);
|
node.filepath);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -1745,7 +1735,7 @@ copy_back()
|
|||||||
/* cd to backup directory */
|
/* cd to backup directory */
|
||||||
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
|
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
|
||||||
{
|
{
|
||||||
msg("cannot my_setwd %s\n", xtrabackup_target_dir);
|
msg("Can't my_setwd %s", xtrabackup_target_dir);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1758,7 +1748,7 @@ copy_back()
|
|||||||
srv_sys_space.set_path(".");
|
srv_sys_space.set_path(".");
|
||||||
|
|
||||||
if (!srv_sys_space.parse_params(innobase_data_file_path, true)) {
|
if (!srv_sys_space.parse_params(innobase_data_file_path, true)) {
|
||||||
msg("syntax error in innodb_data_file_path\n");
|
msg("syntax error in innodb_data_file_path");
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1872,12 +1862,12 @@ copy_back()
|
|||||||
snprintf(path, sizeof(path), "%s/%s",
|
snprintf(path, sizeof(path), "%s/%s",
|
||||||
mysql_data_home, node.filepath_rel);
|
mysql_data_home, node.filepath_rel);
|
||||||
|
|
||||||
msg_ts("[%02u] Creating directory %s\n", 1, path);
|
msg("Creating directory %s", path);
|
||||||
|
|
||||||
if (mkdirp(path, 0777, MYF(0)) < 0) {
|
if (mkdirp(path, 0777, MYF(0)) < 0) {
|
||||||
char errbuf[MYSYS_STRERROR_SIZE];
|
char errbuf[MYSYS_STRERROR_SIZE];
|
||||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||||
msg("Can not create directory %s: %s\n",
|
msg("Can not create directory %s: %s",
|
||||||
path, errbuf);
|
path, errbuf);
|
||||||
ret = false;
|
ret = false;
|
||||||
|
|
||||||
@@ -1885,7 +1875,7 @@ copy_back()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("[%02u] ...done.", 1);
|
msg(" ...done.");
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1995,14 +1985,14 @@ decrypt_decompress_file(const char *filepath, uint thread_n)
|
|||||||
|
|
||||||
if (needs_action) {
|
if (needs_action) {
|
||||||
|
|
||||||
msg_ts("[%02u] %s\n", thread_n, message.str().c_str());
|
msg(thread_n,"%s\n", message.str().c_str());
|
||||||
|
|
||||||
if (system(cmd.str().c_str()) != 0) {
|
if (system(cmd.str().c_str()) != 0) {
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_remove_original) {
|
if (opt_remove_original) {
|
||||||
msg_ts("[%02u] removing %s\n", thread_n, filepath);
|
msg(thread_n, "Removing %s", filepath);
|
||||||
if (my_delete(filepath, MYF(MY_WME)) != 0) {
|
if (my_delete(filepath, MYF(MY_WME)) != 0) {
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
@@ -2065,7 +2055,7 @@ decrypt_decompress()
|
|||||||
/* cd to backup directory */
|
/* cd to backup directory */
|
||||||
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
|
if (my_setwd(xtrabackup_target_dir, MYF(MY_WME)))
|
||||||
{
|
{
|
||||||
msg("cannot my_setwd %s\n", xtrabackup_target_dir);
|
msg("Can't my_setwd %s", xtrabackup_target_dir);
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2215,8 +2205,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
|
|||||||
rc = make_hardlink(from_path, to_path);
|
rc = make_hardlink(from_path, to_path);
|
||||||
if (rc)
|
if (rc)
|
||||||
{
|
{
|
||||||
msg_ts("[%02u] Creating hardlink from %s to %s\n",
|
msg("Creating hardlink from %s to %s",from_path, to_path);
|
||||||
1, from_path, to_path);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2250,14 +2239,14 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo
|
|||||||
*/
|
*/
|
||||||
static void rocksdb_lock_checkpoint()
|
static void rocksdb_lock_checkpoint()
|
||||||
{
|
{
|
||||||
msg_ts("Obtaining rocksdb checkpoint lock.\n");
|
msg("Obtaining rocksdb checkpoint lock.");
|
||||||
MYSQL_RES *res =
|
MYSQL_RES *res =
|
||||||
xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true);
|
xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true);
|
||||||
|
|
||||||
MYSQL_ROW r = mysql_fetch_row(res);
|
MYSQL_ROW r = mysql_fetch_row(res);
|
||||||
if (r && r[0] && strcmp(r[0], "1"))
|
if (r && r[0] && strcmp(r[0], "1"))
|
||||||
{
|
{
|
||||||
msg_ts("Could not obtain rocksdb checkpont lock\n");
|
msg("Could not obtain rocksdb checkpont lock.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
mysql_free_result(res);
|
mysql_free_result(res);
|
||||||
@@ -2311,7 +2300,7 @@ static void rocksdb_create_checkpoint()
|
|||||||
|
|
||||||
if (!access(rocksdb_checkpoint_dir, 0))
|
if (!access(rocksdb_checkpoint_dir, 0))
|
||||||
{
|
{
|
||||||
msg_ts("Removing rocksdb checkpoint from previous backup attempt.\n");
|
msg("Removing rocksdb checkpoint from previous backup attempt.");
|
||||||
rocksdb_remove_checkpoint_directory();
|
rocksdb_remove_checkpoint_directory();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2327,14 +2316,14 @@ static void rocksdb_create_checkpoint()
|
|||||||
*/
|
*/
|
||||||
static void rocksdb_backup_checkpoint()
|
static void rocksdb_backup_checkpoint()
|
||||||
{
|
{
|
||||||
msg_ts("Backing up rocksdb files.\n");
|
msg("Backing up rocksdb files.");
|
||||||
char rocksdb_backup_dir[FN_REFLEN];
|
char rocksdb_backup_dir[FN_REFLEN];
|
||||||
snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir);
|
snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir);
|
||||||
bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE;
|
bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE;
|
||||||
if (backup_to_directory)
|
if (backup_to_directory)
|
||||||
{
|
{
|
||||||
if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){
|
if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){
|
||||||
msg_ts("Can't create rocksdb backup directory %s\n", rocksdb_backup_dir);
|
msg("Can't create rocksdb backup directory %s", rocksdb_backup_dir);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ xb_mysql_connect()
|
|||||||
sprintf(mysql_port_str, "%d", opt_port);
|
sprintf(mysql_port_str, "%d", opt_port);
|
||||||
|
|
||||||
if (connection == NULL) {
|
if (connection == NULL) {
|
||||||
msg("Failed to init MySQL struct: %s.\n",
|
msg("Failed to init MySQL struct: %s.",
|
||||||
mysql_error(connection));
|
mysql_error(connection));
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@@ -120,8 +120,8 @@ xb_mysql_connect()
|
|||||||
mysql_options(connection, MYSQL_OPT_PROTOCOL, &opt_protocol);
|
mysql_options(connection, MYSQL_OPT_PROTOCOL, &opt_protocol);
|
||||||
mysql_options(connection,MYSQL_SET_CHARSET_NAME, "utf8");
|
mysql_options(connection,MYSQL_SET_CHARSET_NAME, "utf8");
|
||||||
|
|
||||||
msg_ts("Connecting to MySQL server host: %s, user: %s, password: %s, "
|
msg("Connecting to MySQL server host: %s, user: %s, password: %s, "
|
||||||
"port: %s, socket: %s\n", opt_host ? opt_host : "localhost",
|
"port: %s, socket: %s", opt_host ? opt_host : "localhost",
|
||||||
opt_user ? opt_user : "not set",
|
opt_user ? opt_user : "not set",
|
||||||
opt_password ? "set" : "not set",
|
opt_password ? "set" : "not set",
|
||||||
opt_port != 0 ? mysql_port_str : "not set",
|
opt_port != 0 ? mysql_port_str : "not set",
|
||||||
@@ -147,8 +147,7 @@ xb_mysql_connect()
|
|||||||
opt_password,
|
opt_password,
|
||||||
"" /*database*/, opt_port,
|
"" /*database*/, opt_port,
|
||||||
opt_socket, 0)) {
|
opt_socket, 0)) {
|
||||||
msg("Failed to connect to MySQL server: %s.\n",
|
msg("Failed to connect to MySQL server: %s.", mysql_error(connection));
|
||||||
mysql_error(connection));
|
|
||||||
mysql_close(connection);
|
mysql_close(connection);
|
||||||
return(NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
@@ -168,8 +167,7 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
|
|||||||
MYSQL_RES *mysql_result = NULL;
|
MYSQL_RES *mysql_result = NULL;
|
||||||
|
|
||||||
if (mysql_query(connection, query)) {
|
if (mysql_query(connection, query)) {
|
||||||
msg("Error: failed to execute query %s: %s\n", query,
|
msg("Error: failed to execute query %s: %s", query, mysql_error(connection));
|
||||||
mysql_error(connection));
|
|
||||||
if (die_on_error) {
|
if (die_on_error) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -179,7 +177,7 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result,
|
|||||||
/* store result set on client if there is a result */
|
/* store result set on client if there is a result */
|
||||||
if (mysql_field_count(connection) > 0) {
|
if (mysql_field_count(connection) > 0) {
|
||||||
if ((mysql_result = mysql_store_result(connection)) == NULL) {
|
if ((mysql_result = mysql_store_result(connection)) == NULL) {
|
||||||
msg("Error: failed to fetch query result %s: %s\n",
|
msg("Error: failed to fetch query result %s: %s",
|
||||||
query, mysql_error(connection));
|
query, mysql_error(connection));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -316,11 +314,11 @@ check_server_version(unsigned long version_number,
|
|||||||
msg("Error: Built-in InnoDB in MySQL 5.1 is not "
|
msg("Error: Built-in InnoDB in MySQL 5.1 is not "
|
||||||
"supported in this release. You can either use "
|
"supported in this release. You can either use "
|
||||||
"Percona XtraBackup 2.0, or upgrade to InnoDB "
|
"Percona XtraBackup 2.0, or upgrade to InnoDB "
|
||||||
"plugin.\n");
|
"plugin.");
|
||||||
} else if (!version_supported) {
|
} else if (!version_supported) {
|
||||||
msg("Error: Unsupported server version: '%s'. Please "
|
msg("Error: Unsupported server version: '%s'. Please "
|
||||||
"report a bug at "
|
"report a bug at "
|
||||||
"https://bugs.launchpad.net/percona-xtrabackup\n",
|
"https://bugs.launchpad.net/percona-xtrabackup",
|
||||||
version_string);
|
version_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,7 +405,7 @@ get_mysql_vars(MYSQL *connection)
|
|||||||
opt_binlog_info == BINLOG_INFO_LOCKLESS) {
|
opt_binlog_info == BINLOG_INFO_LOCKLESS) {
|
||||||
|
|
||||||
msg("Error: --binlog-info=LOCKLESS is not supported by the "
|
msg("Error: --binlog-info=LOCKLESS is not supported by the "
|
||||||
"server\n");
|
"server");
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +443,7 @@ get_mysql_vars(MYSQL *connection)
|
|||||||
have_gtid_slave = true;
|
have_gtid_slave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg("Using server version %s\n", version_var);
|
msg("Using server version %s", version_var);
|
||||||
|
|
||||||
if (!(ret = detect_mysql_capabilities_for_backup())) {
|
if (!(ret = detect_mysql_capabilities_for_backup())) {
|
||||||
goto out;
|
goto out;
|
||||||
@@ -455,17 +453,17 @@ get_mysql_vars(MYSQL *connection)
|
|||||||
if (check_if_param_set("datadir")) {
|
if (check_if_param_set("datadir")) {
|
||||||
if (!directory_exists(mysql_data_home, false)) {
|
if (!directory_exists(mysql_data_home, false)) {
|
||||||
msg("Warning: option 'datadir' points to "
|
msg("Warning: option 'datadir' points to "
|
||||||
"nonexistent directory '%s'\n", mysql_data_home);
|
"nonexistent directory '%s'", mysql_data_home);
|
||||||
}
|
}
|
||||||
if (!directory_exists(datadir_var, false)) {
|
if (!directory_exists(datadir_var, false)) {
|
||||||
msg("Warning: MySQL variable 'datadir' points to "
|
msg("Warning: MySQL variable 'datadir' points to "
|
||||||
"nonexistent directory '%s'\n", datadir_var);
|
"nonexistent directory '%s'", datadir_var);
|
||||||
}
|
}
|
||||||
if (!equal_paths(mysql_data_home, datadir_var)) {
|
if (!equal_paths(mysql_data_home, datadir_var)) {
|
||||||
msg("Warning: option 'datadir' has different "
|
msg("Warning: option 'datadir' has different "
|
||||||
"values:\n"
|
"values:\n"
|
||||||
" '%s' in defaults file\n"
|
" '%s' in defaults file\n"
|
||||||
" '%s' in SHOW VARIABLES\n",
|
" '%s' in SHOW VARIABLES",
|
||||||
mysql_data_home, datadir_var);
|
mysql_data_home, datadir_var);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -564,14 +562,14 @@ detect_mysql_capabilities_for_backup()
|
|||||||
if (opt_galera_info && !have_galera_enabled) {
|
if (opt_galera_info && !have_galera_enabled) {
|
||||||
msg("--galera-info is specified on the command "
|
msg("--galera-info is specified on the command "
|
||||||
"line, but the server does not support Galera "
|
"line, but the server does not support Galera "
|
||||||
"replication. Ignoring the option.\n");
|
"replication. Ignoring the option.");
|
||||||
opt_galera_info = false;
|
opt_galera_info = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_slave_info && have_multi_threaded_slave &&
|
if (opt_slave_info && have_multi_threaded_slave &&
|
||||||
!have_gtid_slave) {
|
!have_gtid_slave) {
|
||||||
msg("The --slave-info option requires GTID enabled for a "
|
msg("The --slave-info option requires GTID enabled for a "
|
||||||
"multi-threaded slave.\n");
|
"multi-threaded slave.");
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -618,7 +616,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
|||||||
const MYSQL_ROW row = mysql_fetch_row(mysql_result);
|
const MYSQL_ROW row = mysql_fetch_row(mysql_result);
|
||||||
if (row) {
|
if (row) {
|
||||||
*incremental_lsn = strtoull(row[0], NULL, 10);
|
*incremental_lsn = strtoull(row[0], NULL, 10);
|
||||||
msg("Found and using lsn: " LSN_PF " for %s %s\n",
|
msg("Found and using lsn: " LSN_PF " for %s %s",
|
||||||
*incremental_lsn,
|
*incremental_lsn,
|
||||||
opt_incremental_history_uuid ? "uuid" : "name",
|
opt_incremental_history_uuid ? "uuid" : "name",
|
||||||
opt_incremental_history_uuid ?
|
opt_incremental_history_uuid ?
|
||||||
@@ -626,7 +624,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
|||||||
opt_incremental_history_name);
|
opt_incremental_history_name);
|
||||||
} else {
|
} else {
|
||||||
msg("Error while attempting to find history record "
|
msg("Error while attempting to find history record "
|
||||||
"for %s %s\n",
|
"for %s %s",
|
||||||
opt_incremental_history_uuid ? "uuid" : "name",
|
opt_incremental_history_uuid ? "uuid" : "name",
|
||||||
opt_incremental_history_uuid ?
|
opt_incremental_history_uuid ?
|
||||||
opt_incremental_history_uuid :
|
opt_incremental_history_uuid :
|
||||||
@@ -736,7 +734,7 @@ have_queries_to_wait_for(MYSQL *connection, uint threshold)
|
|||||||
&& duration >= (int)threshold
|
&& duration >= (int)threshold
|
||||||
&& ((all_queries && is_query(info))
|
&& ((all_queries && is_query(info))
|
||||||
|| is_update_query(info))) {
|
|| is_update_query(info))) {
|
||||||
msg_ts("Waiting for query %s (duration %d sec): %s",
|
msg("Waiting for query %s (duration %d sec): %s",
|
||||||
id, duration, info);
|
id, duration, info);
|
||||||
have_to_wait = true;
|
have_to_wait = true;
|
||||||
break;
|
break;
|
||||||
@@ -765,7 +763,7 @@ kill_long_queries(MYSQL *connection, time_t timeout)
|
|||||||
(time_t)duration >= timeout &&
|
(time_t)duration >= timeout &&
|
||||||
((all_queries && is_query(info)) ||
|
((all_queries && is_query(info)) ||
|
||||||
is_select_query(info))) {
|
is_select_query(info))) {
|
||||||
msg_ts("Killing query %s (duration %d sec): %s\n",
|
msg("Killing query %s (duration %d sec): %s",
|
||||||
id, (int)duration, info);
|
id, (int)duration, info);
|
||||||
snprintf(kill_stmt, sizeof(kill_stmt),
|
snprintf(kill_stmt, sizeof(kill_stmt),
|
||||||
"KILL %s", id);
|
"KILL %s", id);
|
||||||
@@ -784,8 +782,8 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
|
|||||||
|
|
||||||
start_time = time(NULL);
|
start_time = time(NULL);
|
||||||
|
|
||||||
msg_ts("Waiting %u seconds for queries running longer than %u seconds "
|
msg("Waiting %u seconds for queries running longer than %u seconds "
|
||||||
"to finish\n", timeout, threshold);
|
"to finish", timeout, threshold);
|
||||||
|
|
||||||
while (time(NULL) <= (time_t)(start_time + timeout)) {
|
while (time(NULL) <= (time_t)(start_time + timeout)) {
|
||||||
if (!have_queries_to_wait_for(connection, threshold)) {
|
if (!have_queries_to_wait_for(connection, threshold)) {
|
||||||
@@ -794,7 +792,7 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
|
|||||||
os_thread_sleep(1000000);
|
os_thread_sleep(1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Unable to obtain lock. Please try again later.");
|
msg("Unable to obtain lock. Please try again later.");
|
||||||
|
|
||||||
return(false);
|
return(false);
|
||||||
}
|
}
|
||||||
@@ -812,7 +810,7 @@ kill_query_thread(
|
|||||||
|
|
||||||
os_event_set(kill_query_thread_started);
|
os_event_set(kill_query_thread_started);
|
||||||
|
|
||||||
msg_ts("Kill query timeout %d seconds.\n",
|
msg("Kill query timeout %d seconds.",
|
||||||
opt_kill_long_queries_timeout);
|
opt_kill_long_queries_timeout);
|
||||||
|
|
||||||
while (time(NULL) - start_time <
|
while (time(NULL) - start_time <
|
||||||
@@ -824,7 +822,7 @@ kill_query_thread(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((mysql = xb_mysql_connect()) == NULL) {
|
if ((mysql = xb_mysql_connect()) == NULL) {
|
||||||
msg("Error: kill query thread failed\n");
|
msg("Error: kill query thread failed");
|
||||||
goto stop_thread;
|
goto stop_thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -839,7 +837,7 @@ kill_query_thread(
|
|||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
|
|
||||||
stop_thread:
|
stop_thread:
|
||||||
msg_ts("Kill query thread stopped\n");
|
msg("Kill query thread stopped");
|
||||||
|
|
||||||
os_event_set(kill_query_thread_stopped);
|
os_event_set(kill_query_thread_stopped);
|
||||||
|
|
||||||
@@ -889,7 +887,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *))
|
|||||||
{
|
{
|
||||||
MYSQL *mysql;
|
MYSQL *mysql;
|
||||||
if ((mysql = xb_mysql_connect()) == NULL) {
|
if ((mysql = xb_mysql_connect()) == NULL) {
|
||||||
msg("Error: kill mdl waiters thread failed to connect\n");
|
msg("Error: kill mdl waiters thread failed to connect");
|
||||||
goto stop_thread;
|
goto stop_thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -908,11 +906,11 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *))
|
|||||||
if (row[1] && !strcmp(row[1], "Killed"))
|
if (row[1] && !strcmp(row[1], "Killed"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
msg_ts("Killing MDL waiting %s ('%s') on connection %s\n",
|
msg("Killing MDL waiting %s ('%s') on connection %s",
|
||||||
row[1], row[2], row[0]);
|
row[1], row[2], row[0]);
|
||||||
snprintf(query, sizeof(query), "KILL QUERY %s", row[0]);
|
snprintf(query, sizeof(query), "KILL QUERY %s", row[0]);
|
||||||
if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) {
|
if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) {
|
||||||
msg("Error: failed to execute query %s: %s\n", query,mysql_error(mysql));
|
msg("Error: failed to execute query %s: %s", query,mysql_error(mysql));
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -922,7 +920,7 @@ DECLARE_THREAD(kill_mdl_waiters_thread(void *))
|
|||||||
mysql_close(mysql);
|
mysql_close(mysql);
|
||||||
|
|
||||||
stop_thread:
|
stop_thread:
|
||||||
msg_ts("Kill mdl waiters thread stopped\n");
|
msg("Kill mdl waiters thread stopped");
|
||||||
os_event_set(mdl_killer_finished_event);
|
os_event_set(mdl_killer_finished_event);
|
||||||
os_thread_exit();
|
os_thread_exit();
|
||||||
return os_thread_ret_t(0);
|
return os_thread_ret_t(0);
|
||||||
@@ -964,7 +962,7 @@ lock_tables(MYSQL *connection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (have_backup_locks) {
|
if (have_backup_locks) {
|
||||||
msg_ts("Executing LOCK TABLES FOR BACKUP...\n");
|
msg("Executing LOCK TABLES FOR BACKUP...");
|
||||||
xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
|
xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false);
|
||||||
return(true);
|
return(true);
|
||||||
}
|
}
|
||||||
@@ -987,7 +985,7 @@ lock_tables(MYSQL *connection)
|
|||||||
compatible with this trick.
|
compatible with this trick.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n");
|
msg("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...");
|
||||||
|
|
||||||
xb_mysql_query(connection,
|
xb_mysql_query(connection,
|
||||||
"FLUSH NO_WRITE_TO_BINLOG TABLES", false);
|
"FLUSH NO_WRITE_TO_BINLOG TABLES", false);
|
||||||
@@ -1000,7 +998,7 @@ lock_tables(MYSQL *connection)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n");
|
msg("Executing FLUSH TABLES WITH READ LOCK...");
|
||||||
|
|
||||||
if (opt_kill_long_queries_timeout) {
|
if (opt_kill_long_queries_timeout) {
|
||||||
start_query_killer();
|
start_query_killer();
|
||||||
@@ -1033,7 +1031,7 @@ bool
|
|||||||
lock_binlog_maybe(MYSQL *connection)
|
lock_binlog_maybe(MYSQL *connection)
|
||||||
{
|
{
|
||||||
if (have_backup_locks && !opt_no_lock && !binlog_locked) {
|
if (have_backup_locks && !opt_no_lock && !binlog_locked) {
|
||||||
msg_ts("Executing LOCK BINLOG FOR BACKUP...\n");
|
msg("Executing LOCK BINLOG FOR BACKUP...");
|
||||||
xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP", false);
|
xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP", false);
|
||||||
binlog_locked = true;
|
binlog_locked = true;
|
||||||
|
|
||||||
@@ -1052,20 +1050,20 @@ void
|
|||||||
unlock_all(MYSQL *connection)
|
unlock_all(MYSQL *connection)
|
||||||
{
|
{
|
||||||
if (opt_debug_sleep_before_unlock) {
|
if (opt_debug_sleep_before_unlock) {
|
||||||
msg_ts("Debug sleep for %u seconds\n",
|
msg("Debug sleep for %u seconds",
|
||||||
opt_debug_sleep_before_unlock);
|
opt_debug_sleep_before_unlock);
|
||||||
os_thread_sleep(opt_debug_sleep_before_unlock * 1000);
|
os_thread_sleep(opt_debug_sleep_before_unlock * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (binlog_locked) {
|
if (binlog_locked) {
|
||||||
msg_ts("Executing UNLOCK BINLOG\n");
|
msg("Executing UNLOCK BINLOG");
|
||||||
xb_mysql_query(connection, "UNLOCK BINLOG", false);
|
xb_mysql_query(connection, "UNLOCK BINLOG", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Executing UNLOCK TABLES\n");
|
msg("Executing UNLOCK TABLES");
|
||||||
xb_mysql_query(connection, "UNLOCK TABLES", false);
|
xb_mysql_query(connection, "UNLOCK TABLES", false);
|
||||||
|
|
||||||
msg_ts("All tables unlocked\n");
|
msg("All tables unlocked");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1116,7 +1114,7 @@ wait_for_safe_slave(MYSQL *connection)
|
|||||||
|
|
||||||
if (!(read_master_log_pos && slave_sql_running)) {
|
if (!(read_master_log_pos && slave_sql_running)) {
|
||||||
msg("Not checking slave open temp tables for "
|
msg("Not checking slave open temp tables for "
|
||||||
"--safe-slave-backup because host is not a slave\n");
|
"--safe-slave-backup because host is not a slave");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1130,36 +1128,36 @@ wait_for_safe_slave(MYSQL *connection)
|
|||||||
}
|
}
|
||||||
|
|
||||||
open_temp_tables = get_open_temp_tables(connection);
|
open_temp_tables = get_open_temp_tables(connection);
|
||||||
msg_ts("Slave open temp tables: %d\n", open_temp_tables);
|
msg("Slave open temp tables: %d", open_temp_tables);
|
||||||
|
|
||||||
while (open_temp_tables && n_attempts--) {
|
while (open_temp_tables && n_attempts--) {
|
||||||
msg_ts("Starting slave SQL thread, waiting %d seconds, then "
|
msg("Starting slave SQL thread, waiting %d seconds, then "
|
||||||
"checking Slave_open_temp_tables again (%d attempts "
|
"checking Slave_open_temp_tables again (%d attempts "
|
||||||
"remaining)...\n", sleep_time, n_attempts);
|
"remaining)...", sleep_time, n_attempts);
|
||||||
|
|
||||||
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
||||||
os_thread_sleep(sleep_time * 1000000);
|
os_thread_sleep(sleep_time * 1000000);
|
||||||
xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false);
|
xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false);
|
||||||
|
|
||||||
open_temp_tables = get_open_temp_tables(connection);
|
open_temp_tables = get_open_temp_tables(connection);
|
||||||
msg_ts("Slave open temp tables: %d\n", open_temp_tables);
|
msg("Slave open temp tables: %d", open_temp_tables);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Restart the slave if it was running at start */
|
/* Restart the slave if it was running at start */
|
||||||
if (open_temp_tables == 0) {
|
if (open_temp_tables == 0) {
|
||||||
msg_ts("Slave is safe to backup\n");
|
msg("Slave is safe to backup");
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = false;
|
result = false;
|
||||||
|
|
||||||
if (sql_thread_started) {
|
if (sql_thread_started) {
|
||||||
msg_ts("Restarting slave SQL thread.\n");
|
msg("Restarting slave SQL thread.");
|
||||||
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg_ts("Slave_open_temp_tables did not become zero after "
|
msg("Slave_open_temp_tables did not become zero after "
|
||||||
"%d seconds\n", opt_safe_slave_backup_timeout);
|
"%d seconds", opt_safe_slave_backup_timeout);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
free_mysql_variables(status);
|
free_mysql_variables(status);
|
||||||
@@ -1201,10 +1199,8 @@ write_slave_info(MYSQL *connection)
|
|||||||
|
|
||||||
if (master == NULL || filename == NULL || position == NULL) {
|
if (master == NULL || filename == NULL || position == NULL) {
|
||||||
msg("Failed to get master binlog coordinates "
|
msg("Failed to get master binlog coordinates "
|
||||||
"from SHOW SLAVE STATUS\n");
|
"from SHOW SLAVE STATUS.This means that the server is not a "
|
||||||
msg("This means that the server is not a "
|
"replication slave. Ignoring the --slave-info option");
|
||||||
"replication slave. Ignoring the --slave-info "
|
|
||||||
"option\n");
|
|
||||||
/* we still want to continue the backup */
|
/* we still want to continue the backup */
|
||||||
result = true;
|
result = true;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
@@ -1287,7 +1283,7 @@ write_galera_info(MYSQL *connection)
|
|||||||
|
|
||||||
if ((state_uuid == NULL && state_uuid55 == NULL)
|
if ((state_uuid == NULL && state_uuid55 == NULL)
|
||||||
|| (last_committed == NULL && last_committed55 == NULL)) {
|
|| (last_committed == NULL && last_committed55 == NULL)) {
|
||||||
msg("Failed to get master wsrep state from SHOW STATUS.\n");
|
msg("Failed to get master wsrep state from SHOW STATUS.");
|
||||||
result = false;
|
result = false;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -1800,9 +1796,9 @@ mdl_lock_table(ulint space_id)
|
|||||||
|
|
||||||
std::ostringstream lock_query;
|
std::ostringstream lock_query;
|
||||||
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
|
lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0";
|
||||||
msg_ts("Locking MDL for %s\n", full_table_name.c_str());
|
msg("Locking MDL for %s", full_table_name.c_str());
|
||||||
if (mysql_query(mdl_con, lock_query.str().c_str())) {
|
if (mysql_query(mdl_con, lock_query.str().c_str())) {
|
||||||
msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str());
|
msg("Warning : locking MDL failed for space id %zu, name %s", space_id, full_table_name.c_str());
|
||||||
} else {
|
} else {
|
||||||
MYSQL_RES *r = mysql_store_result(mdl_con);
|
MYSQL_RES *r = mysql_store_result(mdl_con);
|
||||||
mysql_free_result(r);
|
mysql_free_result(r);
|
||||||
@@ -1812,7 +1808,7 @@ mdl_lock_table(ulint space_id)
|
|||||||
void
|
void
|
||||||
mdl_unlock_all()
|
mdl_unlock_all()
|
||||||
{
|
{
|
||||||
msg_ts("Unlocking MDL for all tables\n");
|
msg("Unlocking MDL for all tables");
|
||||||
xb_mysql_query(mdl_con, "COMMIT", false, true);
|
xb_mysql_query(mdl_con, "COMMIT", false, true);
|
||||||
mysql_close(mdl_con);
|
mysql_close(mdl_con);
|
||||||
spaceid_to_tablename.clear();
|
spaceid_to_tablename.clear();
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ log_online_read_bitmap_page(
|
|||||||
/* The following call prints an error message */
|
/* The following call prints an error message */
|
||||||
os_file_get_last_error(TRUE);
|
os_file_get_last_error(TRUE);
|
||||||
msg("InnoDB: Warning: failed reading changed page bitmap "
|
msg("InnoDB: Warning: failed reading changed page bitmap "
|
||||||
"file \'%s\'\n", bitmap_file->name);
|
"file \'%s\'", bitmap_file->name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,7 +281,7 @@ log_online_setup_bitmap_file_range(
|
|||||||
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
|
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
|
||||||
if (UNIV_UNLIKELY(!bitmap_dir)) {
|
if (UNIV_UNLIKELY(!bitmap_dir)) {
|
||||||
|
|
||||||
msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n",
|
msg("InnoDB: Error: failed to open bitmap directory \'%s\'",
|
||||||
srv_data_home);
|
srv_data_home);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -331,7 +331,7 @@ log_online_setup_bitmap_file_range(
|
|||||||
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
|
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
|
||||||
|
|
||||||
os_file_get_last_error(TRUE);
|
os_file_get_last_error(TRUE);
|
||||||
msg("InnoDB: Error: cannot close \'%s\'\n",srv_data_home);
|
msg("InnoDB: Error: cannot close \'%s\'",srv_data_home);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,7 +348,7 @@ log_online_setup_bitmap_file_range(
|
|||||||
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
|
bitmap_dir = os_file_opendir(srv_data_home, FALSE);
|
||||||
if (UNIV_UNLIKELY(!bitmap_dir)) {
|
if (UNIV_UNLIKELY(!bitmap_dir)) {
|
||||||
|
|
||||||
msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n",
|
msg("InnoDB: Error: failed to open bitmap directory \'%s\'",
|
||||||
srv_data_home);
|
srv_data_home);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -379,7 +379,7 @@ log_online_setup_bitmap_file_range(
|
|||||||
if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
|
if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) {
|
||||||
|
|
||||||
msg("InnoDB: Error: inconsistent bitmap file "
|
msg("InnoDB: Error: inconsistent bitmap file "
|
||||||
"directory\n");
|
"directory");
|
||||||
free(bitmap_files->files);
|
free(bitmap_files->files);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -399,7 +399,7 @@ log_online_setup_bitmap_file_range(
|
|||||||
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
|
if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) {
|
||||||
|
|
||||||
os_file_get_last_error(TRUE);
|
os_file_get_last_error(TRUE);
|
||||||
msg("InnoDB: Error: cannot close \'%s\'\n", srv_data_home);
|
msg("InnoDB: Error: cannot close \'%s\'", srv_data_home);
|
||||||
free(bitmap_files->files);
|
free(bitmap_files->files);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@@ -450,7 +450,7 @@ log_online_open_bitmap_file_read_only(
|
|||||||
/* Here and below assume that bitmap file names do not
|
/* Here and below assume that bitmap file names do not
|
||||||
contain apostrophes, thus no need for ut_print_filename(). */
|
contain apostrophes, thus no need for ut_print_filename(). */
|
||||||
msg("InnoDB: Warning: error opening the changed page "
|
msg("InnoDB: Warning: error opening the changed page "
|
||||||
"bitmap \'%s\'\n", bitmap_file->name);
|
"bitmap \'%s\'", bitmap_file->name);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -494,7 +494,7 @@ log_online_diagnose_bitmap_eof(
|
|||||||
itself. */
|
itself. */
|
||||||
|
|
||||||
msg("InnoDB: Warning: junk at the end of changed "
|
msg("InnoDB: Warning: junk at the end of changed "
|
||||||
"page bitmap file \'%s\'.\n", bitmap_file->name);
|
"page bitmap file \'%s\'.", bitmap_file->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (UNIV_UNLIKELY(!last_page_in_run)) {
|
if (UNIV_UNLIKELY(!last_page_in_run)) {
|
||||||
@@ -505,7 +505,7 @@ log_online_diagnose_bitmap_eof(
|
|||||||
for the whole server */
|
for the whole server */
|
||||||
msg("InnoDB: Warning: changed page bitmap "
|
msg("InnoDB: Warning: changed page bitmap "
|
||||||
"file \'%s\' does not contain a complete run "
|
"file \'%s\' does not contain a complete run "
|
||||||
"at the end.\n", bitmap_file->name);
|
"at the end.", bitmap_file->name);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -536,7 +536,7 @@ xb_msg_missing_lsn_data(
|
|||||||
lsn_t missing_interval_end) /*!<in: interval end */
|
lsn_t missing_interval_end) /*!<in: interval end */
|
||||||
{
|
{
|
||||||
msg("mariabackup: warning: changed page data missing for LSNs between "
|
msg("mariabackup: warning: changed page data missing for LSNs between "
|
||||||
LSN_PF " and " LSN_PF "\n", missing_interval_start,
|
LSN_PF " and " LSN_PF, missing_interval_start,
|
||||||
missing_interval_end);
|
missing_interval_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -614,7 +614,7 @@ xb_page_bitmap_init(void)
|
|||||||
|
|
||||||
msg("mariabackup: incremental backup LSN " LSN_PF
|
msg("mariabackup: incremental backup LSN " LSN_PF
|
||||||
" is larger than than the last checkpoint LSN " LSN_PF
|
" is larger than than the last checkpoint LSN " LSN_PF
|
||||||
"\n", bmp_start_lsn, bmp_end_lsn);
|
, bmp_start_lsn, bmp_end_lsn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,7 +698,7 @@ xb_page_bitmap_init(void)
|
|||||||
bmp_start_lsn))) {
|
bmp_start_lsn))) {
|
||||||
|
|
||||||
msg("mariabackup: Warning: changed page bitmap file "
|
msg("mariabackup: Warning: changed page bitmap file "
|
||||||
"\'%s\' corrupted\n", bitmap_file.name);
|
"\'%s\' corrupted", bitmap_file.name);
|
||||||
rbt_free(result);
|
rbt_free(result);
|
||||||
free(bitmap_files.files);
|
free(bitmap_files.files);
|
||||||
os_file_close(bitmap_file.file);
|
os_file_close(bitmap_file.file);
|
||||||
@@ -803,7 +803,7 @@ xb_page_bitmap_init(void)
|
|||||||
if (UNIV_UNLIKELY(!last_page_ok)) {
|
if (UNIV_UNLIKELY(!last_page_ok)) {
|
||||||
|
|
||||||
msg("mariabackup: warning: changed page bitmap file "
|
msg("mariabackup: warning: changed page bitmap file "
|
||||||
"\'%s\' corrupted.\n", bitmap_file.name);
|
"\'%s\' corrupted.", bitmap_file.name);
|
||||||
rbt_free(result);
|
rbt_free(result);
|
||||||
free(bitmap_files.files);
|
free(bitmap_files.files);
|
||||||
os_file_close(bitmap_file.file);
|
os_file_close(bitmap_file.file);
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ static inline int asprintf(char **strp, const char *fmt,...)
|
|||||||
#define xb_a(expr) \
|
#define xb_a(expr) \
|
||||||
do { \
|
do { \
|
||||||
if (!(expr)) { \
|
if (!(expr)) { \
|
||||||
msg("Assertion \"%s\" failed at %s:%lu\n", \
|
fprintf(stderr,"Assertion \"%s\" failed at %s:%lu\n", \
|
||||||
#expr, __FILE__, (ulong) __LINE__); \
|
#expr, __FILE__, (ulong) __LINE__); \
|
||||||
abort(); \
|
abort(); \
|
||||||
} \
|
} \
|
||||||
@@ -86,41 +86,47 @@ static inline int asprintf(char **strp, const char *fmt,...)
|
|||||||
|
|
||||||
#define XB_DELTA_INFO_SUFFIX ".meta"
|
#define XB_DELTA_INFO_SUFFIX ".meta"
|
||||||
|
|
||||||
|
|
||||||
|
static inline int msg1(unsigned int thread_num, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3);
|
||||||
|
static inline int msg1(uint thread_num, const char *fmt, va_list args)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
time_t t = time(NULL);
|
||||||
|
char date[100];
|
||||||
|
char *line;
|
||||||
|
strftime(date, sizeof(date), "%Y-%m-%d %H:%M:%S", localtime(&t));
|
||||||
|
result = vasprintf(&line, fmt, args);
|
||||||
|
if (result != -1) {
|
||||||
|
if (fmt && fmt[strlen(fmt)] != '\n')
|
||||||
|
result = fprintf(stderr, "[%02u] %s %s\n", thread_num, date, line);
|
||||||
|
else
|
||||||
|
result = fprintf(stderr, "[%02u] %s %s", thread_num, date, line);
|
||||||
|
free(line);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
static inline int msg(unsigned int, const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 2, 3);
|
||||||
|
static inline int msg(unsigned int thread_num, const char *fmt, ...)
|
||||||
|
{
|
||||||
|
int result;
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
result = msg1(thread_num, fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
static inline int msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
static inline int msg(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
||||||
static inline int msg(const char *fmt, ...)
|
static inline int msg(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
va_list args;
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
va_start(args, fmt);
|
result = msg1(0, fmt, args);
|
||||||
result = vfprintf(stderr, fmt, args);
|
va_end(args);
|
||||||
va_end(args);
|
return result;
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int msg_ts(const char *fmt, ...) ATTRIBUTE_FORMAT(printf, 1, 2);
|
|
||||||
static inline int msg_ts(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
int result;
|
|
||||||
time_t t = time(NULL);
|
|
||||||
char date[100];
|
|
||||||
char *line;
|
|
||||||
va_list args;
|
|
||||||
|
|
||||||
strftime(date, sizeof(date), "%y%m%d %H:%M:%S", localtime(&t));
|
|
||||||
|
|
||||||
va_start(args, fmt);
|
|
||||||
result = vasprintf(&line, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
if (result != -1) {
|
|
||||||
result = fprintf(stderr, "%s %s", date, line);
|
|
||||||
free(line);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use POSIX_FADV_NORMAL when available */
|
/* Use POSIX_FADV_NORMAL when available */
|
||||||
|
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ ds_create(const char *root, ds_type_t type)
|
|||||||
ds = &datasink_buffer;
|
ds = &datasink_buffer;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
msg("Unknown datasink type: %d\n", type);
|
msg("Unknown datasink type: %d", type);
|
||||||
xb_ad(0);
|
xb_ad(0);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ ds_create(const char *root, ds_type_t type)
|
|||||||
if (ctxt != NULL) {
|
if (ctxt != NULL) {
|
||||||
ctxt->datasink = ds;
|
ctxt->datasink = ds;
|
||||||
} else {
|
} else {
|
||||||
msg("Error: failed to initialize datasink.\n");
|
msg("Error: failed to initialize datasink.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -71,7 +71,7 @@ buffer_init(const char *root)
|
|||||||
ds_ctxt_t *ctxt;
|
ds_ctxt_t *ctxt;
|
||||||
ds_buffer_ctxt_t *buffer_ctxt;
|
ds_buffer_ctxt_t *buffer_ctxt;
|
||||||
|
|
||||||
ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
|
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t),
|
||||||
MYF(MY_FAE));
|
MYF(MY_FAE));
|
||||||
buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1);
|
buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1);
|
||||||
buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE;
|
buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE;
|
||||||
@@ -95,7 +95,7 @@ compress_init(const char *root)
|
|||||||
/* Create and initialize the worker threads */
|
/* Create and initialize the worker threads */
|
||||||
threads = create_worker_threads(xtrabackup_compress_threads);
|
threads = create_worker_threads(xtrabackup_compress_threads);
|
||||||
if (threads == NULL) {
|
if (threads == NULL) {
|
||||||
msg("compress: failed to create worker threads.\n");
|
msg("compress: failed to create worker threads.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
|
|||||||
write_uint64_le(dest_file,
|
write_uint64_le(dest_file,
|
||||||
comp_file->bytes_processed)) {
|
comp_file->bytes_processed)) {
|
||||||
msg("compress: write to the destination stream "
|
msg("compress: write to the destination stream "
|
||||||
"failed.\n");
|
"failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
|
|||||||
ds_write(dest_file, threads[i].to,
|
ds_write(dest_file, threads[i].to,
|
||||||
threads[i].to_len)) {
|
threads[i].to_len)) {
|
||||||
msg("compress: write to the destination stream "
|
msg("compress: write to the destination stream "
|
||||||
"failed.\n");
|
"failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ create_worker_threads(uint n)
|
|||||||
if (pthread_create(&thd->id, NULL, compress_worker_thread_func,
|
if (pthread_create(&thd->id, NULL, compress_worker_thread_func,
|
||||||
thd)) {
|
thd)) {
|
||||||
msg("compress: pthread_create() failed: "
|
msg("compress: pthread_create() failed: "
|
||||||
"errno = %d\n", errno);
|
"errno = %d", errno);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,7 +48,7 @@ stdout_init(const char *root)
|
|||||||
{
|
{
|
||||||
ds_ctxt_t *ctxt;
|
ds_ctxt_t *ctxt;
|
||||||
|
|
||||||
ctxt = my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
|
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE));
|
||||||
|
|
||||||
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
ctxt->root = my_strdup(root, MYF(MY_FAE));
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ tmpfile_init(const char *root)
|
|||||||
ds_ctxt_t *ctxt;
|
ds_ctxt_t *ctxt;
|
||||||
ds_tmpfile_ctxt_t *tmpfile_ctxt;
|
ds_tmpfile_ctxt_t *tmpfile_ctxt;
|
||||||
|
|
||||||
ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
|
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t),
|
||||||
MYF(MY_FAE));
|
MYF(MY_FAE));
|
||||||
tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1);
|
tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1);
|
||||||
tmpfile_ctxt->file_list = NULL;
|
tmpfile_ctxt->file_list = NULL;
|
||||||
@@ -191,11 +191,11 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
|
|||||||
/* Walk the files in the order they have been added */
|
/* Walk the files in the order they have been added */
|
||||||
list = list_reverse(list);
|
list = list_reverse(list);
|
||||||
while (list != NULL) {
|
while (list != NULL) {
|
||||||
tmp_file = list->data;
|
tmp_file = (ds_tmp_file_t *)list->data;
|
||||||
/* Stat the file to replace size and mtime on the original
|
/* Stat the file to replace size and mtime on the original
|
||||||
* mystat struct */
|
* mystat struct */
|
||||||
if (my_fstat(tmp_file->fd, &mystat, MYF(0))) {
|
if (my_fstat(tmp_file->fd, &mystat, MYF(0))) {
|
||||||
msg("error: my_fstat() failed.\n");
|
msg("error: my_fstat() failed.");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
tmp_file->mystat.st_size = mystat.st_size;
|
tmp_file->mystat.st_size = mystat.st_size;
|
||||||
@@ -205,7 +205,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
|
|||||||
&tmp_file->mystat);
|
&tmp_file->mystat);
|
||||||
if (dst_file == NULL) {
|
if (dst_file == NULL) {
|
||||||
msg("error: could not stream a temporary file to "
|
msg("error: could not stream a temporary file to "
|
||||||
"'%s'\n", tmp_file->orig_path);
|
"'%s'", tmp_file->orig_path);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,17 +213,17 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
|
|||||||
posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL);
|
posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||||
if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) ==
|
if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) ==
|
||||||
MY_FILEPOS_ERROR) {
|
MY_FILEPOS_ERROR) {
|
||||||
msg("error: my_seek() failed for '%s', errno = %d.\n",
|
msg("error: my_seek() failed for '%s', errno = %d.",
|
||||||
tmp_file->file->path, my_errno);
|
tmp_file->file->path, my_errno);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
offset = 0;
|
offset = 0;
|
||||||
while ((bytes = my_read(tmp_file->fd, buf, buf_size,
|
while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size,
|
||||||
MYF(MY_WME))) > 0) {
|
MYF(MY_WME))) > 0) {
|
||||||
posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED);
|
posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED);
|
||||||
offset += buf_size;
|
offset += buf_size;
|
||||||
if (ds_write(dst_file, buf, bytes)) {
|
if (ds_write(dst_file, buf, bytes)) {
|
||||||
msg("error: cannot write to stream for '%s'.\n",
|
msg("error: cannot write to stream for '%s'.",
|
||||||
tmp_file->orig_path);
|
tmp_file->orig_path);
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -79,18 +79,18 @@ xbstream_init(const char *root __attribute__((unused)))
|
|||||||
ds_stream_ctxt_t *stream_ctxt;
|
ds_stream_ctxt_t *stream_ctxt;
|
||||||
xb_wstream_t *xbstream;
|
xb_wstream_t *xbstream;
|
||||||
|
|
||||||
ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
|
ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t),
|
||||||
MYF(MY_FAE));
|
MYF(MY_FAE));
|
||||||
stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1);
|
stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1);
|
||||||
|
|
||||||
if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) {
|
if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) {
|
||||||
msg("xbstream_init: pthread_mutex_init() failed.\n");
|
msg("xbstream_init: pthread_mutex_init() failed.");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
xbstream = xb_stream_write_new();
|
xbstream = xb_stream_write_new();
|
||||||
if (xbstream == NULL) {
|
if (xbstream == NULL) {
|
||||||
msg("xb_stream_write_new() failed.\n");
|
msg("xb_stream_write_new() failed.");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
stream_ctxt->xbstream = xbstream;
|
stream_ctxt->xbstream = xbstream;
|
||||||
@@ -143,7 +143,7 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
|||||||
my_xbstream_write_callback);
|
my_xbstream_write_callback);
|
||||||
|
|
||||||
if (xbstream_file == NULL) {
|
if (xbstream_file == NULL) {
|
||||||
msg("xb_stream_write_open() failed.\n");
|
msg("xb_stream_write_open() failed.");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ xbstream_write(ds_file_t *file, const uchar *buf, size_t len)
|
|||||||
xbstream_file = stream_file->xbstream_file;
|
xbstream_file = stream_file->xbstream_file;
|
||||||
|
|
||||||
if (xb_stream_write_data(xbstream_file, buf, len)) {
|
if (xb_stream_write_data(xbstream_file, buf, len)) {
|
||||||
msg("xb_stream_write_data() failed.\n");
|
msg("xb_stream_write_data() failed.");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ xbstream_deinit(ds_ctxt_t *ctxt)
|
|||||||
stream_ctxt = (ds_stream_ctxt_t *) ctxt->ptr;
|
stream_ctxt = (ds_stream_ctxt_t *) ctxt->ptr;
|
||||||
|
|
||||||
if (xb_stream_write_done(stream_ctxt->xbstream)) {
|
if (xb_stream_write_done(stream_ctxt->xbstream)) {
|
||||||
msg("xb_stream_done() failed.\n");
|
msg("xb_stream_done() failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream_ctxt->dest_file) {
|
if (stream_ctxt->dest_file) {
|
||||||
@@ -45,7 +45,7 @@ static std::string get_encryption_plugin_from_cnf()
|
|||||||
FILE *f = fopen("backup-my.cnf", "r");
|
FILE *f = fopen("backup-my.cnf", "r");
|
||||||
if (!f)
|
if (!f)
|
||||||
{
|
{
|
||||||
msg("cannot open backup-my.cnf for reading\n");
|
msg("Can't open backup-my.cnf for reading");
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
char line[512];
|
char line[512];
|
||||||
@@ -167,7 +167,7 @@ void encryption_plugin_prepare_init(int argc, char **argv)
|
|||||||
std::string plugin_load= get_encryption_plugin_from_cnf();
|
std::string plugin_load= get_encryption_plugin_from_cnf();
|
||||||
if (plugin_load.size())
|
if (plugin_load.size())
|
||||||
{
|
{
|
||||||
msg("Loading encryption plugin from %s\n", plugin_load.c_str());
|
msg("Loading encryption plugin from %s", plugin_load.c_str());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -193,9 +193,9 @@ static void encryption_plugin_init(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
|
/* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */
|
||||||
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
|
mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0;
|
||||||
msg("Loading encryption plugin\n");
|
msg("Loading encryption plugin");
|
||||||
for (int i= 1; i < argc; i++)
|
for (int i= 1; i < argc; i++)
|
||||||
msg("\t Encryption plugin parameter : '%s'\n", argv[i]);
|
msg("\t Encryption plugin parameter : '%s'", argv[i]);
|
||||||
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
|
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -174,9 +174,8 @@ xb_fil_cur_open(
|
|||||||
/* The following call prints an error message */
|
/* The following call prints an error message */
|
||||||
os_file_get_last_error(TRUE);
|
os_file_get_last_error(TRUE);
|
||||||
|
|
||||||
msg("[%02u] mariabackup: error: cannot open "
|
msg(thread_n, "mariabackup: error: cannot open "
|
||||||
"tablespace %s\n",
|
"tablespace %s", cursor->abs_path);
|
||||||
thread_n, cursor->abs_path);
|
|
||||||
|
|
||||||
return(XB_FIL_CUR_SKIP);
|
return(XB_FIL_CUR_SKIP);
|
||||||
}
|
}
|
||||||
@@ -217,8 +216,8 @@ xb_fil_cur_open(
|
|||||||
cursor->statinfo.st_size = (ulonglong)max_file_size;
|
cursor->statinfo.st_size = (ulonglong)max_file_size;
|
||||||
}
|
}
|
||||||
if (err) {
|
if (err) {
|
||||||
msg("[%02u] mariabackup: error: cannot fstat %s\n",
|
msg(thread_n, "mariabackup: error: cannot fstat %s",
|
||||||
thread_n, cursor->abs_path);
|
cursor->abs_path);
|
||||||
|
|
||||||
xb_fil_cur_close(cursor);
|
xb_fil_cur_close(cursor);
|
||||||
|
|
||||||
@@ -262,8 +261,6 @@ xb_fil_cur_open(
|
|||||||
mutex_exit(&fil_system->mutex);
|
mutex_exit(&fil_system->mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*msg("crypt: %s,%u\n", node->name, node->space->crypt_data->type);*/
|
|
||||||
|
|
||||||
cursor->space_size = (ulint)(cursor->statinfo.st_size
|
cursor->space_size = (ulint)(cursor->statinfo.st_size
|
||||||
/ page_size.physical());
|
/ page_size.physical());
|
||||||
|
|
||||||
@@ -413,14 +410,8 @@ xb_fil_cur_read(
|
|||||||
&& offset + to_read == cursor->statinfo.st_size) {
|
&& offset + to_read == cursor->statinfo.st_size) {
|
||||||
|
|
||||||
if (to_read < (ib_int64_t) page_size) {
|
if (to_read < (ib_int64_t) page_size) {
|
||||||
msg("[%02u] mariabackup: Warning: junk at the end of "
|
msg(cursor->thread_n, "Warning: junk at the end of "
|
||||||
"%s:\n", cursor->thread_n, cursor->abs_path);
|
"%s, offset = %llu, to_read = %llu",cursor->abs_path, (ulonglong) offset, (ulonglong) to_read);
|
||||||
msg("[%02u] mariabackup: Warning: offset = %llu, "
|
|
||||||
"to_read = %llu\n",
|
|
||||||
cursor->thread_n,
|
|
||||||
(unsigned long long) offset,
|
|
||||||
(unsigned long long) to_read);
|
|
||||||
|
|
||||||
return(XB_FIL_CUR_EOF);
|
return(XB_FIL_CUR_EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -464,20 +455,17 @@ read_retry:
|
|||||||
retry_count--;
|
retry_count--;
|
||||||
|
|
||||||
if (retry_count == 0) {
|
if (retry_count == 0) {
|
||||||
msg("[%02u] mariabackup: "
|
msg(cursor->thread_n,
|
||||||
"Error: failed to read page after "
|
"Error: failed to read page after "
|
||||||
"10 retries. File %s seems to be "
|
"10 retries. File %s seems to be "
|
||||||
"corrupted.\n", cursor->thread_n,
|
"corrupted.", cursor->abs_path);
|
||||||
cursor->abs_path);
|
|
||||||
ret = XB_FIL_CUR_ERROR;
|
ret = XB_FIL_CUR_ERROR;
|
||||||
buf_page_print(page, cursor->page_size);
|
buf_page_print(page, cursor->page_size);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
msg("[%02u] mariabackup: "
|
msg(cursor->thread_n, "Database page corruption detected at page "
|
||||||
"Database page corruption detected at page "
|
ULINTPF ", retrying...",
|
||||||
ULINTPF ", retrying...\n", cursor->thread_n,
|
|
||||||
page_no);
|
page_no);
|
||||||
|
|
||||||
os_thread_sleep(100000);
|
os_thread_sleep(100000);
|
||||||
goto read_retry;
|
goto read_retry;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -738,7 +738,7 @@ ibx_get_one_option(int optid,
|
|||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
msg("innobackupex version %s %s (%s)\n",
|
printf("innobackupex version %s %s (%s)",
|
||||||
MYSQL_SERVER_VERSION,
|
MYSQL_SERVER_VERSION,
|
||||||
SYSTEM_TYPE, MACHINE_TYPE);
|
SYSTEM_TYPE, MACHINE_TYPE);
|
||||||
exit(0);
|
exit(0);
|
||||||
|
|||||||
@@ -79,9 +79,8 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
|||||||
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
|
cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size);
|
||||||
|
|
||||||
if (!cp->delta_buf) {
|
if (!cp->delta_buf) {
|
||||||
msg("[%02u] mariabackup: Error: "
|
msg(cursor->thread_n,"Can't allocate %zu bytes",
|
||||||
"cannot allocate %zu bytes\n",
|
(size_t) cp->delta_buf_size);
|
||||||
cursor->thread_n, (size_t) cp->delta_buf_size);
|
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,9 +89,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
|||||||
XB_DELTA_INFO_SUFFIX);
|
XB_DELTA_INFO_SUFFIX);
|
||||||
const xb_delta_info_t info(cursor->page_size, cursor->space_id);
|
const xb_delta_info_t info(cursor->page_size, cursor->space_id);
|
||||||
if (!xb_write_delta_metadata(meta_name, &info)) {
|
if (!xb_write_delta_metadata(meta_name, &info)) {
|
||||||
msg("[%02u] mariabackup: Error: "
|
msg(cursor->thread_n,"Error: "
|
||||||
"failed to write meta info for %s\n",
|
"failed to write meta info for %s",
|
||||||
cursor->thread_n, cursor->rel_path);
|
cursor->rel_path);
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ datasink_t datasink_archive;
|
|||||||
datasink_t datasink_xbstream;
|
datasink_t datasink_xbstream;
|
||||||
datasink_t datasink_compress;
|
datasink_t datasink_compress;
|
||||||
datasink_t datasink_tmpfile;
|
datasink_t datasink_tmpfile;
|
||||||
datasink_t datasink_buffer;
|
|
||||||
|
|
||||||
static run_mode_t opt_mode;
|
static run_mode_t opt_mode;
|
||||||
static char * opt_directory = NULL;
|
static char * opt_directory = NULL;
|
||||||
@@ -106,7 +105,7 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opt_mode == RUN_MODE_NONE) {
|
if (opt_mode == RUN_MODE_NONE) {
|
||||||
msg("%s: either -c or -x must be specified.\n", my_progname);
|
msg("%s: either -c or -x must be specified.", my_progname);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -184,7 +183,7 @@ int
|
|||||||
set_run_mode(run_mode_t mode)
|
set_run_mode(run_mode_t mode)
|
||||||
{
|
{
|
||||||
if (opt_mode != RUN_MODE_NONE) {
|
if (opt_mode != RUN_MODE_NONE) {
|
||||||
msg("%s: can't set specify both -c and -x.\n", my_progname);
|
msg("%s: can't set specify both -c and -x.", my_progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +232,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile)
|
|||||||
while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE,
|
while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE,
|
||||||
MYF(MY_WME))) > 0) {
|
MYF(MY_WME))) > 0) {
|
||||||
if (xb_stream_write_data(xbfile, buf, bytes)) {
|
if (xb_stream_write_data(xbfile, buf, bytes)) {
|
||||||
msg("%s: xb_stream_write_data() failed.\n",
|
msg("%s: xb_stream_write_data() failed.",
|
||||||
my_progname);
|
my_progname);
|
||||||
my_free(buf);
|
my_free(buf);
|
||||||
return 1;
|
return 1;
|
||||||
@@ -262,13 +261,13 @@ mode_create(int argc, char **argv)
|
|||||||
xb_wstream_t *stream;
|
xb_wstream_t *stream;
|
||||||
|
|
||||||
if (argc < 1) {
|
if (argc < 1) {
|
||||||
msg("%s: no files are specified.\n", my_progname);
|
msg("%s: no files are specified.", my_progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
stream = xb_stream_write_new();
|
stream = xb_stream_write_new();
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
msg("%s: xb_stream_write_new() failed.\n", my_progname);
|
msg("%s: xb_stream_write_new() failed.", my_progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -281,13 +280,13 @@ mode_create(int argc, char **argv)
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (!MY_S_ISREG(mystat.st_mode)) {
|
if (!MY_S_ISREG(mystat.st_mode)) {
|
||||||
msg("%s: %s is not a regular file, exiting.\n",
|
msg("%s: %s is not a regular file, exiting.",
|
||||||
my_progname, filepath);
|
my_progname, filepath);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((src_file = my_open(filepath, O_RDONLY, MYF(MY_WME))) < 0) {
|
if ((src_file = my_open(filepath, O_RDONLY, MYF(MY_WME))) < 0) {
|
||||||
msg("%s: failed to open %s.\n", my_progname, filepath);
|
msg("%s: failed to open %s.", my_progname, filepath);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -297,7 +296,7 @@ mode_create(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opt_verbose) {
|
if (opt_verbose) {
|
||||||
msg("%s\n", filepath);
|
msg("%s", filepath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream_one_file(src_file, file) ||
|
if (stream_one_file(src_file, file) ||
|
||||||
@@ -338,12 +337,12 @@ file_entry_new(extract_ctxt_t *ctxt, const char *path, uint pathlen)
|
|||||||
file = ds_open(ctxt->ds_ctxt, path, NULL);
|
file = ds_open(ctxt->ds_ctxt, path, NULL);
|
||||||
|
|
||||||
if (file == NULL) {
|
if (file == NULL) {
|
||||||
msg("%s: failed to create file.\n", my_progname);
|
msg("%s: failed to create file.", my_progname);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (opt_verbose) {
|
if (opt_verbose) {
|
||||||
msg("%s\n", entry->path);
|
msg("%s", entry->path);
|
||||||
}
|
}
|
||||||
|
|
||||||
entry->file = file;
|
entry->file = file;
|
||||||
@@ -425,7 +424,7 @@ extract_worker_thread_func(void *arg)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (my_hash_insert(ctxt->filehash, (uchar *) entry)) {
|
if (my_hash_insert(ctxt->filehash, (uchar *) entry)) {
|
||||||
msg("%s: my_hash_insert() failed.\n",
|
msg("%s: my_hash_insert() failed.",
|
||||||
my_progname);
|
my_progname);
|
||||||
pthread_mutex_unlock(ctxt->mutex);
|
pthread_mutex_unlock(ctxt->mutex);
|
||||||
break;
|
break;
|
||||||
@@ -454,7 +453,7 @@ extract_worker_thread_func(void *arg)
|
|||||||
|
|
||||||
if (entry->offset != chunk.offset) {
|
if (entry->offset != chunk.offset) {
|
||||||
msg("%s: out-of-order chunk: real offset = 0x%llx, "
|
msg("%s: out-of-order chunk: real offset = 0x%llx, "
|
||||||
"expected offset = 0x%llx\n", my_progname,
|
"expected offset = 0x%llx", my_progname,
|
||||||
chunk.offset, entry->offset);
|
chunk.offset, entry->offset);
|
||||||
pthread_mutex_unlock(&entry->mutex);
|
pthread_mutex_unlock(&entry->mutex);
|
||||||
res = XB_STREAM_READ_ERROR;
|
res = XB_STREAM_READ_ERROR;
|
||||||
@@ -462,7 +461,7 @@ extract_worker_thread_func(void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ds_write(entry->file, chunk.data, chunk.length)) {
|
if (ds_write(entry->file, chunk.data, chunk.length)) {
|
||||||
msg("%s: my_write() failed.\n", my_progname);
|
msg("%s: my_write() failed.", my_progname);
|
||||||
pthread_mutex_unlock(&entry->mutex);
|
pthread_mutex_unlock(&entry->mutex);
|
||||||
res = XB_STREAM_READ_ERROR;
|
res = XB_STREAM_READ_ERROR;
|
||||||
break;
|
break;
|
||||||
@@ -500,12 +499,12 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
|||||||
if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE,
|
if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE,
|
||||||
0, 0, (my_hash_get_key) get_file_entry_key,
|
0, 0, (my_hash_get_key) get_file_entry_key,
|
||||||
(my_hash_free_key) file_entry_free, MYF(0))) {
|
(my_hash_free_key) file_entry_free, MYF(0))) {
|
||||||
msg("%s: failed to initialize file hash.\n", my_progname);
|
msg("%s: failed to initialize file hash.", my_progname);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pthread_mutex_init(&mutex, NULL)) {
|
if (pthread_mutex_init(&mutex, NULL)) {
|
||||||
msg("%s: failed to initialize mutex.\n", my_progname);
|
msg("%s: failed to initialize mutex.", my_progname);
|
||||||
my_hash_free(&filehash);
|
my_hash_free(&filehash);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -520,7 +519,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
|||||||
|
|
||||||
stream = xb_stream_read_new();
|
stream = xb_stream_read_new();
|
||||||
if (stream == NULL) {
|
if (stream == NULL) {
|
||||||
msg("%s: xb_stream_read_new() failed.\n", my_progname);
|
msg("%s: xb_stream_read_new() failed.", my_progname);
|
||||||
pthread_mutex_destroy(&mutex);
|
pthread_mutex_destroy(&mutex);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
goto exit;
|
goto exit;
|
||||||
@@ -531,8 +530,8 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
|
|||||||
ctxt.ds_ctxt = ds_ctxt;
|
ctxt.ds_ctxt = ds_ctxt;
|
||||||
ctxt.mutex = &mutex;
|
ctxt.mutex = &mutex;
|
||||||
|
|
||||||
tids = calloc(n_threads, sizeof(pthread_t));
|
tids = (pthread_t *)calloc(n_threads, sizeof(pthread_t));
|
||||||
retvals = calloc(n_threads, sizeof(void*));
|
retvals = (void **)calloc(n_threads, sizeof(void*));
|
||||||
|
|
||||||
for (i = 0; i < n_threads; i++)
|
for (i = 0; i < n_threads; i++)
|
||||||
pthread_create(tids + i, NULL, extract_worker_thread_func,
|
pthread_create(tids + i, NULL, extract_worker_thread_func,
|
||||||
@@ -101,6 +101,6 @@ xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream,
|
|||||||
|
|
||||||
int xb_stream_read_done(xb_rstream_t *stream);
|
int xb_stream_read_done(xb_rstream_t *stream);
|
||||||
|
|
||||||
int xb_stream_validate_checksum(xb_rstream_chunk_t *chunk);
|
xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -67,15 +67,15 @@ validate_chunk_type(uchar code)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
xb_rstream_result_t
|
||||||
xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
|
xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
|
||||||
{
|
{
|
||||||
ulong checksum;
|
ulong checksum;
|
||||||
|
|
||||||
checksum = crc32_iso3309(0, chunk->data, (uint)chunk->length);
|
checksum = crc32_iso3309(0, (unsigned char *)chunk->data, (uint)chunk->length);
|
||||||
if (checksum != chunk->checksum) {
|
if (checksum != chunk->checksum) {
|
||||||
msg("xb_stream_read_chunk(): invalid checksum at offset "
|
msg("xb_stream_read_chunk(): invalid checksum at offset "
|
||||||
"0x%llx: expected 0x%lx, read 0x%lx.\n",
|
"0x%llx: expected 0x%lx, read 0x%lx.",
|
||||||
(ulonglong) chunk->checksum_offset, chunk->checksum,
|
(ulonglong) chunk->checksum_offset, chunk->checksum,
|
||||||
checksum);
|
checksum);
|
||||||
return XB_STREAM_READ_ERROR;
|
return XB_STREAM_READ_ERROR;
|
||||||
@@ -86,8 +86,8 @@ xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
|
|||||||
|
|
||||||
#define F_READ(buf,len) \
|
#define F_READ(buf,len) \
|
||||||
do { \
|
do { \
|
||||||
if (xb_read_full(fd, buf, len) < len) { \
|
if (xb_read_full(fd, (uchar *)buf, len) < len) { \
|
||||||
msg("xb_stream_read_chunk(): my_read() failed.\n"); \
|
msg("xb_stream_read_chunk(): my_read() failed."); \
|
||||||
goto err; \
|
goto err; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
@@ -111,7 +111,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
return XB_STREAM_READ_EOF;
|
return XB_STREAM_READ_EOF;
|
||||||
} else if (tbytes < CHUNK_HEADER_CONSTANT_LEN) {
|
} else if (tbytes < CHUNK_HEADER_CONSTANT_LEN) {
|
||||||
msg("xb_stream_read_chunk(): unexpected end of stream at "
|
msg("xb_stream_read_chunk(): unexpected end of stream at "
|
||||||
"offset 0x%llx.\n", stream->offset);
|
"offset 0x%llx.", stream->offset);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
/* Chunk magic value */
|
/* Chunk magic value */
|
||||||
if (memcmp(tmpbuf, XB_STREAM_CHUNK_MAGIC, 8)) {
|
if (memcmp(tmpbuf, XB_STREAM_CHUNK_MAGIC, 8)) {
|
||||||
msg("xb_stream_read_chunk(): wrong chunk magic at offset "
|
msg("xb_stream_read_chunk(): wrong chunk magic at offset "
|
||||||
"0x%llx.\n", (ulonglong) stream->offset);
|
"0x%llx.", (ulonglong) stream->offset);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
ptr += 8;
|
ptr += 8;
|
||||||
@@ -135,7 +135,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
if (chunk->type == XB_CHUNK_TYPE_UNKNOWN &&
|
if (chunk->type == XB_CHUNK_TYPE_UNKNOWN &&
|
||||||
!(chunk->flags & XB_STREAM_FLAG_IGNORABLE)) {
|
!(chunk->flags & XB_STREAM_FLAG_IGNORABLE)) {
|
||||||
msg("xb_stream_read_chunk(): unknown chunk type 0x%lu at "
|
msg("xb_stream_read_chunk(): unknown chunk type 0x%lu at "
|
||||||
"offset 0x%llx.\n", (ulong) *ptr,
|
"offset 0x%llx.", (ulong) *ptr,
|
||||||
(ulonglong) stream->offset);
|
(ulonglong) stream->offset);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -146,7 +146,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
pathlen = uint4korr(ptr);
|
pathlen = uint4korr(ptr);
|
||||||
if (pathlen >= FN_REFLEN) {
|
if (pathlen >= FN_REFLEN) {
|
||||||
msg("xb_stream_read_chunk(): path length (%lu) is too large at "
|
msg("xb_stream_read_chunk(): path length (%lu) is too large at "
|
||||||
"offset 0x%llx.\n", (ulong) pathlen, stream->offset);
|
"offset 0x%llx.", (ulong) pathlen, stream->offset);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
chunk->pathlen = pathlen;
|
chunk->pathlen = pathlen;
|
||||||
@@ -170,7 +170,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
ullval = uint8korr(tmpbuf);
|
ullval = uint8korr(tmpbuf);
|
||||||
if (ullval > (ulonglong) SIZE_T_MAX) {
|
if (ullval > (ulonglong) SIZE_T_MAX) {
|
||||||
msg("xb_stream_read_chunk(): chunk length is too large at "
|
msg("xb_stream_read_chunk(): chunk length is too large at "
|
||||||
"offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset,
|
"offset 0x%llx: 0x%llx.", (ulonglong) stream->offset,
|
||||||
ullval);
|
ullval);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -181,7 +181,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
ullval = uint8korr(tmpbuf + 8);
|
ullval = uint8korr(tmpbuf + 8);
|
||||||
if (ullval > (ulonglong) MY_OFF_T_MAX) {
|
if (ullval > (ulonglong) MY_OFF_T_MAX) {
|
||||||
msg("xb_stream_read_chunk(): chunk offset is too large at "
|
msg("xb_stream_read_chunk(): chunk offset is too large at "
|
||||||
"offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset,
|
"offset 0x%llx: 0x%llx.", (ulonglong) stream->offset,
|
||||||
ullval);
|
ullval);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
@@ -194,7 +194,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
|
|||||||
MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
MYF(MY_WME | MY_ALLOW_ZERO_PTR));
|
||||||
if (chunk->data == NULL) {
|
if (chunk->data == NULL) {
|
||||||
msg("xb_stream_read_chunk(): failed to increase buffer "
|
msg("xb_stream_read_chunk(): failed to increase buffer "
|
||||||
"to %lu bytes.\n", (ulong) chunk->length);
|
"to %lu bytes.", (ulong) chunk->length);
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
chunk->buflen = chunk->length;
|
chunk->buflen = chunk->length;
|
||||||
@@ -55,7 +55,7 @@ xb_stream_default_write_callback(xb_wstream_file_t *file __attribute__((unused))
|
|||||||
void *userdata __attribute__((unused)),
|
void *userdata __attribute__((unused)),
|
||||||
const void *buf, size_t len)
|
const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
if (my_write(my_fileno(stdout), buf, len, MYF(MY_WME | MY_NABP)))
|
if (my_write(my_fileno(stdout), (const uchar *)buf, len, MYF(MY_WME | MY_NABP)))
|
||||||
return -1;
|
return -1;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@@ -83,7 +83,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
|
|||||||
path_len = strlen(path);
|
path_len = strlen(path);
|
||||||
|
|
||||||
if (path_len > FN_REFLEN) {
|
if (path_len > FN_REFLEN) {
|
||||||
msg("xb_stream_write_open(): file path is too long.\n");
|
msg("xb_stream_write_open(): file path is too long.");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -216,7 +216,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len)
|
|||||||
int8store(ptr, len); /* Payload length */
|
int8store(ptr, len); /* Payload length */
|
||||||
ptr += 8;
|
ptr += 8;
|
||||||
|
|
||||||
checksum = crc32_iso3309(0, buf, (uint)len); /* checksum */
|
checksum = crc32_iso3309(0, (const uchar *)buf, (uint)len); /* checksum */
|
||||||
|
|
||||||
pthread_mutex_lock(&stream->mutex);
|
pthread_mutex_lock(&stream->mutex);
|
||||||
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -71,7 +71,7 @@ extern char *xtrabackup_databases_file;
|
|||||||
extern char *xtrabackup_tables_exclude;
|
extern char *xtrabackup_tables_exclude;
|
||||||
extern char *xtrabackup_databases_exclude;
|
extern char *xtrabackup_databases_exclude;
|
||||||
|
|
||||||
extern ibool xtrabackup_compress;
|
extern uint xtrabackup_compress;
|
||||||
|
|
||||||
extern my_bool xtrabackup_backup;
|
extern my_bool xtrabackup_backup;
|
||||||
extern my_bool xtrabackup_prepare;
|
extern my_bool xtrabackup_prepare;
|
||||||
@@ -86,14 +86,10 @@ extern int xtrabackup_parallel;
|
|||||||
|
|
||||||
extern my_bool xb_close_files;
|
extern my_bool xb_close_files;
|
||||||
extern const char *xtrabackup_compress_alg;
|
extern const char *xtrabackup_compress_alg;
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"{
|
extern uint xtrabackup_compress_threads;
|
||||||
#endif
|
extern ulonglong xtrabackup_compress_chunk_size;
|
||||||
extern uint xtrabackup_compress_threads;
|
|
||||||
extern ulonglong xtrabackup_compress_chunk_size;
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
extern my_bool xtrabackup_export;
|
extern my_bool xtrabackup_export;
|
||||||
extern char *xtrabackup_extra_lsndir;
|
extern char *xtrabackup_extra_lsndir;
|
||||||
extern ulint xtrabackup_log_copy_interval;
|
extern ulint xtrabackup_log_copy_interval;
|
||||||
|
|||||||
Reference in New Issue
Block a user