Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a8a27e65
Commit
a8a27e65
authored
Jan 14, 2019
by
Vladislav Vaintroub
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-18212 mariabackup: Make output format uniform whenever possible
parent
61b60007
Changes
22
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
407 additions
and
476 deletions
+407
-476
extra/mariabackup/CMakeLists.txt
extra/mariabackup/CMakeLists.txt
+13
-13
extra/mariabackup/backup_copy.cc
extra/mariabackup/backup_copy.cc
+58
-69
extra/mariabackup/backup_mysql.cc
extra/mariabackup/backup_mysql.cc
+52
-56
extra/mariabackup/changed_page_bitmap.cc
extra/mariabackup/changed_page_bitmap.cc
+13
-13
extra/mariabackup/common.h
extra/mariabackup/common.h
+37
-31
extra/mariabackup/datasink.cc
extra/mariabackup/datasink.cc
+2
-2
extra/mariabackup/ds_archive.cc
extra/mariabackup/ds_archive.cc
+0
-0
extra/mariabackup/ds_buffer.cc
extra/mariabackup/ds_buffer.cc
+1
-1
extra/mariabackup/ds_compress.cc
extra/mariabackup/ds_compress.cc
+4
-4
extra/mariabackup/ds_stdout.cc
extra/mariabackup/ds_stdout.cc
+1
-1
extra/mariabackup/ds_tmpfile.cc
extra/mariabackup/ds_tmpfile.cc
+7
-7
extra/mariabackup/ds_xbstream.cc
extra/mariabackup/ds_xbstream.cc
+6
-6
extra/mariabackup/encryption_plugin.cc
extra/mariabackup/encryption_plugin.cc
+4
-4
extra/mariabackup/fil_cur.cc
extra/mariabackup/fil_cur.cc
+10
-22
extra/mariabackup/innobackupex.cc
extra/mariabackup/innobackupex.cc
+1
-1
extra/mariabackup/write_filt.cc
extra/mariabackup/write_filt.cc
+5
-6
extra/mariabackup/xbstream.cc
extra/mariabackup/xbstream.cc
+18
-19
extra/mariabackup/xbstream.h
extra/mariabackup/xbstream.h
+1
-1
extra/mariabackup/xbstream_read.cc
extra/mariabackup/xbstream_read.cc
+12
-12
extra/mariabackup/xbstream_write.cc
extra/mariabackup/xbstream_write.cc
+3
-3
extra/mariabackup/xtrabackup.cc
extra/mariabackup/xtrabackup.cc
+154
-196
extra/mariabackup/xtrabackup.h
extra/mariabackup/xtrabackup.h
+5
-9
No files found.
extra/mariabackup/CMakeLists.txt
View file @
a8a27e65
...
...
@@ -57,19 +57,19 @@ MYSQL_ADD_EXECUTABLE(mariabackup
xtrabackup.cc
innobackupex.cc
changed_page_bitmap.cc
datasink.c
ds_buffer.c
ds_compress.c
datasink.c
c
ds_buffer.c
c
ds_compress.c
c
ds_local.cc
ds_stdout.c
ds_tmpfile.c
ds_xbstream.c
ds_stdout.c
c
ds_tmpfile.c
c
ds_xbstream.c
c
fil_cur.cc
quicklz/quicklz.c
read_filt.cc
write_filt.cc
wsrep.cc
xbstream_write.c
xbstream_write.c
c
backup_mysql.cc
backup_copy.cc
encryption_plugin.cc
...
...
@@ -96,13 +96,13 @@ ENDIF()
# xbstream binary
########################################################################
MYSQL_ADD_EXECUTABLE
(
mbstream
ds_buffer.c
ds_buffer.c
c
ds_local.cc
ds_stdout.c
datasink.c
xbstream.c
xbstream_read.c
xbstream_write.c
ds_stdout.c
c
datasink.c
c
xbstream.c
c
xbstream_read.c
c
xbstream_write.c
c
COMPONENT backup
)
...
...
extra/mariabackup/backup_copy.cc
View file @
a8a27e65
This diff is collapsed.
Click to expand it.
extra/mariabackup/backup_mysql.cc
View file @
a8a27e65
This diff is collapsed.
Click to expand it.
extra/mariabackup/changed_page_bitmap.cc
View file @
a8a27e65
...
...
@@ -202,7 +202,7 @@ log_online_read_bitmap_page(
/* The following call prints an error message */
os_file_get_last_error
(
TRUE
);
msg
(
"InnoDB: Warning: failed reading changed page bitmap "
"file
\'
%s
\'
\n
"
,
bitmap_file
->
name
);
"file
\'
%s
\'
"
,
bitmap_file
->
name
);
return
FALSE
;
}
...
...
@@ -281,7 +281,7 @@ log_online_setup_bitmap_file_range(
bitmap_dir
=
os_file_opendir
(
srv_data_home
,
FALSE
);
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
);
return
FALSE
;
}
...
...
@@ -331,7 +331,7 @@ log_online_setup_bitmap_file_range(
if
(
UNIV_UNLIKELY
(
os_file_closedir
(
bitmap_dir
)))
{
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
;
}
...
...
@@ -348,7 +348,7 @@ log_online_setup_bitmap_file_range(
bitmap_dir
=
os_file_opendir
(
srv_data_home
,
FALSE
);
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
);
return
FALSE
;
}
...
...
@@ -379,7 +379,7 @@ log_online_setup_bitmap_file_range(
if
(
UNIV_UNLIKELY
(
array_pos
>=
bitmap_files
->
count
))
{
msg
(
"InnoDB: Error: inconsistent bitmap file "
"directory
\n
"
);
"directory"
);
free
(
bitmap_files
->
files
);
return
FALSE
;
}
...
...
@@ -399,7 +399,7 @@ log_online_setup_bitmap_file_range(
if
(
UNIV_UNLIKELY
(
os_file_closedir
(
bitmap_dir
)))
{
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
);
return
FALSE
;
}
...
...
@@ -450,7 +450,7 @@ log_online_open_bitmap_file_read_only(
/* Here and below assume that bitmap file names do not
contain apostrophes, thus no need for ut_print_filename(). */
msg
(
"InnoDB: Warning: error opening the changed page "
"bitmap
\'
%s
\'
\n
"
,
bitmap_file
->
name
);
"bitmap
\'
%s
\'
"
,
bitmap_file
->
name
);
return
success
;
}
...
...
@@ -494,7 +494,7 @@ log_online_diagnose_bitmap_eof(
itself. */
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
))
{
...
...
@@ -505,7 +505,7 @@ log_online_diagnose_bitmap_eof(
for the whole server */
msg
(
"InnoDB: Warning: changed page bitmap "
"file
\'
%s
\'
does not contain a complete run "
"at the end.
\n
"
,
bitmap_file
->
name
);
"at the end."
,
bitmap_file
->
name
);
return
FALSE
;
}
}
...
...
@@ -536,7 +536,7 @@ xb_msg_missing_lsn_data(
lsn_t
missing_interval_end
)
/*!<in: interval end */
{
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
);
}
...
...
@@ -614,7 +614,7 @@ xb_page_bitmap_init(void)
msg
(
"mariabackup: incremental backup 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
;
}
...
...
@@ -698,7 +698,7 @@ xb_page_bitmap_init(void)
bmp_start_lsn
)))
{
msg
(
"mariabackup: Warning: changed page bitmap file "
"
\'
%s
\'
corrupted
\n
"
,
bitmap_file
.
name
);
"
\'
%s
\'
corrupted"
,
bitmap_file
.
name
);
rbt_free
(
result
);
free
(
bitmap_files
.
files
);
os_file_close
(
bitmap_file
.
file
);
...
...
@@ -803,7 +803,7 @@ xb_page_bitmap_init(void)
if
(
UNIV_UNLIKELY
(
!
last_page_ok
))
{
msg
(
"mariabackup: warning: changed page bitmap file "
"
\'
%s
\'
corrupted.
\n
"
,
bitmap_file
.
name
);
"
\'
%s
\'
corrupted."
,
bitmap_file
.
name
);
rbt_free
(
result
);
free
(
bitmap_files
.
files
);
os_file_close
(
bitmap_file
.
file
);
...
...
extra/mariabackup/common.h
View file @
a8a27e65
...
...
@@ -72,7 +72,7 @@ static inline int asprintf(char **strp, const char *fmt,...)
#define xb_a(expr) \
do { \
if (!(expr)) { \
msg(
"Assertion \"%s\" failed at %s:%lu\n", \
fprintf(stderr,
"Assertion \"%s\" failed at %s:%lu\n", \
#expr, __FILE__, (ulong) __LINE__); \
abort(); \
} \
...
...
@@ -86,42 +86,48 @@ static inline int asprintf(char **strp, const char *fmt,...)
#define XB_DELTA_INFO_SUFFIX ".meta"
static
inline
int
msg
(
const
char
*
fmt
,
...)
ATTRIBUTE_FORMAT
(
printf
,
1
,
2
);
static
inline
int
msg
(
const
char
*
fmt
,
...)
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
=
vfprintf
(
stderr
,
fmt
,
args
);
result
=
msg1
(
thread_num
,
fmt
,
args
);
va_end
(
args
);
return
result
;
}
static
inline
int
msg
_ts
(
const
char
*
fmt
,
...)
ATTRIBUTE_FORMAT
(
printf
,
1
,
2
);
static
inline
int
msg
_ts
(
const
char
*
fmt
,
...)
static
inline
int
msg
(
const
char
*
fmt
,
...)
ATTRIBUTE_FORMAT
(
printf
,
1
,
2
);
static
inline
int
msg
(
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
);
result
=
msg1
(
0
,
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 */
#ifdef POSIX_FADV_NORMAL
...
...
extra/mariabackup/datasink.c
→
extra/mariabackup/datasink.c
c
View file @
a8a27e65
...
...
@@ -71,7 +71,7 @@ ds_create(const char *root, ds_type_t type)
ds
=
&
datasink_buffer
;
break
;
default:
msg
(
"Unknown datasink type: %d
\n
"
,
type
);
msg
(
"Unknown datasink type: %d"
,
type
);
xb_ad
(
0
);
return
NULL
;
}
...
...
@@ -80,7 +80,7 @@ ds_create(const char *root, ds_type_t type)
if
(
ctxt
!=
NULL
)
{
ctxt
->
datasink
=
ds
;
}
else
{
msg
(
"Error: failed to initialize datasink.
\n
"
);
msg
(
"Error: failed to initialize datasink."
);
exit
(
EXIT_FAILURE
);
}
...
...
extra/mariabackup/ds_archive.c
→
extra/mariabackup/ds_archive.c
c
View file @
a8a27e65
File moved
extra/mariabackup/ds_buffer.c
→
extra/mariabackup/ds_buffer.c
c
View file @
a8a27e65
...
...
@@ -71,7 +71,7 @@ buffer_init(const char *root)
ds_ctxt_t
*
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
));
buffer_ctxt
=
(
ds_buffer_ctxt_t
*
)
(
ctxt
+
1
);
buffer_ctxt
->
buffer_size
=
DS_DEFAULT_BUFFER_SIZE
;
...
...
extra/mariabackup/ds_compress.c
→
extra/mariabackup/ds_compress.c
c
View file @
a8a27e65
...
...
@@ -95,7 +95,7 @@ compress_init(const char *root)
/* Create and initialize the worker threads */
threads
=
create_worker_threads
(
xtrabackup_compress_threads
);
if
(
threads
==
NULL
)
{
msg
(
"compress: failed to create worker threads.
\n
"
);
msg
(
"compress: failed to create worker threads."
);
return
NULL
;
}
...
...
@@ -243,7 +243,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len)
write_uint64_le
(
dest_file
,
comp_file
->
bytes_processed
))
{
msg
(
"compress: write to the destination stream "
"failed.
\n
"
);
"failed."
);
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
,
threads
[
i
].
to_len
))
{
msg
(
"compress: write to the destination stream "
"failed.
\n
"
);
"failed."
);
return
1
;
}
...
...
@@ -367,7 +367,7 @@ create_worker_threads(uint n)
if
(
pthread_create
(
&
thd
->
id
,
NULL
,
compress_worker_thread_func
,
thd
))
{
msg
(
"compress: pthread_create() failed: "
"errno = %d
\n
"
,
errno
);
"errno = %d"
,
errno
);
goto
err
;
}
}
...
...
extra/mariabackup/ds_stdout.c
→
extra/mariabackup/ds_stdout.c
c
View file @
a8a27e65
...
...
@@ -48,7 +48,7 @@ stdout_init(const char *root)
{
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
));
...
...
extra/mariabackup/ds_tmpfile.c
→
extra/mariabackup/ds_tmpfile.c
c
View file @
a8a27e65
...
...
@@ -60,7 +60,7 @@ tmpfile_init(const char *root)
ds_ctxt_t
*
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
));
tmpfile_ctxt
=
(
ds_tmpfile_ctxt_t
*
)
(
ctxt
+
1
);
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 */
list
=
list_reverse
(
list
);
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
* mystat struct */
if
(
my_fstat
(
tmp_file
->
fd
,
&
mystat
,
MYF
(
0
)))
{
msg
(
"error: my_fstat() failed.
\n
"
);
msg
(
"error: my_fstat() failed."
);
exit
(
EXIT_FAILURE
);
}
tmp_file
->
mystat
.
st_size
=
mystat
.
st_size
;
...
...
@@ -205,7 +205,7 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
&
tmp_file
->
mystat
);
if
(
dst_file
==
NULL
)
{
msg
(
"error: could not stream a temporary file to "
"'%s'
\n
"
,
tmp_file
->
orig_path
);
"'%s'"
,
tmp_file
->
orig_path
);
exit
(
EXIT_FAILURE
);
}
...
...
@@ -213,17 +213,17 @@ tmpfile_deinit(ds_ctxt_t *ctxt)
posix_fadvise
(
tmp_file
->
fd
,
0
,
0
,
POSIX_FADV_SEQUENTIAL
);
if
(
my_seek
(
tmp_file
->
fd
,
0
,
SEEK_SET
,
MYF
(
0
))
==
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
);
exit
(
EXIT_FAILURE
);
}
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
)
{
posix_fadvise
(
tmp_file
->
fd
,
offset
,
buf_size
,
POSIX_FADV_DONTNEED
);
offset
+=
buf_size
;
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
);
exit
(
EXIT_FAILURE
);
}
...
...
extra/mariabackup/ds_xbstream.c
→
extra/mariabackup/ds_xbstream.c
c
View file @
a8a27e65
...
...
@@ -79,18 +79,18 @@ xbstream_init(const char *root __attribute__((unused)))
ds_stream_ctxt_t
*
stream_ctxt
;
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
));
stream_ctxt
=
(
ds_stream_ctxt_t
*
)(
ctxt
+
1
);
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
;
}
xbstream
=
xb_stream_write_new
();
if
(
xbstream
==
NULL
)
{
msg
(
"xb_stream_write_new() failed.
\n
"
);
msg
(
"xb_stream_write_new() failed."
);
goto
err
;
}
stream_ctxt
->
xbstream
=
xbstream
;
...
...
@@ -143,7 +143,7 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
my_xbstream_write_callback
);
if
(
xbstream_file
==
NULL
)
{
msg
(
"xb_stream_write_open() failed.
\n
"
);
msg
(
"xb_stream_write_open() failed."
);
goto
err
;
}
...
...
@@ -177,7 +177,7 @@ xbstream_write(ds_file_t *file, const uchar *buf, size_t len)
xbstream_file
=
stream_file
->
xbstream_file
;
if
(
xb_stream_write_data
(
xbstream_file
,
buf
,
len
))
{
msg
(
"xb_stream_write_data() failed.
\n
"
);
msg
(
"xb_stream_write_data() failed."
);
return
1
;
}
...
...
@@ -209,7 +209,7 @@ xbstream_deinit(ds_ctxt_t *ctxt)
stream_ctxt
=
(
ds_stream_ctxt_t
*
)
ctxt
->
ptr
;
if
(
xb_stream_write_done
(
stream_ctxt
->
xbstream
))
{
msg
(
"xb_stream_done() failed.
\n
"
);
msg
(
"xb_stream_done() failed."
);
}
if
(
stream_ctxt
->
dest_file
)
{
...
...
extra/mariabackup/encryption_plugin.cc
View file @
a8a27e65
...
...
@@ -45,7 +45,7 @@ static std::string get_encryption_plugin_from_cnf()
FILE
*
f
=
fopen
(
"backup-my.cnf"
,
"r"
);
if
(
!
f
)
{
msg
(
"
cannot open backup-my.cnf for reading
\n
"
);
msg
(
"
Can't open backup-my.cnf for reading
"
);
exit
(
EXIT_FAILURE
);
}
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
();
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
{
...
...
@@ -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. */
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
++
)
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
);
}
extra/mariabackup/fil_cur.cc
View file @
a8a27e65
...
...
@@ -174,9 +174,8 @@ xb_fil_cur_open(
/* The following call prints an error message */
os_file_get_last_error
(
TRUE
);
msg
(
"[%02u] mariabackup: error: cannot open "
"tablespace %s
\n
"
,
thread_n
,
cursor
->
abs_path
);
msg
(
thread_n
,
"mariabackup: error: cannot open "
"tablespace %s"
,
cursor
->
abs_path
);
return
(
XB_FIL_CUR_SKIP
);
}
...
...
@@ -217,8 +216,8 @@ xb_fil_cur_open(
cursor
->
statinfo
.
st_size
=
(
ulonglong
)
max_file_size
;
}
if
(
err
)
{
msg
(
"[%02u] mariabackup: error: cannot fstat %s
\n
"
,
thread_n
,
cursor
->
abs_path
);
msg
(
thread_n
,
"mariabackup: error: cannot fstat %s
"
,
cursor
->
abs_path
);
xb_fil_cur_close
(
cursor
);
...
...
@@ -262,8 +261,6 @@ xb_fil_cur_open(
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
/
page_size
.
physical
());
...
...
@@ -413,14 +410,8 @@ xb_fil_cur_read(
&&
offset
+
to_read
==
cursor
->
statinfo
.
st_size
)
{
if
(
to_read
<
(
ib_int64_t
)
page_size
)
{
msg
(
"[%02u] mariabackup: Warning: junk at the end of "
"%s:
\n
"
,
cursor
->
thread_n
,
cursor
->
abs_path
);
msg
(
"[%02u] mariabackup: Warning: offset = %llu, "
"to_read = %llu
\n
"
,
cursor
->
thread_n
,
(
unsigned
long
long
)
offset
,
(
unsigned
long
long
)
to_read
);
msg
(
cursor
->
thread_n
,
"Warning: junk at the end of "
"%s, offset = %llu, to_read = %llu"
,
cursor
->
abs_path
,
(
ulonglong
)
offset
,
(
ulonglong
)
to_read
);
return
(
XB_FIL_CUR_EOF
);
}
...
...
@@ -464,20 +455,17 @@ xb_fil_cur_read(
retry_count
--
;
if
(
retry_count
==
0
)
{
msg
(
"[%02u] mariabackup: "
msg
(
cursor
->
thread_n
,
"Error: failed to read page after "
"10 retries. File %s seems to be "
"corrupted.
\n
"
,
cursor
->
thread_n
,
cursor
->
abs_path
);
"corrupted."
,
cursor
->
abs_path
);
ret
=
XB_FIL_CUR_ERROR
;
buf_page_print
(
page
,
cursor
->
page_size
);
break
;
}
msg
(
"[%02u] mariabackup: "
"Database page corruption detected at page "
ULINTPF
", retrying...
\n
"
,
cursor
->
thread_n
,
msg
(
cursor
->
thread_n
,
"Database page corruption detected at page "
ULINTPF
", retrying..."
,
page_no
);
os_thread_sleep
(
100000
);
goto
read_retry
;
}
...
...
extra/mariabackup/innobackupex.cc
View file @
a8a27e65
...
...
@@ -738,7 +738,7 @@ ibx_get_one_option(int optid,
exit
(
0
);
break
;
case
'v'
:
msg
(
"innobackupex version %s %s (%s)
\n
"
,
printf
(
"innobackupex version %s %s (%s)
"
,
MYSQL_SERVER_VERSION
,
SYSTEM_TYPE
,
MACHINE_TYPE
);
exit
(
0
);
...
...
extra/mariabackup/write_filt.cc
View file @
a8a27e65
...
...
@@ -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
);
if
(
!
cp
->
delta_buf
)
{
msg
(
"[%02u] mariabackup: Error: "
"cannot allocate %zu bytes
\n
"
,
cursor
->
thread_n
,
(
size_t
)
cp
->
delta_buf_size
);
msg
(
cursor
->
thread_n
,
"Can't allocate %zu bytes"
,
(
size_t
)
cp
->
delta_buf_size
);
return
(
FALSE
);
}
...
...
@@ -90,9 +89,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
XB_DELTA_INFO_SUFFIX
);
const
xb_delta_info_t
info
(
cursor
->
page_size
,
cursor
->
space_id
);
if
(
!
xb_write_delta_metadata
(
meta_name
,
&
info
))
{
msg
(
"[%02u] mariabackup:
Error: "
"failed to write meta info for %s
\n
"
,
cursor
->
thread_n
,
cursor
->
rel_path
);
msg
(
cursor
->
thread_n
,
"
Error: "
"failed to write meta info for %s"
,
cursor
->
rel_path
);
return
(
FALSE
);
}
...
...
extra/mariabackup/xbstream.c
→
extra/mariabackup/xbstream.c
c
View file @
a8a27e65
...
...
@@ -45,7 +45,6 @@ datasink_t datasink_archive;
datasink_t
datasink_xbstream
;
datasink_t
datasink_compress
;
datasink_t
datasink_tmpfile
;
datasink_t
datasink_buffer
;
static
run_mode_t
opt_mode
;
static
char
*
opt_directory
=
NULL
;
...
...
@@ -106,7 +105,7 @@ main(int argc, char **argv)
}
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
;
}
...
...
@@ -184,7 +183,7 @@ int
set_run_mode
(
run_mode_t
mode
)
{
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
;
}
...
...
@@ -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
,
MYF
(
MY_WME
)))
>
0
)
{
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_free
(
buf
);
return
1
;
...
...
@@ -262,13 +261,13 @@ mode_create(int argc, char **argv)
xb_wstream_t
*
stream
;
if
(
argc
<
1
)
{
msg
(
"%s: no files are specified.
\n
"
,
my_progname
);
msg
(
"%s: no files are specified."
,
my_progname
);
return
1
;
}
stream
=
xb_stream_write_new
();
if
(
stream
==
NULL
)
{
msg
(
"%s: xb_stream_write_new() failed.
\n
"
,
my_progname
);
msg
(
"%s: xb_stream_write_new() failed."
,
my_progname
);
return
1
;
}
...
...
@@ -281,13 +280,13 @@ mode_create(int argc, char **argv)
goto
err
;
}
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
);
goto
err
;
}
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
;
}
...
...
@@ -297,7 +296,7 @@ mode_create(int argc, char **argv)
}
if
(
opt_verbose
)
{
msg
(
"%s
\n
"
,
filepath
);
msg
(
"%s"
,
filepath
);
}
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
);
if
(
file
==
NULL
)
{
msg
(
"%s: failed to create file.
\n
"
,
my_progname
);
msg
(
"%s: failed to create file."
,
my_progname
);
goto
err
;
}
if
(
opt_verbose
)
{
msg
(
"%s
\n
"
,
entry
->
path
);
msg
(
"%s"
,
entry
->
path
);
}
entry
->
file
=
file
;
...
...
@@ -425,7 +424,7 @@ extract_worker_thread_func(void *arg)
break
;
}
if
(
my_hash_insert
(
ctxt
->
filehash
,
(
uchar
*
)
entry
))
{
msg
(
"%s: my_hash_insert() failed.
\n
"
,
msg
(
"%s: my_hash_insert() failed."
,
my_progname
);
pthread_mutex_unlock
(
ctxt
->
mutex
);
break
;
...
...
@@ -454,7 +453,7 @@ extract_worker_thread_func(void *arg)
if
(
entry
->
offset
!=
chunk
.
offset
)
{
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
);
pthread_mutex_unlock
(
&
entry
->
mutex
);
res
=
XB_STREAM_READ_ERROR
;
...
...
@@ -462,7 +461,7 @@ extract_worker_thread_func(void *arg)
}
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
);
res
=
XB_STREAM_READ_ERROR
;
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
,
0
,
0
,
(
my_hash_get_key
)
get_file_entry_key
,
(
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
;
}
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
);
return
1
;
}
...
...
@@ -520,7 +519,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
stream
=
xb_stream_read_new
();
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
);
ret
=
1
;
goto
exit
;
...
...
@@ -531,8 +530,8 @@ mode_extract(int n_threads, int argc __attribute__((unused)),
ctxt
.
ds_ctxt
=
ds_ctxt
;
ctxt
.
mutex
=
&
mutex
;
tids
=
calloc
(
n_threads
,
sizeof
(
pthread_t
));
retvals
=
calloc
(
n_threads
,
sizeof
(
void
*
));
tids
=
(
pthread_t
*
)
calloc
(
n_threads
,
sizeof
(
pthread_t
));
retvals
=
(
void
**
)
calloc
(
n_threads
,
sizeof
(
void
*
));
for
(
i
=
0
;
i
<
n_threads
;
i
++
)
pthread_create
(
tids
+
i
,
NULL
,
extract_worker_thread_func
,
...
...
extra/mariabackup/xbstream.h
View file @
a8a27e65
...
...
@@ -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
);
in
t
xb_stream_validate_checksum
(
xb_rstream_chunk_t
*
chunk
);
xb_rstream_result_
t
xb_stream_validate_checksum
(
xb_rstream_chunk_t
*
chunk
);
#endif
extra/mariabackup/xbstream_read.c
→
extra/mariabackup/xbstream_read.c
c
View file @
a8a27e65
...
...
@@ -67,15 +67,15 @@ validate_chunk_type(uchar code)
}
}
in
t
xb_rstream_result_
t
xb_stream_validate_checksum
(
xb_rstream_chunk_t
*
chunk
)
{
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
)
{
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
,
checksum
);
return
XB_STREAM_READ_ERROR
;
...
...
@@ -86,8 +86,8 @@ xb_stream_validate_checksum(xb_rstream_chunk_t *chunk)
#define F_READ(buf,len) \
do { \
if (xb_read_full(fd, buf, len) < len) { \
msg("xb_stream_read_chunk(): my_read() failed.
\n
"); \
if (xb_read_full(fd,
(uchar *)
buf, len) < len) { \
msg("xb_stream_read_chunk(): my_read() failed."); \
goto err; \
} \
} while (0)
...
...
@@ -111,7 +111,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
return
XB_STREAM_READ_EOF
;
}
else
if
(
tbytes
<
CHUNK_HEADER_CONSTANT_LEN
)
{
msg
(
"xb_stream_read_chunk(): unexpected end of stream at "
"offset 0x%llx.
\n
"
,
stream
->
offset
);
"offset 0x%llx."
,
stream
->
offset
);
goto
err
;
}
...
...
@@ -120,7 +120,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
/* Chunk magic value */
if
(
memcmp
(
tmpbuf
,
XB_STREAM_CHUNK_MAGIC
,
8
))
{
msg
(
"xb_stream_read_chunk(): wrong chunk magic at offset "
"0x%llx.
\n
"
,
(
ulonglong
)
stream
->
offset
);
"0x%llx."
,
(
ulonglong
)
stream
->
offset
);
goto
err
;
}
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
&&
!
(
chunk
->
flags
&
XB_STREAM_FLAG_IGNORABLE
))
{
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
);
goto
err
;
}
...
...
@@ -146,7 +146,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
pathlen
=
uint4korr
(
ptr
);
if
(
pathlen
>=
FN_REFLEN
)
{
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
;
}
chunk
->
pathlen
=
pathlen
;
...
...
@@ -170,7 +170,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
ullval
=
uint8korr
(
tmpbuf
);
if
(
ullval
>
(
ulonglong
)
SIZE_T_MAX
)
{
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
);
goto
err
;
}
...
...
@@ -181,7 +181,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk)
ullval
=
uint8korr
(
tmpbuf
+
8
);
if
(
ullval
>
(
ulonglong
)
MY_OFF_T_MAX
)
{
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
);
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
));
if
(
chunk
->
data
==
NULL
)
{
msg
(
"xb_stream_read_chunk(): failed to increase buffer "
"to %lu bytes.
\n
"
,
(
ulong
)
chunk
->
length
);
"to %lu bytes."
,
(
ulong
)
chunk
->
length
);
goto
err
;
}
chunk
->
buflen
=
chunk
->
length
;
...
...
extra/mariabackup/xbstream_write.c
→
extra/mariabackup/xbstream_write.c
c
View file @
a8a27e65
...
...
@@ -55,7 +55,7 @@ xb_stream_default_write_callback(xb_wstream_file_t *file __attribute__((unused))
void
*
userdata
__attribute__
((
unused
)),
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
len
;
}
...
...
@@ -83,7 +83,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
path_len
=
strlen
(
path
);
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
;
}
...
...
@@ -216,7 +216,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len)
int8store
(
ptr
,
len
);
/* Payload length */
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
);
...
...
extra/mariabackup/xtrabackup.cc
View file @
a8a27e65
This diff is collapsed.
Click to expand it.
extra/mariabackup/xtrabackup.h
View file @
a8a27e65
...
...
@@ -71,7 +71,7 @@ extern char *xtrabackup_databases_file;
extern
char
*
xtrabackup_tables_exclude
;
extern
char
*
xtrabackup_databases_exclude
;
extern
ibool
xtrabackup_compress
;
extern
uint
xtrabackup_compress
;
extern
my_bool
xtrabackup_backup
;
extern
my_bool
xtrabackup_prepare
;
...
...
@@ -86,14 +86,10 @@ extern int xtrabackup_parallel;
extern
my_bool
xb_close_files
;
extern
const
char
*
xtrabackup_compress_alg
;
#ifdef __cplusplus
extern
"C"
{
#endif
extern
uint
xtrabackup_compress_threads
;
extern
ulonglong
xtrabackup_compress_chunk_size
;
#ifdef __cplusplus
}
#endif
extern
uint
xtrabackup_compress_threads
;
extern
ulonglong
xtrabackup_compress_chunk_size
;
extern
my_bool
xtrabackup_export
;
extern
char
*
xtrabackup_extra_lsndir
;
extern
ulint
xtrabackup_log_copy_interval
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment