MDEV-9566 Port Percona Xtrabackup to MariaDB as mariabackup
- Modify backup code to work with MariaDB's 10.1 xtradb - Remove crypt encryption, version_check.pl, "compact backup" - Add encryption plugin
This commit is contained in:
parent
d7714308e0
commit
ce4c56db0c
@ -13,65 +13,138 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
INCLUDE(gcrypt)
|
||||
INCLUDE(curl)
|
||||
INCLUDE(libev)
|
||||
|
||||
ADD_SUBDIRECTORY(libarchive)
|
||||
ADD_SUBDIRECTORY(jsmn)
|
||||
OPTION(WITH_MARIABACKUP "Include mariabackup" ON)
|
||||
IF(NOT WITH_MARIABACKUP)
|
||||
RETURN()
|
||||
ENDIF()
|
||||
|
||||
FIND_GCRYPT()
|
||||
FIND_CURL()
|
||||
FIND_EV()
|
||||
|
||||
# xxd is needed to embed version_check script
|
||||
FIND_PROGRAM(XXD_PATH xxd)
|
||||
IF(NOT WIN32)
|
||||
CHECK_SYMBOL_EXISTS(regcomp regex.h HAVE_SYSTEM_REGEX)
|
||||
IF(HAVE_SYSTEM_REGEX)
|
||||
ADD_DEFINITIONS(-DHAVE_SYSTEM_REGEX)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(NOT XXD_PATH)
|
||||
MESSAGE(FATAL_ERROR "xxd not found. Try to install vim-common.")
|
||||
ENDIF(NOT XXD_PATH)
|
||||
IF(WITH_LIBARCHIVE STREQUAL "STATIC")
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES .a .lib)
|
||||
ENDIF()
|
||||
|
||||
FIND_PACKAGE(LibArchive)
|
||||
|
||||
IF(NOT DEFINED WITH_LIBARCHIVE)
|
||||
IF(LibArchive_FOUND)
|
||||
SET(WITH_LIBARCHIVE_DEFAULT ON)
|
||||
ELSE()
|
||||
SET(WITH_LIBARCHIVE_DEFAULT OFF)
|
||||
ENDIF()
|
||||
SET(WITH_LIBARCHIVE ${WITH_LIBARCHIVE_DEFAULT} CACHE STRING "Use libarchive for streaming features (ON, OFF or STATIC)" )
|
||||
ENDIF()
|
||||
|
||||
IF(NOT WITH_LIBARCHIVE MATCHES "^(ON|OFF|STATIC)$")
|
||||
MESSAGE(FATAL_ERROR "Invalid value for WITH_LIBARCHIVE: '${WITH_LIBARCHIVE}'. Use one of ON, OFF or STATIC")
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
SET(PIC_FLAG -fPIC)
|
||||
ENDIF()
|
||||
|
||||
IF((NOT WITH_LIBARCHIVE STREQUAL "OFF") AND (NOT LibArchive_FOUND))
|
||||
IF(CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||
MESSAGE("libarchive can't be built, old cmake")
|
||||
ELSE()
|
||||
# Build a local version
|
||||
INCLUDE(ExternalProject)
|
||||
SET(libarchive_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/libarchive)
|
||||
SET(libarchive_CMAKE_ARGS
|
||||
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
-DENABLE_ICONV=OFF
|
||||
-DENABLE_TAR=ON
|
||||
-DENABLE_OPENSSL=OFF
|
||||
-DENABLE_TEST=OFF
|
||||
"-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG} ${PIC_FLAG}"
|
||||
"-DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO} ${PIC_FLAG}"
|
||||
"-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE} ${PIC_FLAG}"
|
||||
"-DCMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL} ${PIC_FLAG}"
|
||||
)
|
||||
IF(WIN32)
|
||||
SET(libarchive_CMAKE_ARGS ${libarchive_CMAKE_ARGS} -DWINDOWS_VERSION=WIN7 -DCMAKE_DEBUG_POSTFIX=d)
|
||||
ENDIF()
|
||||
|
||||
SET(LIBARCHIVE_DIR ${CMAKE_CURRENT_BINARY_DIR}/libarchive)
|
||||
ExternalProject_Add(libarchive
|
||||
PREFIX ${libarchive_PREFIX}
|
||||
DOWNLOAD_DIR ${LIBARCHIVE_DIR}
|
||||
URL http://www.libarchive.org/downloads/libarchive-3.2.2.tar.gz
|
||||
INSTALL_DIR ${LIBARCHIVE_DIR}
|
||||
CMAKE_ARGS ${libarchive_CMAKE_ARGS}
|
||||
)
|
||||
ADD_LIBRARY(archive_static STATIC IMPORTED)
|
||||
ADD_DEPENDENCIES(archive_static libarchive)
|
||||
IF(WIN32)
|
||||
SET(LIBARCHIVE_RELEASE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_static${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
SET(LIBARCHIVE_DEBUG_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive_staticd${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_RELWITHDEBINFO ${LIBARCHIVE_RELEASE_LIB})
|
||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_RELEASE ${LIBARCHIVE_RELEASE_LIB})
|
||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_DEBUG ${LIBARCHIVE_DEBUG_LIB})
|
||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION_MINSIZEREL ${LIBARCHIVE_RELEASE_LIB})
|
||||
ELSE()
|
||||
SET_PROPERTY(TARGET archive_static PROPERTY IMPORTED_LOCATION ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive${CMAKE_STATIC_LIBRARY_SUFFIX})
|
||||
ENDIF()
|
||||
|
||||
SET(LibArchive_FOUND ON )
|
||||
SET(LibArchive_INCLUDE_DIRS ${LIBARCHIVE_DIR}/include )
|
||||
SET(LibArchive_LIBRARIES archive_static)
|
||||
IF(WIN32)
|
||||
SET(LIBARCHIVE_STATIC 1)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
|
||||
IF(WITH_LIBARCHIVE AND LibArchive_FOUND)
|
||||
ADD_DEFINITIONS(-DHAVE_LIBARCHIVE)
|
||||
IF(LIBARCHIVE_STATIC)
|
||||
ADD_DEFINITIONS(-DLIBARCHIVE_STATIC)
|
||||
ENDIF()
|
||||
INCLUDE_DIRECTORIES(${LibArchive_INCLUDE_DIRS})
|
||||
LINK_LIBRARIES(${LibArchive_LIBRARIES})
|
||||
SET(DS_ARCHIVE_SOURCE ds_archive.c)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/include
|
||||
${CMAKE_SOURCE_DIR}/storage/xtradb/include
|
||||
${CMAKE_SOURCE_DIR}/sql
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/xtrabackup/src/libarchive/libarchive
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/xtrabackup/src/quicklz
|
||||
${CMAKE_SOURCE_DIR}/storage/innobase/xtrabackup/src/jsmn
|
||||
${GCRYPT_INCLUDE_DIR}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
${LIBEV_INCLUDE_DIRS}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/quicklz
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
ADD_DEFINITIONS(${SSL_DEFINES})
|
||||
IF(NOT HAVE_SYSTEM_REGEX)
|
||||
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre)
|
||||
ENDIF()
|
||||
|
||||
ADD_DEFINITIONS(-UMYSQL_SERVER)
|
||||
########################################################################
|
||||
# xtrabackup binary
|
||||
########################################################################
|
||||
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/xtrabackup_version.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/xtrabackup_version.h )
|
||||
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version_check_pl.h
|
||||
COMMAND ${XXD_PATH} --include version_check.pl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/version_check_pl.h
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
IF(WIN32)
|
||||
SET(NT_SERVICE_SOURCE ${PROJECT_SOURCE_DIR}/sql/nt_servc.cc)
|
||||
ELSE()
|
||||
SET(NT_SERVICE_SOURCE)
|
||||
ENDIF()
|
||||
|
||||
ADD_CUSTOM_TARGET(GenVersionCheck
|
||||
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/version_check_pl.h)
|
||||
ADD_DEFINITIONS(-DPCRE_STATIC=1)
|
||||
|
||||
SET_SOURCE_FILES_PROPERTIES(
|
||||
xtrabackup.cc
|
||||
backup_mysql.cc
|
||||
PROPERTIES COMPILE_FLAGS -DMYSQL_CLIENT)
|
||||
|
||||
MYSQL_ADD_EXECUTABLE(xtrabackup
|
||||
MYSQL_ADD_EXECUTABLE(mariabackup
|
||||
xtrabackup.cc
|
||||
innobackupex.cc
|
||||
changed_page_bitmap.cc
|
||||
compact.cc
|
||||
datasink.c
|
||||
ds_archive.c
|
||||
${DS_ARCHIVE_SOURCE}
|
||||
ds_buffer.c
|
||||
ds_compress.c
|
||||
ds_encrypt.c
|
||||
@ -89,31 +162,29 @@ MYSQL_ADD_EXECUTABLE(xtrabackup
|
||||
xbstream_write.c
|
||||
backup_mysql.cc
|
||||
backup_copy.cc
|
||||
../../../../sql-common/client_authentication.cc
|
||||
encryption_plugin.cc
|
||||
${PROJECT_SOURCE_DIR}/libmysql/libmysql.c
|
||||
${PROJECT_SOURCE_DIR}/sql/net_serv.cc
|
||||
${NT_SERVICE_SOURCE}
|
||||
COMPONENT backup
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(xtrabackup PROPERTIES ENABLE_EXPORTS TRUE)
|
||||
|
||||
TARGET_LINK_LIBRARIES(xtrabackup
|
||||
mysqlserver
|
||||
${GCRYPT_LIBS}
|
||||
archive_static
|
||||
)
|
||||
# Export all symbols on Unix, for better crash callstacks
|
||||
SET_TARGET_PROPERTIES(mariabackup PROPERTIES ENABLE_EXPORTS TRUE)
|
||||
|
||||
ADD_DEPENDENCIES(xtrabackup GenVersionCheck)
|
||||
|
||||
########################################################################
|
||||
# innobackupex symlink
|
||||
########################################################################
|
||||
ADD_CUSTOM_COMMAND(TARGET xtrabackup
|
||||
COMMAND ${CMAKE_COMMAND} ARGS -E create_symlink
|
||||
xtrabackup innobackupex)
|
||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/innobackupex DESTINATION bin)
|
||||
TARGET_LINK_LIBRARIES(mariabackup sql)
|
||||
|
||||
IF(NOT HAVE_SYSTEM_REGEX)
|
||||
TARGET_LINK_LIBRARIES(mariabackup pcreposix)
|
||||
ENDIF()
|
||||
|
||||
|
||||
########################################################################
|
||||
# xbstream binary
|
||||
########################################################################
|
||||
MYSQL_ADD_EXECUTABLE(xbstream
|
||||
MYSQL_ADD_EXECUTABLE(mbstream
|
||||
ds_buffer.c
|
||||
ds_local.c
|
||||
ds_stdout.c
|
||||
@ -121,53 +192,15 @@ MYSQL_ADD_EXECUTABLE(xbstream
|
||||
xbstream.c
|
||||
xbstream_read.c
|
||||
xbstream_write.c
|
||||
|
||||
COMPONENT backup
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(xbstream
|
||||
PROPERTIES LINKER_LANGUAGE CXX
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(xbstream
|
||||
TARGET_LINK_LIBRARIES(mbstream
|
||||
mysys
|
||||
mysys_ssl
|
||||
)
|
||||
)
|
||||
|
||||
########################################################################
|
||||
# xbcrypt binary
|
||||
########################################################################
|
||||
MYSQL_ADD_EXECUTABLE(xbcrypt
|
||||
xbcrypt.c
|
||||
xbcrypt_common.c
|
||||
xbcrypt_read.c
|
||||
xbcrypt_write.c
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(xbcrypt
|
||||
PROPERTIES LINKER_LANGUAGE CXX
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(xbcrypt
|
||||
${GCRYPT_LIBS}
|
||||
mysys
|
||||
mysys_ssl
|
||||
)
|
||||
|
||||
########################################################################
|
||||
# xbcloud binary
|
||||
########################################################################
|
||||
MYSQL_ADD_EXECUTABLE(xbcloud
|
||||
xbcloud.cc
|
||||
)
|
||||
|
||||
SET_TARGET_PROPERTIES(xbcloud
|
||||
PROPERTIES LINKER_LANGUAGE CXX
|
||||
)
|
||||
|
||||
TARGET_LINK_LIBRARIES(xbcloud
|
||||
${GCRYPT_LIBS}
|
||||
${LIBEV_LIBRARIES}
|
||||
${CURL_LIBRARIES}
|
||||
mysys
|
||||
mysys_ssl
|
||||
jsmn
|
||||
)
|
||||
IF(MSVC)
|
||||
SET_TARGET_PROPERTIES(mbstream PROPERTIES LINK_FLAGS setargv.obj)
|
||||
ENDIF()
|
||||
|
@ -1,6 +1,7 @@
|
||||
/******************************************************
|
||||
hot backup tool for InnoDB
|
||||
(c) 2009-2015 Percona LLC and/or its affiliates
|
||||
(c) 2017 MariaDB
|
||||
Originally Created 3/3/2009 Yasufumi Kinoshita
|
||||
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
|
||||
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
|
||||
@ -48,13 +49,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <mysqld.h>
|
||||
#include <version_check_pl.h>
|
||||
#include <sstream>
|
||||
#include "fil_cur.h"
|
||||
#include "xtrabackup.h"
|
||||
#include "common.h"
|
||||
#include "backup_copy.h"
|
||||
#include "backup_mysql.h"
|
||||
#include <btr0btr.h>
|
||||
#include "xb0xb.h"
|
||||
|
||||
|
||||
/* list of files to sync for --rsync mode */
|
||||
@ -110,6 +112,7 @@ struct datadir_thread_ctxt_t {
|
||||
bool ret;
|
||||
};
|
||||
|
||||
static bool backup_files_from_datadir(const char *dir_path);
|
||||
|
||||
/************************************************************************
|
||||
Retirn true if character if file separator */
|
||||
@ -225,7 +228,7 @@ datadir_iter_next_database(datadir_iter_t *it)
|
||||
it->dbdir = NULL;
|
||||
}
|
||||
|
||||
while (fil_file_readdir_next_file(&it->err, it->datadir_path,
|
||||
while (os_file_readdir_next_file(it->datadir_path,
|
||||
it->dir, &it->dbinfo) == 0) {
|
||||
ulint len;
|
||||
|
||||
@ -340,7 +343,7 @@ datadir_iter_next_file(datadir_iter_t *it)
|
||||
return(false);
|
||||
}
|
||||
|
||||
while (fil_file_readdir_next_file(&it->err, it->dbpath, it->dbdir,
|
||||
while (os_file_readdir_next_file(it->dbpath, it->dbdir,
|
||||
&it->fileinfo) == 0) {
|
||||
|
||||
if (it->fileinfo.type == OS_FILE_TYPE_DIR) {
|
||||
@ -449,9 +452,9 @@ struct datafile_cur_t {
|
||||
uint thread_n;
|
||||
byte* orig_buf;
|
||||
byte* buf;
|
||||
ib_int64_t buf_size;
|
||||
ib_int64_t buf_read;
|
||||
ib_int64_t buf_offset;
|
||||
size_t buf_size;
|
||||
size_t buf_read;
|
||||
size_t buf_offset;
|
||||
};
|
||||
|
||||
static
|
||||
@ -486,7 +489,7 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
|
||||
cursor->abs_path,
|
||||
OS_FILE_OPEN,
|
||||
OS_FILE_READ_ONLY,
|
||||
&success);
|
||||
&success, 0);
|
||||
if (!success) {
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
@ -498,7 +501,7 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (my_fstat(cursor->file, &cursor->statinfo, MYF(MY_WME))) {
|
||||
if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) {
|
||||
msg("[%02u] error: cannot stat %s\n",
|
||||
thread_n, cursor->abs_path);
|
||||
|
||||
@ -510,7 +513,7 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n)
|
||||
posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
|
||||
cursor->buf_size = 10 * 1024 * 1024;
|
||||
cursor->buf = static_cast<byte *>(ut_malloc(cursor->buf_size));
|
||||
cursor->buf = static_cast<byte *>(ut_malloc((ulint)cursor->buf_size));
|
||||
|
||||
return(true);
|
||||
}
|
||||
@ -525,7 +528,7 @@ datafile_read(datafile_cur_t *cursor)
|
||||
|
||||
xtrabackup_io_throttling();
|
||||
|
||||
to_read = min(cursor->statinfo.st_size - cursor->buf_offset,
|
||||
to_read = (ulint)MY_MIN(cursor->statinfo.st_size - cursor->buf_offset,
|
||||
cursor->buf_size);
|
||||
|
||||
if (to_read == 0) {
|
||||
@ -603,6 +606,11 @@ ends_with(const char *str, const char *suffix)
|
||||
&& strcmp(str + str_len - suffix_len, suffix) == 0);
|
||||
}
|
||||
|
||||
static bool starts_with(const char *str, const char *prefix)
|
||||
{
|
||||
return strncmp(str, prefix, strlen(prefix)) == 0;
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
Create directories recursively.
|
||||
@return 0 if directories created successfully. */
|
||||
@ -644,6 +652,7 @@ Return true if first and second arguments are the same path. */
|
||||
bool
|
||||
equal_paths(const char *first, const char *second)
|
||||
{
|
||||
#ifdef HAVE_REALPATH
|
||||
char real_first[PATH_MAX];
|
||||
char real_second[PATH_MAX];
|
||||
|
||||
@ -655,6 +664,9 @@ equal_paths(const char *first, const char *second)
|
||||
}
|
||||
|
||||
return (strcmp(real_first, real_second) == 0);
|
||||
#else
|
||||
return strcmp(first, second) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@ -675,10 +687,8 @@ directory_exists(const char *dir, bool create)
|
||||
}
|
||||
|
||||
if (mkdirp(dir, 0777, MYF(0)) < 0) {
|
||||
|
||||
msg("Can not create directory %s: %s\n", dir,
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno));
|
||||
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not create directory %s: %s\n", dir, errbuf);
|
||||
return(false);
|
||||
|
||||
}
|
||||
@ -688,9 +698,9 @@ directory_exists(const char *dir, bool create)
|
||||
os_dir = os_file_opendir(dir, FALSE);
|
||||
|
||||
if (os_dir == NULL) {
|
||||
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not open directory %s: %s\n", dir,
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno));
|
||||
errbuf);
|
||||
|
||||
return(false);
|
||||
}
|
||||
@ -1054,16 +1064,17 @@ move_file(ds_ctxt_t *datasink,
|
||||
dst_file_path, thread_n);
|
||||
msg_ts("[%02u] Removing %s\n", thread_n, src_file_path);
|
||||
if (unlink(src_file_path) != 0) {
|
||||
my_strerror(errbuf, sizeof(errbuf), errno);
|
||||
msg("Error: unlink %s failed: %s\n",
|
||||
src_file_path,
|
||||
my_strerror(errbuf,
|
||||
sizeof(errbuf), errno));
|
||||
errbuf);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not move file %s to %s: %s\n",
|
||||
src_file_path, dst_file_path_abs,
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno));
|
||||
errbuf);
|
||||
return(false);
|
||||
}
|
||||
|
||||
@ -1360,6 +1371,10 @@ backup_start()
|
||||
return(false);
|
||||
}
|
||||
|
||||
if (!backup_files_from_datadir(fil_path_to_mysql_datadir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// There is no need to stop slave thread before coping non-Innodb data when
|
||||
// --no-lock option is used because --no-lock option requires that no DDL or
|
||||
// DML to non-transaction tables can occur.
|
||||
@ -1578,7 +1593,11 @@ ibx_cleanup_full_backup()
|
||||
while (datadir_iter_next(it, &node)) {
|
||||
|
||||
if (node.is_empty_dir) {
|
||||
#ifdef _WIN32
|
||||
DeleteFile(node.filepath);
|
||||
#else
|
||||
rmdir(node.filepath);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (xtrabackup_incremental && !node.is_empty_dir
|
||||
@ -1605,6 +1624,9 @@ apply_log_finish()
|
||||
return(true);
|
||||
}
|
||||
|
||||
extern void
|
||||
os_io_init_simple(void);
|
||||
|
||||
bool
|
||||
copy_back()
|
||||
{
|
||||
@ -1661,7 +1683,7 @@ copy_back()
|
||||
}
|
||||
|
||||
srv_max_n_threads = 1000;
|
||||
os_sync_mutex = NULL;
|
||||
//os_sync_mutex = NULL;
|
||||
ut_mem_init();
|
||||
/* temporally dummy value to avoid crash */
|
||||
srv_page_size_shift = 14;
|
||||
@ -1764,10 +1786,9 @@ copy_back()
|
||||
|
||||
if (mkdirp(path, 0777, MYF(0)) < 0) {
|
||||
char errbuf[MYSYS_STRERROR_SIZE];
|
||||
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
msg("Can not create directory %s: %s\n",
|
||||
path, my_strerror(errbuf,
|
||||
sizeof(errbuf), my_errno));
|
||||
path, errbuf);
|
||||
ret = false;
|
||||
|
||||
goto cleanup;
|
||||
@ -1855,13 +1876,12 @@ cleanup:
|
||||
|
||||
ds_data = NULL;
|
||||
|
||||
//os_sync_free();
|
||||
mem_close();
|
||||
//os_sync_mutex = NULL;
|
||||
ut_free_all_mem();
|
||||
sync_close();
|
||||
sync_initialized = FALSE;
|
||||
os_sync_free();
|
||||
mem_close();
|
||||
os_sync_mutex = NULL;
|
||||
ut_free_all_mem();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -1872,7 +1892,7 @@ decrypt_decompress_file(const char *filepath, uint thread_n)
|
||||
char *dest_filepath = strdup(filepath);
|
||||
bool needs_action = false;
|
||||
|
||||
cmd << "cat " << filepath;
|
||||
cmd << IF_WIN("type ","cat ") << filepath;
|
||||
|
||||
if (ends_with(filepath, ".xbcrypt") && opt_decrypt) {
|
||||
cmd << " | xbcrypt --decrypt --encrypt-algo="
|
||||
@ -1926,7 +1946,7 @@ decrypt_decompress_file(const char *filepath, uint thread_n)
|
||||
}
|
||||
|
||||
static
|
||||
os_thread_ret_t
|
||||
os_thread_ret_t STDCALL
|
||||
decrypt_decompress_thread_func(void *arg)
|
||||
{
|
||||
bool ret = true;
|
||||
@ -1974,7 +1994,7 @@ decrypt_decompress()
|
||||
datadir_iter_t *it = NULL;
|
||||
|
||||
srv_max_n_threads = 1000;
|
||||
os_sync_mutex = NULL;
|
||||
//os_sync_mutex = NULL;
|
||||
ut_mem_init();
|
||||
os_sync_init();
|
||||
sync_init();
|
||||
@ -2008,40 +2028,43 @@ decrypt_decompress()
|
||||
|
||||
sync_close();
|
||||
sync_initialized = FALSE;
|
||||
os_sync_free();
|
||||
os_sync_mutex = NULL;
|
||||
//os_sync_free();
|
||||
//os_sync_mutex = NULL;
|
||||
ut_free_all_mem();
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
||||
void
|
||||
version_check()
|
||||
/*
|
||||
Copy some files from top level datadir.
|
||||
Do not copy the Innodb files (ibdata1, redo log files),
|
||||
as this is done in a separate step.
|
||||
*/
|
||||
static bool backup_files_from_datadir(const char *dir_path)
|
||||
{
|
||||
if (opt_password != NULL) {
|
||||
setenv("option_mysql_password", opt_password, 1);
|
||||
}
|
||||
if (opt_user != NULL) {
|
||||
setenv("option_mysql_user", opt_user, 1);
|
||||
}
|
||||
if (opt_host != NULL) {
|
||||
setenv("option_mysql_host", opt_host, 1);
|
||||
}
|
||||
if (opt_socket != NULL) {
|
||||
setenv("option_mysql_socket", opt_socket, 1);
|
||||
}
|
||||
if (opt_port != 0) {
|
||||
char port[20];
|
||||
snprintf(port, sizeof(port), "%u", opt_port);
|
||||
setenv("option_mysql_port", port, 1);
|
||||
}
|
||||
os_file_dir_t dir = os_file_opendir(dir_path, TRUE);
|
||||
os_file_stat_t info;
|
||||
bool ret = true;
|
||||
while (os_file_readdir_next_file(dir_path, dir, &info) == 0) {
|
||||
|
||||
FILE *pipe = popen("perl", "w");
|
||||
if (pipe == NULL) {
|
||||
return;
|
||||
if (info.type != OS_FILE_TYPE_FILE)
|
||||
continue;
|
||||
|
||||
const char *pname = strrchr(info.name, IF_WIN('\\', '/'));
|
||||
if (!pname)
|
||||
pname = info.name;
|
||||
|
||||
/* Copy aria log files, and aws keys for encryption plugins.*/
|
||||
const char *prefixes[] = { "aria_log", "aws-kms-key" };
|
||||
for (size_t i = 0; i < array_elements(prefixes); i++) {
|
||||
if (starts_with(pname, prefixes[i])) {
|
||||
ret = copy_file(ds_data, info.name, info.name, 1);
|
||||
if (!ret) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fputs((const char *)version_check_pl, pipe);
|
||||
|
||||
pclose(pipe);
|
||||
os_file_closedir(dir);
|
||||
return ret;
|
||||
}
|
||||
|
@ -41,8 +41,6 @@ bool
|
||||
copy_back();
|
||||
bool
|
||||
decrypt_decompress();
|
||||
void
|
||||
version_check();
|
||||
bool
|
||||
is_path_separator(char);
|
||||
bool
|
||||
|
@ -38,6 +38,7 @@ this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*******************************************************/
|
||||
#define MYSQL_CLIENT
|
||||
|
||||
#include <my_global.h>
|
||||
#include <mysql.h>
|
||||
@ -47,10 +48,12 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <limits>
|
||||
#include "common.h"
|
||||
#include "xtrabackup.h"
|
||||
#include "xtrabackup_version.h"
|
||||
#include "mysql_version.h"
|
||||
#include "backup_copy.h"
|
||||
#include "backup_mysql.h"
|
||||
#include "mysqld.h"
|
||||
#include "encryption_plugin.h"
|
||||
#include <sstream>
|
||||
|
||||
|
||||
char *tool_name;
|
||||
@ -88,15 +91,7 @@ time_t history_lock_time;
|
||||
|
||||
MYSQL *mysql_connection;
|
||||
|
||||
extern "C" {
|
||||
MYSQL * STDCALL
|
||||
cli_mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
|
||||
const char *passwd, const char *db,
|
||||
uint port, const char *unix_socket,ulong client_flag);
|
||||
}
|
||||
|
||||
#define mysql_real_connect cli_mysql_real_connect
|
||||
|
||||
my_bool opt_ssl_verify_server_cert;
|
||||
|
||||
MYSQL *
|
||||
xb_mysql_connect()
|
||||
@ -136,11 +131,6 @@ xb_mysql_connect()
|
||||
}
|
||||
mysql_options(connection,MYSQL_OPT_SSL_VERIFY_SERVER_CERT,
|
||||
(char*)&opt_ssl_verify_server_cert);
|
||||
#if !defined(HAVE_YASSL)
|
||||
if (opt_server_public_key && *opt_server_public_key)
|
||||
mysql_options(connection, MYSQL_SERVER_PUBLIC_KEY,
|
||||
opt_server_public_key);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (!mysql_real_connect(connection,
|
||||
@ -310,7 +300,7 @@ check_server_version(unsigned long version_number,
|
||||
version_supported = version_supported
|
||||
|| (version_number > 50500 && version_number < 50700);
|
||||
version_supported = version_supported
|
||||
|| ((version_number > 100000 && version_number < 100300)
|
||||
|| ((version_number > 100000)
|
||||
&& server_flavor == FLAVOR_MARIADB);
|
||||
|
||||
if (mysql51 && innodb_version == NULL) {
|
||||
@ -596,7 +586,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
||||
if (opt_incremental_history_name) {
|
||||
mysql_real_escape_string(mysql_connection, buf,
|
||||
opt_incremental_history_name,
|
||||
strlen(opt_incremental_history_name));
|
||||
(unsigned long)strlen(opt_incremental_history_name));
|
||||
ut_snprintf(query, sizeof(query),
|
||||
"SELECT innodb_to_lsn "
|
||||
"FROM PERCONA_SCHEMA.xtrabackup_history "
|
||||
@ -609,7 +599,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn)
|
||||
if (opt_incremental_history_uuid) {
|
||||
mysql_real_escape_string(mysql_connection, buf,
|
||||
opt_incremental_history_uuid,
|
||||
strlen(opt_incremental_history_uuid));
|
||||
(unsigned long)strlen(opt_incremental_history_uuid));
|
||||
ut_snprintf(query, sizeof(query),
|
||||
"SELECT innodb_to_lsn "
|
||||
"FROM PERCONA_SCHEMA.xtrabackup_history "
|
||||
@ -756,7 +746,7 @@ have_queries_to_wait_for(MYSQL *connection, uint threshold)
|
||||
|
||||
static
|
||||
void
|
||||
kill_long_queries(MYSQL *connection, uint timeout)
|
||||
kill_long_queries(MYSQL *connection, time_t timeout)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
@ -768,15 +758,15 @@ kill_long_queries(MYSQL *connection, uint timeout)
|
||||
all_queries = (opt_kill_long_query_type == QUERY_TYPE_ALL);
|
||||
while ((row = mysql_fetch_row(result)) != NULL) {
|
||||
const char *info = row[7];
|
||||
int duration = atoi(row[5]);
|
||||
long long duration = atoll(row[5]);
|
||||
char *id = row[0];
|
||||
|
||||
if (info != NULL &&
|
||||
duration >= (int)timeout &&
|
||||
(time_t)duration >= timeout &&
|
||||
((all_queries && is_query(info)) ||
|
||||
is_select_query(info))) {
|
||||
msg_ts("Killing query %s (duration %d sec): %s\n",
|
||||
id, duration, info);
|
||||
id, (int)duration, info);
|
||||
ut_snprintf(kill_stmt, sizeof(kill_stmt),
|
||||
"KILL %s", id);
|
||||
xb_mysql_query(connection, kill_stmt, false, false);
|
||||
@ -1378,7 +1368,18 @@ cleanup:
|
||||
return(result);
|
||||
}
|
||||
|
||||
|
||||
static string escape_and_quote(MYSQL *mysql,const char *str)
|
||||
{
|
||||
if (!str)
|
||||
return "NULL";
|
||||
size_t len = strlen(str);
|
||||
char* escaped = (char *)alloca(2 * len + 3);
|
||||
escaped[0] = '\'';
|
||||
size_t new_len = mysql_real_escape_string(mysql, escaped+1, str, len);
|
||||
escaped[new_len + 1] = '\'';
|
||||
escaped[new_len + 2] = 0;
|
||||
return string(escaped);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
Writes xtrabackup_info file and if backup_history is enable creates
|
||||
@ -1388,25 +1389,16 @@ backup. */
|
||||
bool
|
||||
write_xtrabackup_info(MYSQL *connection)
|
||||
{
|
||||
MYSQL_STMT *stmt;
|
||||
MYSQL_BIND bind[19];
|
||||
|
||||
char *uuid = NULL;
|
||||
char *server_version = NULL;
|
||||
char buf_start_time[100];
|
||||
char buf_end_time[100];
|
||||
int idx;
|
||||
tm tm;
|
||||
my_bool null = TRUE;
|
||||
|
||||
ostringstream oss;
|
||||
const char *xb_stream_name[] = {"file", "tar", "xbstream"};
|
||||
const char *ins_query = "insert into PERCONA_SCHEMA.xtrabackup_history("
|
||||
"uuid, name, tool_name, tool_command, tool_version, "
|
||||
"ibbackup_version, server_version, start_time, end_time, "
|
||||
"lock_time, binlog_pos, innodb_from_lsn, innodb_to_lsn, "
|
||||
"partial, incremental, format, compact, compressed, "
|
||||
"encrypted) "
|
||||
"values(?,?,?,?,?,?,?,from_unixtime(?),from_unixtime(?),"
|
||||
"?,?,?,?,?,?,?,?,?,?)";
|
||||
|
||||
|
||||
ut_ad(xtrabackup_stream_fmt < 3);
|
||||
|
||||
@ -1419,6 +1411,11 @@ write_xtrabackup_info(MYSQL *connection)
|
||||
localtime_r(&history_end_time, &tm);
|
||||
strftime(buf_end_time, sizeof(buf_end_time),
|
||||
"%Y-%m-%d %H:%M:%S", &tm);
|
||||
bool is_partial = (xtrabackup_tables
|
||||
|| xtrabackup_tables_file
|
||||
|| xtrabackup_databases
|
||||
|| xtrabackup_databases_file);
|
||||
|
||||
backup_file_printf(XTRABACKUP_INFO,
|
||||
"uuid = %s\n"
|
||||
"name = %s\n"
|
||||
@ -1443,23 +1440,20 @@ write_xtrabackup_info(MYSQL *connection)
|
||||
opt_history ? opt_history : "", /* name */
|
||||
tool_name, /* tool_name */
|
||||
tool_args, /* tool_command */
|
||||
XTRABACKUP_VERSION, /* tool_version */
|
||||
XTRABACKUP_VERSION, /* ibbackup_version */
|
||||
MYSQL_SERVER_VERSION, /* tool_version */
|
||||
MYSQL_SERVER_VERSION, /* ibbackup_version */
|
||||
server_version, /* server_version */
|
||||
buf_start_time, /* start_time */
|
||||
buf_end_time, /* end_time */
|
||||
history_lock_time, /* lock_time */
|
||||
(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 */
|
||||
(xtrabackup_tables /* partial */
|
||||
|| xtrabackup_tables_file
|
||||
|| xtrabackup_databases
|
||||
|| xtrabackup_databases_file) ? "Y" : "N",
|
||||
is_partial? "Y" : "N",
|
||||
xtrabackup_incremental ? "Y" : "N", /* incremental */
|
||||
xb_stream_name[xtrabackup_stream_fmt], /* format */
|
||||
xtrabackup_compact ? "Y" : "N", /* compact */
|
||||
"N", /* compact */
|
||||
xtrabackup_compress ? "compressed" : "N", /* compressed */
|
||||
xtrabackup_encrypt ? "Y" : "N"); /* encrypted */
|
||||
|
||||
@ -1492,142 +1486,36 @@ write_xtrabackup_info(MYSQL *connection)
|
||||
"encrypted ENUM('Y', 'N') DEFAULT NULL"
|
||||
") CHARACTER SET utf8 ENGINE=innodb", false);
|
||||
|
||||
stmt = mysql_stmt_init(connection);
|
||||
|
||||
mysql_stmt_prepare(stmt, ins_query, strlen(ins_query));
|
||||
#define ESCAPE_BOOL(expr) ((expr)?"'Y'":"'N'")
|
||||
|
||||
memset(bind, 0, sizeof(bind));
|
||||
idx = 0;
|
||||
oss << "insert into PERCONA_SCHEMA.xtrabackup_history("
|
||||
<< "uuid, name, tool_name, tool_command, tool_version,"
|
||||
<< "ibbackup_version, server_version, start_time, end_time,"
|
||||
<< "lock_time, binlog_pos, innodb_from_lsn, innodb_to_lsn,"
|
||||
<< "partial, incremental, format, compact, compressed, "
|
||||
<< "encrypted) values("
|
||||
<< escape_and_quote(connection, uuid) << ","
|
||||
<< escape_and_quote(connection, opt_history) << ","
|
||||
<< escape_and_quote(connection, tool_name) << ","
|
||||
<< escape_and_quote(connection, tool_args) << ","
|
||||
<< escape_and_quote(connection, MYSQL_SERVER_VERSION) << ","
|
||||
<< escape_and_quote(connection, MYSQL_SERVER_VERSION) << ","
|
||||
<< escape_and_quote(connection, server_version) << ","
|
||||
<< "from_unixtime(" << history_start_time << "),"
|
||||
<< "from_unixtime(" << history_end_time << "),"
|
||||
<< history_lock_time << ","
|
||||
<< escape_and_quote(connection, mysql_binlog_position) << ","
|
||||
<< incremental_lsn << ","
|
||||
<< metadata_to_lsn << ","
|
||||
<< ESCAPE_BOOL(is_partial) << ","
|
||||
<< ESCAPE_BOOL(xtrabackup_incremental)<< ","
|
||||
<< escape_and_quote(connection,xb_stream_name[xtrabackup_stream_fmt]) <<","
|
||||
<< ESCAPE_BOOL(false) << ","
|
||||
<< ESCAPE_BOOL(xtrabackup_compress) << ","
|
||||
<< ESCAPE_BOOL(xtrabackup_encrypt) <<")";
|
||||
|
||||
/* uuid */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = uuid;
|
||||
bind[idx].buffer_length = strlen(uuid);
|
||||
++idx;
|
||||
|
||||
/* name */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(opt_history);
|
||||
bind[idx].buffer_length = strlen(opt_history);
|
||||
if (!(opt_history && *opt_history)) {
|
||||
bind[idx].is_null = &null;
|
||||
}
|
||||
++idx;
|
||||
|
||||
/* tool_name */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = tool_name;
|
||||
bind[idx].buffer_length = strlen(tool_name);
|
||||
++idx;
|
||||
|
||||
/* tool_command */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = tool_args;
|
||||
bind[idx].buffer_length = strlen(tool_args);
|
||||
++idx;
|
||||
|
||||
/* tool_version */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(XTRABACKUP_VERSION);
|
||||
bind[idx].buffer_length = strlen(XTRABACKUP_VERSION);
|
||||
++idx;
|
||||
|
||||
/* ibbackup_version */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(XTRABACKUP_VERSION);
|
||||
bind[idx].buffer_length = strlen(XTRABACKUP_VERSION);
|
||||
++idx;
|
||||
|
||||
/* server_version */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = server_version;
|
||||
bind[idx].buffer_length = strlen(server_version);
|
||||
++idx;
|
||||
|
||||
/* start_time */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_LONG;
|
||||
bind[idx].buffer = &history_start_time;
|
||||
++idx;
|
||||
|
||||
/* end_time */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_LONG;
|
||||
bind[idx].buffer = &history_end_time;
|
||||
++idx;
|
||||
|
||||
/* lock_time */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_LONG;
|
||||
bind[idx].buffer = &history_lock_time;
|
||||
++idx;
|
||||
|
||||
/* binlog_pos */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = mysql_binlog_position;
|
||||
if (mysql_binlog_position != NULL) {
|
||||
bind[idx].buffer_length = strlen(mysql_binlog_position);
|
||||
} else {
|
||||
bind[idx].is_null = &null;
|
||||
}
|
||||
++idx;
|
||||
|
||||
/* innodb_from_lsn */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_LONGLONG;
|
||||
bind[idx].buffer = (char*)(&incremental_lsn);
|
||||
++idx;
|
||||
|
||||
/* innodb_to_lsn */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_LONGLONG;
|
||||
bind[idx].buffer = (char*)(&metadata_to_lsn);
|
||||
++idx;
|
||||
|
||||
/* partial (Y | N) */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)((xtrabackup_tables
|
||||
|| xtrabackup_tables_file
|
||||
|| xtrabackup_databases
|
||||
|| xtrabackup_databases_file) ? "Y" : "N");
|
||||
bind[idx].buffer_length = 1;
|
||||
++idx;
|
||||
|
||||
/* incremental (Y | N) */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(
|
||||
(xtrabackup_incremental
|
||||
|| xtrabackup_incremental_basedir
|
||||
|| opt_incremental_history_name
|
||||
|| opt_incremental_history_uuid) ? "Y" : "N");
|
||||
bind[idx].buffer_length = 1;
|
||||
++idx;
|
||||
|
||||
/* format (file | tar | xbstream) */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(xb_stream_name[xtrabackup_stream_fmt]);
|
||||
bind[idx].buffer_length = strlen(xb_stream_name[xtrabackup_stream_fmt]);
|
||||
++idx;
|
||||
|
||||
/* compact (Y | N) */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(xtrabackup_compact ? "Y" : "N");
|
||||
bind[idx].buffer_length = 1;
|
||||
++idx;
|
||||
|
||||
/* compressed (Y | N) */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(xtrabackup_compress ? "Y" : "N");
|
||||
bind[idx].buffer_length = 1;
|
||||
++idx;
|
||||
|
||||
/* encrypted (Y | N) */
|
||||
bind[idx].buffer_type = MYSQL_TYPE_STRING;
|
||||
bind[idx].buffer = (char*)(xtrabackup_encrypt ? "Y" : "N");
|
||||
bind[idx].buffer_length = 1;
|
||||
++idx;
|
||||
|
||||
ut_ad(idx == 19);
|
||||
|
||||
mysql_stmt_bind_param(stmt, bind);
|
||||
|
||||
mysql_stmt_execute(stmt);
|
||||
mysql_stmt_close(stmt);
|
||||
xb_mysql_query(mysql_connection, oss.str().c_str(), false);
|
||||
|
||||
cleanup:
|
||||
|
||||
@ -1637,10 +1525,11 @@ cleanup:
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool
|
||||
write_backup_config_file()
|
||||
extern const char *innodb_checksum_algorithm_names[];
|
||||
|
||||
bool write_backup_config_file()
|
||||
{
|
||||
return backup_file_printf("backup-my.cnf",
|
||||
int rc= backup_file_printf("backup-my.cnf",
|
||||
"# This MySQL options file was generated by innobackupex.\n\n"
|
||||
"# The MySQL server\n"
|
||||
"[mysqld]\n"
|
||||
@ -1649,19 +1538,18 @@ write_backup_config_file()
|
||||
"innodb_data_file_path=%s\n"
|
||||
"innodb_log_files_in_group=%lu\n"
|
||||
"innodb_log_file_size=%lld\n"
|
||||
"innodb_fast_checksum=%s\n"
|
||||
"innodb_page_size=%lu\n"
|
||||
"innodb_log_block_size=%lu\n"
|
||||
"innodb_undo_directory=%s\n"
|
||||
"innodb_undo_tablespaces=%lu\n"
|
||||
"%s%s\n"
|
||||
"%s%s\n",
|
||||
"%s%s\n"
|
||||
"%s\n",
|
||||
innodb_checksum_algorithm_names[srv_checksum_algorithm],
|
||||
innodb_checksum_algorithm_names[srv_log_checksum_algorithm],
|
||||
innobase_data_file_path,
|
||||
srv_n_log_files,
|
||||
innobase_log_file_size,
|
||||
srv_fast_checksum ? "true" : "false",
|
||||
srv_page_size,
|
||||
srv_log_block_size,
|
||||
srv_undo_dir,
|
||||
@ -1671,7 +1559,9 @@ write_backup_config_file()
|
||||
innobase_buffer_pool_filename ?
|
||||
"innodb_buffer_pool_filename=" : "",
|
||||
innobase_buffer_pool_filename ?
|
||||
innobase_buffer_pool_filename : "");
|
||||
innobase_buffer_pool_filename : "",
|
||||
encryption_plugin_get_config());
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
|
@ -447,7 +447,7 @@ log_online_open_bitmap_file_read_only(
|
||||
= os_file_create_simple_no_error_handling(0, bitmap_file->name,
|
||||
OS_FILE_OPEN,
|
||||
OS_FILE_READ_ONLY,
|
||||
&success);
|
||||
&success,0);
|
||||
if (UNIV_UNLIKELY(!success)) {
|
||||
|
||||
/* Here and below assume that bitmap file names do not
|
||||
|
@ -26,6 +26,46 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#include <fcntl.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
# define fil_is_user_tablespace_id(i) ((i) > srv_undo_tablespaces_open)
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define stat _stati64
|
||||
#define PATH_MAX MAX_PATH
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VASPRINTF
|
||||
static inline int vasprintf(char **strp, const char *fmt, va_list args)
|
||||
{
|
||||
int len;
|
||||
#ifdef _MSC_VER
|
||||
len = _vscprintf(fmt, args);
|
||||
#else
|
||||
len = vsnprintf(NULL, 0, fmt, args);
|
||||
#endif
|
||||
if (len < 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
*strp = (char *)malloc(len + 1);
|
||||
if (!*strp)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
vsprintf(*strp, fmt, args);
|
||||
return len;
|
||||
}
|
||||
|
||||
static inline int asprintf(char **strp, const char *fmt,...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
int len = vasprintf(strp, fmt, args);
|
||||
va_end(args);
|
||||
return len;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define xb_a(expr) \
|
||||
do { \
|
||||
if (!(expr)) { \
|
||||
@ -93,15 +133,15 @@ static inline int msg_ts(const char *fmt, ...)
|
||||
/***********************************************************************
|
||||
Computes bit shift for a given value. If the argument is not a power
|
||||
of 2, returns 0.*/
|
||||
static inline ulong
|
||||
get_bit_shift(ulong value)
|
||||
static inline size_t
|
||||
get_bit_shift(size_t value)
|
||||
{
|
||||
ulong shift;
|
||||
size_t shift;
|
||||
|
||||
if (value == 0)
|
||||
return 0;
|
||||
|
||||
for (shift = 0; !(value & 1UL); shift++) {
|
||||
for (shift = 0; !(value & 1); shift++) {
|
||||
value >>= 1;
|
||||
}
|
||||
return (value >> 1) ? 0 : shift;
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,44 +0,0 @@
|
||||
/******************************************************
|
||||
XtraBackup: hot backup tool for InnoDB
|
||||
(c) 2009-2013 Percona LLC and/or its affiliates.
|
||||
Originally Created 3/3/2009 Yasufumi Kinoshita
|
||||
Written by Alexey Kopytov, Aleksandr Kuzminsky, Stewart Smith, Vadim Tkachenko,
|
||||
Yasufumi Kinoshita, Ignacio Nin and Baron Schwartz.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*******************************************************/
|
||||
|
||||
#ifndef XB_COMPACT_H
|
||||
#define XB_COMPACT_H
|
||||
|
||||
#include "write_filt.h"
|
||||
|
||||
/* Compact page filter context */
|
||||
typedef struct {
|
||||
my_bool skip;
|
||||
ds_ctxt_t *ds_buffer;
|
||||
ds_file_t *buffer;
|
||||
index_id_t clustered_index;
|
||||
my_bool clustered_index_found;
|
||||
my_bool inside_skipped_range;
|
||||
ulint free_limit;
|
||||
} xb_wf_compact_ctxt_t;
|
||||
|
||||
/******************************************************************************
|
||||
Expand the data files according to the skipped pages maps created by --compact.
|
||||
@return TRUE on success, FALSE on failure. */
|
||||
my_bool xb_expand_datafiles(void);
|
||||
|
||||
#endif
|
@ -46,7 +46,12 @@ ds_create(const char *root, ds_type_t type)
|
||||
ds = &datasink_local;
|
||||
break;
|
||||
case DS_TYPE_ARCHIVE:
|
||||
#ifdef HAVE_LIBARCHIVE
|
||||
ds = &datasink_archive;
|
||||
#else
|
||||
msg("Error : mariabackup was built without libarchive support");
|
||||
exit(EXIT_FAILURE);
|
||||
#endif
|
||||
break;
|
||||
case DS_TYPE_XBSTREAM:
|
||||
ds = &datasink_xbstream;
|
||||
@ -55,8 +60,10 @@ ds_create(const char *root, ds_type_t type)
|
||||
ds = &datasink_compress;
|
||||
break;
|
||||
case DS_TYPE_ENCRYPT:
|
||||
ds = &datasink_encrypt;
|
||||
msg("Error : mariabackup does not support encrypted backups.");
|
||||
exit(EXIT_FAILURE);
|
||||
break;
|
||||
|
||||
case DS_TYPE_TMPFILE:
|
||||
ds = &datasink_tmpfile;
|
||||
break;
|
||||
|
@ -28,6 +28,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern char *xtrabackup_tmpdir;
|
||||
struct datasink_struct;
|
||||
typedef struct datasink_struct datasink_t;
|
||||
|
||||
|
@ -152,7 +152,7 @@ compress_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat)
|
||||
/* Write the qpress file header */
|
||||
name_len = strlen(new_name);
|
||||
if (ds_write(dest_file, "F", 1) ||
|
||||
write_uint32_le(dest_file, name_len) ||
|
||||
write_uint32_le(dest_file, (uint)name_len) ||
|
||||
/* we want to write the terminating \0 as well */
|
||||
ds_write(dest_file, new_name, name_len + 1)) {
|
||||
goto err;
|
||||
@ -453,7 +453,7 @@ compress_worker_thread_func(void *arg)
|
||||
with qpress implementation. */
|
||||
|
||||
thd->adler = adler32(0x00000001, (uchar *) thd->to,
|
||||
thd->to_len);
|
||||
(uInt)thd->to_len);
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&thd->data_mutex);
|
||||
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#include <my_base.h>
|
||||
#include "common.h"
|
||||
#include "datasink.h"
|
||||
|
||||
#ifdef HAVE_GRYPT
|
||||
#if GCC_VERSION >= 4002
|
||||
/* Workaround to avoid "gcry_ac_* is deprecated" warnings in gcrypt.h */
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
@ -615,3 +615,4 @@ encrypt_worker_thread_func(void *arg)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_GCRYPT*/
|
||||
|
@ -22,7 +22,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#define DS_ENCRYPT_H
|
||||
|
||||
#include "datasink.h"
|
||||
|
||||
#ifdef HAVE_GCRYPT
|
||||
extern datasink_t datasink_encrypt;
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -53,9 +53,9 @@ local_init(const char *root)
|
||||
&& my_errno != EEXIST && my_errno != EISDIR)
|
||||
{
|
||||
char errbuf[MYSYS_STRERROR_SIZE];
|
||||
my_strerror(errbuf, sizeof(errbuf),my_errno);
|
||||
my_error(EE_CANT_MKDIR, MYF(ME_BELL | ME_WAITTANG),
|
||||
root, my_errno, my_strerror(errbuf, sizeof(errbuf),
|
||||
my_errno));
|
||||
root, my_errno,errbuf, my_errno);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -85,9 +85,9 @@ local_open(ds_ctxt_t *ctxt, const char *path,
|
||||
dirname_part(dirpath, fullpath, &dirpath_len);
|
||||
if (my_mkdir(dirpath, 0777, MYF(0)) < 0 && my_errno != EEXIST) {
|
||||
char errbuf[MYSYS_STRERROR_SIZE];
|
||||
my_strerror(errbuf, sizeof(errbuf), my_errno);
|
||||
my_error(EE_CANT_MKDIR, MYF(ME_BELL | ME_WAITTANG),
|
||||
dirpath, my_errno, my_strerror(errbuf, sizeof(errbuf),
|
||||
my_errno));
|
||||
dirpath, my_errno, errbuf);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@ stdout_open(ds_ctxt_t *ctxt __attribute__((unused)),
|
||||
setmode(fileno(stdout), _O_BINARY);
|
||||
#endif
|
||||
|
||||
stdout_file->fd = fileno(stdout);
|
||||
stdout_file->fd = my_fileno(stdout);
|
||||
|
||||
file->path = (char *) stdout_file + sizeof(ds_stdout_file_t);
|
||||
memcpy(file->path, fullpath, pathlen);
|
||||
|
@ -53,7 +53,6 @@ datasink_t datasink_tmpfile = {
|
||||
&tmpfile_deinit
|
||||
};
|
||||
|
||||
MY_TMPDIR mysql_tmpdir_list;
|
||||
|
||||
static ds_ctxt_t *
|
||||
tmpfile_init(const char *root)
|
||||
@ -90,7 +89,7 @@ tmpfile_open(ds_ctxt_t *ctxt, const char *path,
|
||||
|
||||
/* Create a temporary file in tmpdir. The file will be automatically
|
||||
removed on close. Code copied from mysql_tmpfile(). */
|
||||
fd = create_temp_file(tmp_path, my_tmpdir(&mysql_tmpdir_list),
|
||||
fd = create_temp_file(tmp_path,xtrabackup_tmpdir,
|
||||
"xbtemp",
|
||||
#ifdef __WIN__
|
||||
O_BINARY | O_TRUNC | O_SEQUENTIAL |
|
||||
|
157
extra/mariabackup/encryption_plugin.cc
Normal file
157
extra/mariabackup/encryption_plugin.cc
Normal file
@ -0,0 +1,157 @@
|
||||
#include <mysqld.h>
|
||||
#include <mysql.h>
|
||||
#include <xtrabackup.h>
|
||||
#include <encryption_plugin.h>
|
||||
#include <backup_copy.h>
|
||||
#include <sql_plugin.h>
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include <common.h>
|
||||
#include <backup_mysql.h>
|
||||
|
||||
|
||||
extern struct st_maria_plugin *mysql_optional_plugins[];
|
||||
extern struct st_maria_plugin *mysql_mandatory_plugins[];
|
||||
static void encryption_plugin_init(int argc, char **argv);
|
||||
|
||||
extern char *xb_plugin_load;
|
||||
extern char *xb_plugin_dir;
|
||||
|
||||
const int PLUGIN_MAX_ARGS = 1024;
|
||||
vector<string> backup_plugins_args;
|
||||
|
||||
const char *QUERY_PLUGIN =
|
||||
"SELECT plugin_name, plugin_library, @@plugin_dir"
|
||||
" FROM information_schema.plugins WHERE plugin_type='ENCRYPTION'"
|
||||
" AND plugin_status='ACTIVE'";
|
||||
|
||||
string encryption_plugin_config;
|
||||
|
||||
static void add_to_plugin_load_list(const char *plugin_def)
|
||||
{
|
||||
opt_plugin_load_list_ptr->push_back(new i_string(plugin_def));
|
||||
}
|
||||
|
||||
static char XTRABACKUP_EXE[] = "xtrabackup";
|
||||
|
||||
void encryption_plugin_backup_init(MYSQL *mysql)
|
||||
{
|
||||
MYSQL_RES *result;
|
||||
MYSQL_ROW row;
|
||||
ostringstream oss;
|
||||
char *argv[PLUGIN_MAX_ARGS];
|
||||
int argc;
|
||||
|
||||
result = xb_mysql_query(mysql, QUERY_PLUGIN, true, true);
|
||||
row = mysql_fetch_row(result);
|
||||
if (!row)
|
||||
{
|
||||
mysql_free_result(result);
|
||||
return;
|
||||
}
|
||||
|
||||
char *name= row[0];
|
||||
char *library= row[1];
|
||||
char *dir= row[2];
|
||||
|
||||
#ifdef _WIN32
|
||||
for (char *p = dir; *p; p++)
|
||||
if (*p == '\\') *p = '/';
|
||||
#endif
|
||||
|
||||
string plugin_load(name);
|
||||
if (library)
|
||||
plugin_load += string("=") + library;
|
||||
|
||||
oss << "plugin_load=" << plugin_load << endl;
|
||||
|
||||
/* Required to load the plugin later.*/
|
||||
add_to_plugin_load_list(plugin_load.c_str());
|
||||
strncpy(opt_plugin_dir, dir, FN_REFLEN);
|
||||
|
||||
oss << "plugin_dir=" << '"' << dir << '"' << endl;
|
||||
|
||||
|
||||
/* Read plugin variables. */
|
||||
char query[1024];
|
||||
snprintf(query, 1024, "SHOW variables like '%s_%%'", name);
|
||||
mysql_free_result(result);
|
||||
|
||||
result = xb_mysql_query(mysql, query, true, true);
|
||||
while ((row = mysql_fetch_row(result)))
|
||||
{
|
||||
string arg("--");
|
||||
arg += row[0];
|
||||
arg += "=";
|
||||
arg += row[1];
|
||||
backup_plugins_args.push_back(arg);
|
||||
oss << row[0] << "=" << row[1] << endl;
|
||||
}
|
||||
|
||||
mysql_free_result(result);
|
||||
|
||||
/* Check whether to encrypt logs. */
|
||||
result = xb_mysql_query(mysql, "select @@innodb_encrypt_log", true, true);
|
||||
row = mysql_fetch_row(result);
|
||||
srv_encrypt_log = (row != 0 && row[0][0] == '1');
|
||||
oss << "innodb_encrypt_log=" << row[0] << endl;
|
||||
|
||||
mysql_free_result(result);
|
||||
|
||||
encryption_plugin_config = oss.str();
|
||||
|
||||
argc = 0;
|
||||
argv[argc++] = XTRABACKUP_EXE;
|
||||
for(size_t i = 0; i < backup_plugins_args.size(); i++)
|
||||
{
|
||||
argv[argc++] = (char *)backup_plugins_args[i].c_str();
|
||||
if (argc == PLUGIN_MAX_ARGS - 2)
|
||||
break;
|
||||
}
|
||||
argv[argc] = 0;
|
||||
|
||||
encryption_plugin_init(argc, argv);
|
||||
}
|
||||
|
||||
const char *encryption_plugin_get_config()
|
||||
{
|
||||
return encryption_plugin_config.c_str();
|
||||
}
|
||||
|
||||
extern int finalize_encryption_plugin(st_plugin_int *plugin);
|
||||
|
||||
|
||||
void encryption_plugin_prepare_init(int argc, char **argv)
|
||||
{
|
||||
|
||||
if (!xb_plugin_load)
|
||||
{
|
||||
/* This prevents crashes e.g in --stats with wrong my.cnf*/
|
||||
finalize_encryption_plugin(0);
|
||||
return;
|
||||
}
|
||||
|
||||
add_to_plugin_load_list(xb_plugin_load);
|
||||
|
||||
if (xb_plugin_dir)
|
||||
strncpy(opt_plugin_dir, xb_plugin_dir, FN_REFLEN);
|
||||
|
||||
char **new_argv = new char *[argc + 1];
|
||||
new_argv[0] = XTRABACKUP_EXE;
|
||||
memcpy(&new_argv[1], argv, argc*sizeof(char *));
|
||||
|
||||
encryption_plugin_init(argc+1, new_argv);
|
||||
|
||||
delete[] new_argv;
|
||||
}
|
||||
|
||||
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");
|
||||
for (int i= 1; i < argc; i++)
|
||||
msg("\t Encryption plugin parameter : '%s'\n", argv[i]);
|
||||
plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE);
|
||||
}
|
||||
|
7
extra/mariabackup/encryption_plugin.h
Normal file
7
extra/mariabackup/encryption_plugin.h
Normal file
@ -0,0 +1,7 @@
|
||||
#include <mysql.h>
|
||||
#include <string>
|
||||
extern void encryption_plugin_backup_init(MYSQL *mysql);
|
||||
extern const char* encryption_plugin_get_config();
|
||||
extern void encryption_plugin_prepare_init(int argc, char **argv);
|
||||
|
||||
//extern void encryption_plugin_init(int argc, char **argv);
|
@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#include "common.h"
|
||||
#include "read_filt.h"
|
||||
#include "xtrabackup.h"
|
||||
#include "xb0xb.h"
|
||||
|
||||
/* Size of read buffer in pages (640 pages = 10M for 16K sized pages) */
|
||||
#define XB_FIL_CUR_PAGES 640
|
||||
@ -167,7 +168,7 @@ xb_fil_cur_open(
|
||||
os_file_create_simple_no_error_handling(0, node->name,
|
||||
OS_FILE_OPEN,
|
||||
OS_FILE_READ_ONLY,
|
||||
&success);
|
||||
&success,0);
|
||||
if (!success) {
|
||||
/* The following call prints an error message */
|
||||
os_file_get_last_error(TRUE);
|
||||
@ -200,7 +201,7 @@ xb_fil_cur_open(
|
||||
cursor->node = node;
|
||||
cursor->file = node->handle;
|
||||
|
||||
if (my_fstat(cursor->file, &cursor->statinfo, MYF(MY_WME))) {
|
||||
if (stat(cursor->abs_path, &cursor->statinfo)) {
|
||||
msg("[%02u] xtrabackup: error: cannot stat %s\n",
|
||||
thread_n, cursor->abs_path);
|
||||
|
||||
@ -253,7 +254,7 @@ xb_fil_cur_open(
|
||||
cursor->buf_page_no = 0;
|
||||
cursor->thread_n = thread_n;
|
||||
|
||||
cursor->space_size = cursor->statinfo.st_size / page_size;
|
||||
cursor->space_size = (ulint)(cursor->statinfo.st_size / page_size);
|
||||
|
||||
cursor->read_filter = read_filter;
|
||||
cursor->read_filter->init(&cursor->read_filter_ctxt, cursor,
|
||||
@ -327,26 +328,32 @@ read_retry:
|
||||
cursor->buf_read = 0;
|
||||
cursor->buf_npages = 0;
|
||||
cursor->buf_offset = offset;
|
||||
cursor->buf_page_no = (ulint) (offset >> cursor->page_size_shift);
|
||||
cursor->buf_page_no = (ulint)(offset >> cursor->page_size_shift);
|
||||
|
||||
success = os_file_read(cursor->file, cursor->buf, offset,
|
||||
to_read);
|
||||
(ulint)to_read);
|
||||
if (!success) {
|
||||
return(XB_FIL_CUR_ERROR);
|
||||
}
|
||||
|
||||
fil_system_enter();
|
||||
fil_space_t *space = fil_space_get_by_id(cursor->space_id);
|
||||
fil_system_exit();
|
||||
|
||||
/* check pages for corruption and re-read if necessary. i.e. in case of
|
||||
partially written pages */
|
||||
for (page = cursor->buf, i = 0; i < npages;
|
||||
page += cursor->page_size, i++) {
|
||||
ib_int64_t page_no = cursor->buf_page_no + i;
|
||||
|
||||
if (buf_page_is_corrupted(TRUE, page, cursor->zip_size)) {
|
||||
bool checksum_ok = fil_space_verify_crypt_checksum(page, cursor->zip_size,space, (ulint)page_no);
|
||||
|
||||
ulint page_no = cursor->buf_page_no + i;
|
||||
if (!checksum_ok &&
|
||||
buf_page_is_corrupted(true, page, cursor->zip_size,space)) {
|
||||
|
||||
if (cursor->is_system &&
|
||||
page_no >= FSP_EXTENT_SIZE &&
|
||||
page_no < FSP_EXTENT_SIZE * 3) {
|
||||
page_no >= (ib_int64_t)FSP_EXTENT_SIZE &&
|
||||
page_no < (ib_int64_t) FSP_EXTENT_SIZE * 3) {
|
||||
/* skip doublewrite buffer pages */
|
||||
xb_a(cursor->page_size == UNIV_PAGE_SIZE);
|
||||
msg("[%02u] xtrabackup: "
|
||||
|
@ -49,10 +49,10 @@ struct xb_fil_cur_t {
|
||||
/*!< read filter context */
|
||||
byte* orig_buf; /*!< read buffer */
|
||||
byte* buf; /*!< aligned pointer for orig_buf */
|
||||
ulint buf_size; /*!< buffer size in bytes */
|
||||
ulint buf_read; /*!< number of read bytes in buffer
|
||||
size_t buf_size; /*!< buffer size in bytes */
|
||||
size_t buf_read; /*!< number of read bytes in buffer
|
||||
after the last cursor read */
|
||||
ulint buf_npages; /*!< number of pages in buffer after the
|
||||
size_t buf_npages; /*!< number of pages in buffer after the
|
||||
last cursor read */
|
||||
ib_int64_t buf_offset; /*!< file offset of the first page in
|
||||
buffer */
|
||||
|
@ -52,14 +52,12 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#include <mysqld.h>
|
||||
#include <my_default.h>
|
||||
#include <my_getopt.h>
|
||||
#include <strings.h>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
#include "common.h"
|
||||
#include "innobackupex.h"
|
||||
#include "xtrabackup.h"
|
||||
#include "xtrabackup_version.h"
|
||||
#include "xbstream.h"
|
||||
#include "fil_cur.h"
|
||||
#include "write_filt.h"
|
||||
@ -667,22 +665,6 @@ static struct my_option ibx_long_options[] =
|
||||
(uchar*) &ibx_xtrabackup_parallel, (uchar*) &ibx_xtrabackup_parallel,
|
||||
0, GET_INT, REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0},
|
||||
|
||||
{"rebuild-indexes", OPT_REBUILD_INDEXES,
|
||||
"This option only has effect when used together with the --apply-log "
|
||||
"option and is passed directly to xtrabackup. When used, makes "
|
||||
"xtrabackup rebuild all secondary indexes after applying the log. "
|
||||
"This option is normally used to prepare compact backups. See the "
|
||||
"XtraBackup manual for more information.",
|
||||
(uchar*) &ibx_xtrabackup_rebuild_indexes,
|
||||
(uchar*) &ibx_xtrabackup_rebuild_indexes,
|
||||
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
|
||||
{"rebuild-threads", OPT_REBUILD_THREADS,
|
||||
"Use this number of threads to rebuild indexes in a compact backup. "
|
||||
"Only has effect with --prepare and --rebuild-indexes.",
|
||||
(uchar*) &ibx_xtrabackup_rebuild_threads,
|
||||
(uchar*) &ibx_xtrabackup_rebuild_threads,
|
||||
0, GET_UINT, REQUIRED_ARG, 1, 1, UINT_MAX, 0, 0, 0},
|
||||
|
||||
{"stream", OPT_STREAM, "This option specifies the format in which to "
|
||||
"do the streamed backup. The option accepts a string argument. The "
|
||||
@ -845,9 +827,9 @@ ibx_get_one_option(int optid,
|
||||
exit(0);
|
||||
break;
|
||||
case 'v':
|
||||
msg("innobackupex version %s %s (%s) (revision id: %s)\n",
|
||||
XTRABACKUP_VERSION,
|
||||
SYSTEM_TYPE, MACHINE_TYPE, XTRABACKUP_REVISION);
|
||||
msg("innobackupex version %s %s (%s)\n",
|
||||
MYSQL_SERVER_VERSION,
|
||||
SYSTEM_TYPE, MACHINE_TYPE);
|
||||
exit(0);
|
||||
break;
|
||||
case OPT_HISTORY:
|
||||
@ -1039,7 +1021,6 @@ ibx_init()
|
||||
|
||||
/* setup xtrabackup options */
|
||||
xb_close_files = ibx_xb_close_files;
|
||||
xtrabackup_compact = ibx_xtrabackup_compact;
|
||||
xtrabackup_compress_alg = ibx_xtrabackup_compress_alg;
|
||||
xtrabackup_compress_threads = ibx_xtrabackup_compress_threads;
|
||||
xtrabackup_compress_chunk_size = ibx_xtrabackup_compress_chunk_size;
|
||||
@ -1057,8 +1038,6 @@ ibx_init()
|
||||
xtrabackup_log_copy_interval = ibx_xtrabackup_log_copy_interval;
|
||||
xtrabackup_incremental = ibx_xtrabackup_incremental;
|
||||
xtrabackup_parallel = ibx_xtrabackup_parallel;
|
||||
xtrabackup_rebuild_indexes = ibx_xtrabackup_rebuild_indexes;
|
||||
xtrabackup_rebuild_threads = ibx_xtrabackup_rebuild_threads;
|
||||
xtrabackup_stream_str = ibx_xtrabackup_stream_str;
|
||||
xtrabackup_tables_file = ibx_xtrabackup_tables_file;
|
||||
xtrabackup_throttle = ibx_xtrabackup_throttle;
|
||||
|
@ -75,7 +75,7 @@ rf_pass_through_get_next_batch(
|
||||
*read_batch_start = ctxt->offset;
|
||||
*read_batch_len = ctxt->data_file_size - ctxt->offset;
|
||||
|
||||
if (*read_batch_len > ctxt->buffer_capacity) {
|
||||
if (*read_batch_len > (ib_int64_t)ctxt->buffer_capacity) {
|
||||
*read_batch_len = ctxt->buffer_capacity;
|
||||
}
|
||||
|
||||
@ -128,7 +128,7 @@ rf_bitmap_get_next_batch(
|
||||
{
|
||||
ulint start_page_id;
|
||||
|
||||
start_page_id = ctxt->offset / ctxt->page_size;
|
||||
start_page_id = (ulint)(ctxt->offset / ctxt->page_size);
|
||||
|
||||
xb_a (ctxt->offset % ctxt->page_size == 0);
|
||||
|
||||
@ -170,7 +170,7 @@ rf_bitmap_get_next_batch(
|
||||
buffer capacity. The subsequent invocations will continue returning
|
||||
the current block in buffer-sized pieces until ctxt->filter_batch_end
|
||||
is reached, trigerring the next bitmap query. */
|
||||
if (*read_batch_len > ctxt->buffer_capacity) {
|
||||
if (*read_batch_len > (ib_int64_t)ctxt->buffer_capacity) {
|
||||
*read_batch_len = ctxt->buffer_capacity;
|
||||
}
|
||||
|
||||
|
@ -33,14 +33,14 @@ struct xb_fil_cur_t;
|
||||
struct xb_read_filt_ctxt_t {
|
||||
ib_int64_t offset; /*!< current file offset */
|
||||
ib_int64_t data_file_size; /*!< data file size */
|
||||
ib_int64_t buffer_capacity;/*!< read buffer capacity */
|
||||
ulint space_id; /*!< space id */
|
||||
size_t buffer_capacity;/*!< read buffer capacity */
|
||||
ib_int64_t space_id; /*!< space id */
|
||||
/* The following fields used only in bitmap filter */
|
||||
/* Move these to union if any other filters are added in future */
|
||||
xb_page_bitmap_range *bitmap_range; /*!< changed page bitmap range
|
||||
iterator for space_id */
|
||||
ulint page_size; /*!< page size */
|
||||
ulint filter_batch_end;/*!< the ending page id of the
|
||||
size_t page_size; /*!< page size */
|
||||
ulint filter_batch_end;/*!< the ending page id of the
|
||||
current changed page block in
|
||||
the bitmap */
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -75,7 +75,7 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name,
|
||||
ctxt->cursor = cursor;
|
||||
|
||||
/* allocate buffer for incremental backup (4096 pages) */
|
||||
buf_size = (UNIV_PAGE_SIZE_MAX / 4 + 1) * UNIV_PAGE_SIZE_MAX;
|
||||
buf_size = (cursor->page_size / 4 + 1) * cursor->page_size;
|
||||
cp->delta_buf_base = static_cast<byte *>(ut_malloc(buf_size));
|
||||
memset(cp->delta_buf_base, 0, buf_size);
|
||||
cp->delta_buf = static_cast<byte *>
|
||||
|
@ -27,7 +27,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
#include "fil_cur.h"
|
||||
#include "datasink.h"
|
||||
#include "compact.h"
|
||||
|
||||
/* Incremental page filter context */
|
||||
typedef struct {
|
||||
@ -41,7 +40,6 @@ typedef struct {
|
||||
xb_fil_cur_t *cursor;
|
||||
union {
|
||||
xb_wf_incremental_ctxt_t wf_incremental_ctxt;
|
||||
xb_wf_compact_ctxt_t wf_compact_ctxt;
|
||||
} u;
|
||||
} xb_write_filt_ctxt_t;
|
||||
|
||||
@ -56,6 +54,5 @@ typedef struct {
|
||||
|
||||
extern xb_write_filt_t wf_write_through;
|
||||
extern xb_write_filt_t wf_incremental;
|
||||
extern xb_write_filt_t wf_compact;
|
||||
|
||||
#endif /* XB_WRITE_FILT_H */
|
||||
|
@ -46,7 +46,7 @@ permission notice:
|
||||
#include <trx0sys.h>
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
#define WSREP_XID_PREFIX "WSREPXid"
|
||||
#define WSREP_XID_PREFIX_LEN MYSQL_XID_PREFIX_LEN
|
||||
#define WSREP_XID_UUID_OFFSET 8
|
||||
@ -61,11 +61,11 @@ permission notice:
|
||||
|
||||
/* Galera UUID type - for all unique IDs */
|
||||
typedef struct wsrep_uuid {
|
||||
uint8_t data[16];
|
||||
unsigned char data[16];
|
||||
} wsrep_uuid_t;
|
||||
|
||||
/* sequence number of a writeset, etc. */
|
||||
typedef int64_t wsrep_seqno_t;
|
||||
typedef long long wsrep_seqno_t;
|
||||
|
||||
/* Undefined UUID */
|
||||
static const wsrep_uuid_t WSREP_UUID_UNDEFINED = {{0,}};
|
||||
@ -217,3 +217,4 @@ xb_write_galera_info(bool incremental_prepare)
|
||||
|
||||
fclose(fp);
|
||||
}
|
||||
#endif
|
||||
|
78
extra/mariabackup/xb0xb.h
Normal file
78
extra/mariabackup/xb0xb.h
Normal file
@ -0,0 +1,78 @@
|
||||
/******************************************************
|
||||
Copyright (c) 2012 Percona LLC and/or its affiliates.
|
||||
|
||||
Declarations of XtraBackup functions called by InnoDB code.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*******************************************************/
|
||||
|
||||
#ifndef xb0xb_h
|
||||
#define xb0xb_h
|
||||
|
||||
|
||||
extern void os_io_init_simple(void);
|
||||
extern os_file_t files[1000];
|
||||
extern const char *innodb_checksum_algorithm_names[];
|
||||
extern TYPELIB innodb_checksum_algorithm_typelib;
|
||||
extern dberr_t open_or_create_data_files(
|
||||
ibool* create_new_db,
|
||||
#ifdef UNIV_LOG_ARCHIVE
|
||||
lsn_t* min_arch_log_no,
|
||||
lsn_t* max_arch_log_no,
|
||||
#endif
|
||||
lsn_t* min_flushed_lsn,
|
||||
lsn_t* max_flushed_lsn,
|
||||
ulint* sum_of_new_sizes)
|
||||
;
|
||||
int
|
||||
fil_file_readdir_next_file(
|
||||
/*=======================*/
|
||||
dberr_t* err, /*!< out: this is set to DB_ERROR if an error
|
||||
was encountered, otherwise not changed */
|
||||
const char* dirname,/*!< in: directory name or path */
|
||||
os_file_dir_t dir, /*!< in: directory stream */
|
||||
os_file_stat_t* info) /*!< in/out: buffer where the
|
||||
info is returned */;
|
||||
buf_block_t* btr_node_ptr_get_child(
|
||||
const rec_t* node_ptr,/*!< in: node pointer */
|
||||
dict_index_t* index, /*!< in: index */
|
||||
const ulint* offsets,/*!< in: array returned by rec_get_offsets() */
|
||||
mtr_t* mtr) /*!< in: mtr */;
|
||||
|
||||
buf_block_t*
|
||||
btr_root_block_get(
|
||||
/*===============*/
|
||||
const dict_index_t* index, /*!< in: index tree */
|
||||
ulint mode, /*!< in: either RW_S_LATCH
|
||||
or RW_X_LATCH */
|
||||
mtr_t* mtr) /*!< in: mtr */;
|
||||
fil_space_t*
|
||||
fil_space_get_by_name(const char *);
|
||||
ibool
|
||||
recv_check_cp_is_consistent(const byte* buf);
|
||||
void
|
||||
innodb_log_checksum_func_update(
|
||||
/*============================*/
|
||||
ulint algorithm) /*!< in: algorithm */;
|
||||
dberr_t recv_find_max_checkpoint(log_group_t** max_group, ulint* max_field);
|
||||
dberr_t
|
||||
srv_undo_tablespaces_init(
|
||||
/*======================*/
|
||||
ibool create_new_db,
|
||||
ibool backup_mode,
|
||||
const ulint n_conf_tablespaces,
|
||||
ulint* n_opened);
|
||||
|
||||
#endif
|
@ -22,50 +22,27 @@ my_regex is used on Windows and native calls are used on POSIX platforms. */
|
||||
#ifndef XB_REGEX_H
|
||||
#define XB_REGEX_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef HAVE_SYSTEM_REGEX
|
||||
#include <regex.h>
|
||||
#else
|
||||
#include <pcreposix.h>
|
||||
#endif
|
||||
|
||||
#include <my_regex.h>
|
||||
typedef regex_t* xb_regex_t;
|
||||
|
||||
typedef my_regex_t xb_regex_t;
|
||||
typedef my_regmatch_t xb_regmatch_t;
|
||||
|
||||
#define xb_regex_init() my_regex_init(&my_charset_latin1)
|
||||
#define xb_regex_init()
|
||||
|
||||
#define xb_regexec(preg,string,nmatch,pmatch,eflags) \
|
||||
my_regexec(preg, string, nmatch, pmatch, eflags)
|
||||
|
||||
#define xb_regerror(errcode,preg,errbuf,errbuf_size) \
|
||||
my_regerror(errcode, preg, errbuf, errbuf_size)
|
||||
|
||||
#define xb_regcomp(preg,regex,cflags) \
|
||||
my_regcomp(preg, regex, cflags, &my_charset_latin1)
|
||||
|
||||
#define xb_regfree(preg) my_regfree(preg)
|
||||
|
||||
#define xb_regex_end() my_regex_end()
|
||||
|
||||
#else /* ! _WIN32 */
|
||||
|
||||
#include <regex.h>
|
||||
|
||||
typedef regex_t xb_regex_t;
|
||||
typedef regmatch_t xb_regmatch_t;
|
||||
|
||||
#define xb_regex_init() do { } while(0)
|
||||
|
||||
#define xb_regexec(preg,string,nmatch,pmatch,eflags) \
|
||||
regexec(preg, string, nmatch, pmatch, eflags)
|
||||
|
||||
#define xb_regerror(errcode,preg,errbuf,errbuf_size) \
|
||||
#define xb_regerror(errcode,preg,errbuf,errbuf_size) \
|
||||
regerror(errcode, preg, errbuf, errbuf_size)
|
||||
|
||||
#define xb_regcomp(preg,regex,cflags) \
|
||||
#define xb_regcomp(preg,regex,cflags) \
|
||||
regcomp(preg, regex, cflags)
|
||||
|
||||
#define xb_regfree(preg) regfree(preg)
|
||||
|
||||
#define xb_regex_end() do { } while (0)
|
||||
|
||||
#endif /* _WIN32 */
|
||||
#define xb_regex_end()
|
||||
|
||||
#endif /* XB_REGEX_H */
|
||||
|
@ -27,6 +27,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_GRYPT
|
||||
#include <gcrypt.h>
|
||||
|
||||
#if GCC_VERSION >= 4002
|
||||
@ -58,3 +59,4 @@ xb_crypt_create_iv(void* ivbuf, size_t ivlen)
|
||||
{
|
||||
gcry_create_nonce(ivbuf, ivlen);
|
||||
}
|
||||
#endif
|
@ -73,7 +73,7 @@ int xb_crypt_write_chunk(xb_wcrypt_t *crypt, const void *buf, size_t olen,
|
||||
int8store(ptr, (ulonglong)elen); /* encrypted (actual) size */
|
||||
ptr += 8;
|
||||
|
||||
checksum = crc32(0, buf, elen);
|
||||
checksum = crc32(0, buf, (uint)elen);
|
||||
int4store(ptr, checksum); /* checksum */
|
||||
ptr += 4;
|
||||
|
||||
|
@ -208,15 +208,15 @@ int
|
||||
stream_one_file(File file, xb_wstream_file_t *xbfile)
|
||||
{
|
||||
uchar *buf;
|
||||
size_t bytes;
|
||||
size_t offset;
|
||||
ssize_t bytes;
|
||||
my_off_t offset;
|
||||
|
||||
posix_fadvise(file, 0, 0, POSIX_FADV_SEQUENTIAL);
|
||||
offset = my_tell(file, MYF(MY_WME));
|
||||
|
||||
buf = (uchar*)(my_malloc(XBSTREAM_BUFFER_SIZE, MYF(MY_FAE)));
|
||||
|
||||
while ((bytes = my_read(file, buf, XBSTREAM_BUFFER_SIZE,
|
||||
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",
|
||||
@ -232,7 +232,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile)
|
||||
|
||||
my_free(buf);
|
||||
|
||||
if (bytes == (size_t) -1) {
|
||||
if (bytes < 0) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -48,13 +48,13 @@ xb_stream_read_new(void)
|
||||
stream->buffer = my_malloc(INIT_BUFFER_LEN, MYF(MY_FAE));
|
||||
stream->buflen = INIT_BUFFER_LEN;
|
||||
|
||||
stream->fd = fileno(stdin);
|
||||
stream->offset = 0;
|
||||
|
||||
#ifdef __WIN__
|
||||
setmode(stream->fd, _O_BINARY);
|
||||
setmode(fileno(stdin), _O_BINARY);
|
||||
#endif
|
||||
|
||||
stream->fd = my_fileno(stdin);
|
||||
stream->offset = 0;
|
||||
|
||||
return stream;
|
||||
}
|
||||
|
||||
|
@ -34,7 +34,7 @@ struct xb_wstream_struct {
|
||||
struct xb_wstream_file_struct {
|
||||
xb_wstream_t *stream;
|
||||
char *path;
|
||||
ulong path_len;
|
||||
size_t path_len;
|
||||
char chunk[XB_STREAM_MIN_CHUNK_SIZE];
|
||||
char *chunk_ptr;
|
||||
size_t chunk_free;
|
||||
@ -54,7 +54,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(fileno(stdout), buf, len, MYF(MY_WME | MY_NABP)))
|
||||
if (my_write(my_fileno(stdout), buf, len, MYF(MY_WME | MY_NABP)))
|
||||
return -1;
|
||||
return len;
|
||||
}
|
||||
@ -77,7 +77,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
|
||||
xb_stream_write_callback *onwrite)
|
||||
{
|
||||
xb_wstream_file_t *file;
|
||||
ulong path_len;
|
||||
size_t path_len;
|
||||
|
||||
path_len = strlen(path);
|
||||
|
||||
@ -90,7 +90,19 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path,
|
||||
path_len + 1, MYF(MY_FAE));
|
||||
|
||||
file->path = (char *) (file + 1);
|
||||
#ifdef _WIN32
|
||||
/* Normalize path on Windows, so we can restore elsewhere.*/
|
||||
{
|
||||
int i;
|
||||
for (i = 0; ; i++) {
|
||||
file->path[i] = (path[i] == '\\') ? '/' : path[i];
|
||||
if (!path[i])
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
memcpy(file->path, path, path_len + 1);
|
||||
#endif
|
||||
file->path_len = path_len;
|
||||
|
||||
file->stream = stream;
|
||||
@ -208,7 +220,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len)
|
||||
int8store(ptr, file->offset); /* Payload offset */
|
||||
ptr += 8;
|
||||
|
||||
checksum = crc32(0, buf, len); /* checksum */
|
||||
checksum = crc32(0, buf, (uint)len); /* checksum */
|
||||
int4store(ptr, checksum);
|
||||
ptr += 4;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -63,8 +63,6 @@ extern lsn_t checkpoint_lsn_start;
|
||||
|
||||
extern xb_page_bitmap *changed_page_bitmap;
|
||||
|
||||
extern ulint xtrabackup_rebuild_threads;
|
||||
|
||||
extern char *xtrabackup_incremental;
|
||||
extern my_bool xtrabackup_incremental_force_scan;
|
||||
|
||||
@ -80,7 +78,6 @@ extern char *xtrabackup_tables_file;
|
||||
extern char *xtrabackup_databases;
|
||||
extern char *xtrabackup_databases_file;
|
||||
|
||||
extern my_bool xtrabackup_compact;
|
||||
extern ibool xtrabackup_compress;
|
||||
extern ibool xtrabackup_encrypt;
|
||||
|
||||
@ -106,8 +103,14 @@ extern int xtrabackup_parallel;
|
||||
|
||||
extern my_bool xb_close_files;
|
||||
extern const char *xtrabackup_compress_alg;
|
||||
extern uint xtrabackup_compress_threads;
|
||||
extern ulonglong xtrabackup_compress_chunk_size;
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
extern uint xtrabackup_compress_threads;
|
||||
extern ulonglong xtrabackup_compress_chunk_size;
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
extern ulong xtrabackup_encrypt_algo;
|
||||
extern uint xtrabackup_encrypt_threads;
|
||||
extern ulonglong xtrabackup_encrypt_chunk_size;
|
||||
@ -116,7 +119,6 @@ extern char *xtrabackup_incremental_basedir;
|
||||
extern char *xtrabackup_extra_lsndir;
|
||||
extern char *xtrabackup_incremental_dir;
|
||||
extern ulint xtrabackup_log_copy_interval;
|
||||
extern my_bool xtrabackup_rebuild_indexes;
|
||||
extern char *xtrabackup_stream_str;
|
||||
extern long xtrabackup_throttle;
|
||||
extern longlong xtrabackup_use_memory;
|
||||
@ -165,14 +167,6 @@ extern uint opt_safe_slave_backup_timeout;
|
||||
extern const char *opt_history;
|
||||
extern my_bool opt_decrypt;
|
||||
|
||||
#if defined(HAVE_OPENSSL)
|
||||
extern my_bool opt_use_ssl;
|
||||
extern my_bool opt_ssl_verify_server_cert;
|
||||
#if !defined(HAVE_YASSL)
|
||||
extern char *opt_server_public_key;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
enum binlog_info_enum { BINLOG_INFO_OFF, BINLOG_INFO_LOCKLESS, BINLOG_INFO_ON,
|
||||
BINLOG_INFO_AUTO};
|
||||
|
||||
@ -217,6 +211,14 @@ Check if parameter is set in defaults file or via command line argument
|
||||
bool
|
||||
check_if_param_set(const char *param);
|
||||
|
||||
#if defined(HAVE_OPENSSL)
|
||||
extern my_bool opt_use_ssl;
|
||||
extern my_bool opt_ssl_verify_server_cert;
|
||||
#if !defined(HAVE_YASSL)
|
||||
extern char *opt_server_public_key;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
void
|
||||
xtrabackup_backup_func(void);
|
||||
|
@ -1,27 +0,0 @@
|
||||
/******************************************************
|
||||
Copyright (c) 2013 Percona LLC and/or its affiliates.
|
||||
|
||||
Version numbers definitions.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; version 2 of the License.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
|
||||
*******************************************************/
|
||||
|
||||
#ifndef XB_VERSION_H
|
||||
#define XB_VERSION_H
|
||||
|
||||
#define XTRABACKUP_VERSION "@XB_VERSION@"
|
||||
#define XTRABACKUP_REVISION "@XB_REVISION@"
|
||||
|
||||
#endif /* XB_VERSION_H */
|
@ -506,3 +506,6 @@ MYSQL_ADD_PLUGIN(xtradb ${INNOBASE_SOURCES} STORAGE_ENGINE
|
||||
IF(TARGET xtradb AND NOT XTRADB_OK)
|
||||
MESSAGE(FATAL_ERROR "Percona XtraDB is not supported on this platform")
|
||||
ENDIF()
|
||||
|
||||
ADD_SUBDIRECTORY(${CMAKE_SOURCE_DIR}/extra/mariabackup ${CMAKE_BINARY_DIR}/extra/mariabackup)
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user