Commit ee4eda40 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-12832 : remove libarchive support from mariabackup,

due to different packaging issues.

Also, Percona thinks that tar support has  many limitations
and should be removed as well( see discussion  in
https://bugs.launchpad.net/percona-xtrabackup/+bug/1681721)

there is an alternative streaming format xbstream that is supported and
does not have these limitations.
parent 90c52e52
......@@ -27,101 +27,6 @@ IF(NOT WIN32)
ENDIF()
ENDIF()
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_DIR ${CMAKE_CURRENT_BINARY_DIR}/libarchive)
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)
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(byproducts ${LIBARCHIVE_RELEASE_LIB} ${LIBARCHIVE_DEBUG_LIB})
ELSE()
SET(LIBARCHIVE_LIB ${LIBARCHIVE_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}archive${CMAKE_STATIC_LIBRARY_SUFFIX})
SET(byproducts ${LIBARCHIVE_LIB})
ENDIF()
IF(CMAKE_VERSION VERSION_GREATER "3.1")
SET(byproducts BUILD_BYPRODUCTS ${byproducts})
ENDIF()
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}
${byproducts}
)
ADD_LIBRARY(archive_static STATIC IMPORTED)
ADD_DEPENDENCIES(archive_static libarchive)
IF(WIN32)
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_LIB})
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
......@@ -154,7 +59,6 @@ MYSQL_ADD_EXECUTABLE(mariabackup
innobackupex.cc
changed_page_bitmap.cc
datasink.c
${DS_ARCHIVE_SOURCE}
ds_buffer.c
ds_compress.c
ds_local.c
......
......@@ -848,9 +848,7 @@ ibx_get_one_option(int optid,
opt_ibx_decrypt = true;
break;
case OPT_STREAM:
if (!strcasecmp(argument, "tar"))
xtrabackup_stream_fmt = XB_STREAM_FMT_TAR;
else if (!strcasecmp(argument, "xbstream"))
if (!strcasecmp(argument, "xbstream"))
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
else {
ibx_msg("Invalid --stream argument: %s\n", argument);
......
......@@ -42,7 +42,6 @@ typedef struct xb_wstream_file_struct xb_wstream_file_t;
typedef enum {
XB_STREAM_FMT_NONE,
XB_STREAM_FMT_TAR,
XB_STREAM_FMT_XBSTREAM
} xb_stream_fmt_t;
......
......@@ -704,11 +704,7 @@ struct my_option xb_client_options[] =
{"stream", OPT_XTRA_STREAM, "Stream all backup files to the standard output "
"in the specified format."
#ifdef HAVE_LIBARCHIVE
"Supported formats are 'tar' and 'xbstream'."
#else
"Supported format is 'xbstream'."
#endif
,
(G_PTR*) &xtrabackup_stream_str, (G_PTR*) &xtrabackup_stream_str, 0, GET_STR,
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
......@@ -1453,9 +1449,7 @@ xb_get_one_option(int optid,
xtrabackup_target_dir= xtrabackup_real_target_dir;
break;
case OPT_XTRA_STREAM:
if (!strcasecmp(argument, "tar"))
xtrabackup_stream_fmt = XB_STREAM_FMT_TAR;
else if (!strcasecmp(argument, "xbstream"))
if (!strcasecmp(argument, "xbstream"))
xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM;
else
{
......@@ -3106,14 +3100,6 @@ files first, and then streams them in a serialized way when closed. */
static void
xtrabackup_init_datasinks(void)
{
if (xtrabackup_parallel > 1 && xtrabackup_stream &&
xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
msg("xtrabackup: warning: the --parallel option does not have "
"any effect when streaming in the 'tar' format. "
"You can use the 'xbstream' format instead.\n");
xtrabackup_parallel = 1;
}
/* Start building out the pipelines from the terminus back */
if (xtrabackup_stream) {
/* All streaming goes to stdout */
......@@ -3131,30 +3117,17 @@ xtrabackup_init_datasinks(void)
/* Stream formatting */
if (xtrabackup_stream) {
ds_ctxt_t *ds;
if (xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
ds = ds_create(xtrabackup_target_dir, DS_TYPE_ARCHIVE);
} else if (xtrabackup_stream_fmt == XB_STREAM_FMT_XBSTREAM) {
ds = ds_create(xtrabackup_target_dir, DS_TYPE_XBSTREAM);
} else {
/* bad juju... */
ds = NULL;
}
ut_a(xtrabackup_stream_fmt == XB_STREAM_FMT_XBSTREAM);
ds = ds_create(xtrabackup_target_dir, DS_TYPE_XBSTREAM);
xtrabackup_add_datasink(ds);
ds_set_pipe(ds, ds_data);
ds_data = ds;
if (xtrabackup_stream_fmt != XB_STREAM_FMT_XBSTREAM) {
/* 'tar' does not allow parallel streams */
ds_redo = ds_meta = ds_create(xtrabackup_target_dir,
DS_TYPE_TMPFILE);
xtrabackup_add_datasink(ds_meta);
ds_set_pipe(ds_meta, ds);
} else {
ds_redo = ds_meta = ds_data;
}
ds_redo = ds_meta = ds_data;
}
/* Encryption */
......@@ -7406,22 +7379,6 @@ int main(int argc, char **argv)
innobase_file_per_table = TRUE;
}
if (xtrabackup_incremental && xtrabackup_stream &&
xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
msg("xtrabackup: error: "
"streaming incremental backups are incompatible with the \n"
"'tar' streaming format. Use --stream=xbstream instead.\n");
exit(EXIT_FAILURE);
}
if ((xtrabackup_compress || xtrabackup_encrypt) && xtrabackup_stream &&
xtrabackup_stream_fmt == XB_STREAM_FMT_TAR) {
msg("xtrabackup: error: "
"compressed and encrypted backups are incompatible with the \n"
"'tar' streaming format. Use --stream=xbstream instead.\n");
exit(EXIT_FAILURE);
}
if (!xtrabackup_prepare &&
(innobase_log_arch_dir || xtrabackup_archived_to_lsn)) {
......
......@@ -21,11 +21,6 @@ $ENV{XBSTREAM}= ::mtr_exe_maybe_exists(
"$::bindir/extra/mariabackup/$::opt_vs_config/mbstream",
"$::path_client_bindir/mbstream");
my $tar_version = `tar --version 2>&1`;
$ENV{HAVE_TAR} = $! ? 0: 1;
my $mariabackup_help=`$mariabackup_exe --help 2>&1`;
$ENV{HAVE_XTRABACKUP_TAR_SUPPORT} = (index($mariabackup_help,"'tar'") == -1) ? 0 : 1;
$ENV{INNOBACKUPEX}= "$mariabackup_exe --innobackupex";
sub skip_combinations {
......
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
# xtrabackup backup
# xtrabackup prepare
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT * FROM t;
i
1
DROP TABLE t;
if (`select $HAVE_TAR = 0`)
{
--skip No tar
}
if (`select $HAVE_XTRABACKUP_TAR_SUPPORT = 0`)
{
--skip Compiled without libarchive
}
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $streamfile=$MYSQLTEST_VARDIR/tmp/backup.tar;
mkdir $targetdir;
exec $XTRABACKUP "--defaults-file=$MYSQLTEST_VARDIR/my.cnf" --backup --stream=tar > $streamfile 2>$targetdir/backup_stream.log;
--disable_result_log
exec tar -C $targetdir -x < $streamfile;
echo # xtrabackup prepare;
exec $XTRABACKUP --prepare --target-dir=$targetdir;
-- source include/restart_and_restore.inc
--enable_result_log
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
......@@ -9,7 +9,7 @@ echo # xtrabackup backup to stream;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --stream=xbstream > $streamfile 2>$targetdir/backup_stream.log;
echo # xbstream extract;
--disable_result_log
exec $XBSTREAM -x -C $targetdir --parallel=16 < $streamfile;
exec $XBSTREAM -x -C $targetdir < $streamfile;
echo # xtrabackup prepare;
exec $XTRABACKUP --prepare --target-dir=$targetdir;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment