summaryrefslogtreecommitdiff
path: root/extra/mariabackup/backup_mysql.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-09-23 17:35:29 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2019-09-23 17:35:29 +0300
commit5a92ccbaea1bb3973e23846a741f5694a1e687bd (patch)
treeaafc504552502b48b79cadcb06b2b5c7eba4f374 /extra/mariabackup/backup_mysql.cc
parentc997af7d1f432dfca922958453f0e2313287f1eb (diff)
parentc016ea660ede8b7ff75f8ca65f73e2958262263a (diff)
downloadmariadb-git-5a92ccbaea1bb3973e23846a741f5694a1e687bd.tar.gz
Merge 10.3 into 10.4
Disable MDEV-20576 assertions until MDEV-20595 has been fixed.
Diffstat (limited to 'extra/mariabackup/backup_mysql.cc')
-rw-r--r--extra/mariabackup/backup_mysql.cc43
1 files changed, 36 insertions, 7 deletions
diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc
index e2c5d8405ae..9cac43dd6f8 100644
--- a/extra/mariabackup/backup_mysql.cc
+++ b/extra/mariabackup/backup_mysql.cc
@@ -1367,9 +1367,12 @@ PERCONA_SCHEMA.xtrabackup_history and writes a new history record to the
table containing all the history info particular to the just completed
backup. */
bool
-write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
+write_xtrabackup_info(MYSQL *connection, const char * filename, bool history,
+ bool stream)
{
+ bool result = true;
+ FILE *fp = NULL;
char *uuid = NULL;
char *server_version = NULL;
char buf_start_time[100];
@@ -1395,7 +1398,8 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
|| xtrabackup_databases_exclude
);
- backup_file_printf(filename,
+ char *buf = NULL;
+ int buf_len = asprintf(&buf,
"uuid = %s\n"
"name = %s\n"
"tool_name = %s\n"
@@ -1407,8 +1411,8 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
"end_time = %s\n"
"lock_time = %d\n"
"binlog_pos = %s\n"
- "innodb_from_lsn = %llu\n"
- "innodb_to_lsn = %llu\n"
+ "innodb_from_lsn = " LSN_PF "\n"
+ "innodb_to_lsn = " LSN_PF "\n"
"partial = %s\n"
"incremental = %s\n"
"format = %s\n"
@@ -1425,12 +1429,34 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
(int)history_lock_time, /* lock_time */
mysql_binlog_position ?
mysql_binlog_position : "", /* binlog_pos */
- incremental_lsn, /* innodb_from_lsn */
- metadata_to_lsn, /* innodb_to_lsn */
+ incremental_lsn,
+ /* innodb_from_lsn */
+ metadata_to_lsn,
+ /* innodb_to_lsn */
is_partial? "Y" : "N",
xtrabackup_incremental ? "Y" : "N", /* incremental */
xb_stream_name[xtrabackup_stream_fmt], /* format */
xtrabackup_compress ? "compressed" : "N"); /* compressed */
+ if (buf_len < 0) {
+ msg("Error: cannot generate xtrabackup_info");
+ result = false;
+ goto cleanup;
+ }
+
+ if (stream) {
+ backup_file_printf(filename, "%s", buf);
+ } else {
+ fp = fopen(filename, "w");
+ if (!fp) {
+ msg("Error: cannot open %s", filename);
+ result = false;
+ goto cleanup;
+ }
+ if (fwrite(buf, buf_len, 1, fp) < 1) {
+ result = false;
+ goto cleanup;
+ }
+ }
if (!history) {
goto cleanup;
@@ -1492,8 +1518,11 @@ cleanup:
free(uuid);
free(server_version);
+ free(buf);
+ if (fp)
+ fclose(fp);
- return(true);
+ return(result);
}
extern const char *innodb_checksum_algorithm_names[];