Skip to content

Commit

Permalink
Merge 10.1 into 10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-m committed Nov 24, 2017
2 parents 6979d20 + 316f0d8 commit f1cc6e3
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 9 deletions.
3 changes: 2 additions & 1 deletion cmake/dtrace.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ MACRO(CHECK_DTRACE)
# On FreeBSD, dtrace does not handle userland tracing yet
IF(DTRACE AND NOT CMAKE_SYSTEM_NAME MATCHES "FreeBSD"
AND NOT BUGGY_GCC_NO_DTRACE_MODULES
AND NOT BUGGY_LINUX_DTRACE)
AND NOT BUGGY_LINUX_DTRACE
AND NOT CMAKE_SYSTEM_NAME MATCHES "SunOS")
SET(ENABLE_DTRACE ON CACHE BOOL "Enable dtrace")
ENDIF()
SET(HAVE_DTRACE ${ENABLE_DTRACE})
Expand Down
2 changes: 1 addition & 1 deletion extra/mariabackup/crc/crc_glue.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#include <string.h>
#include <zlib.h>

#if __GNUC__ >= 4 && defined(__x86_64__)
#if defined(__GNUC__) && defined(__x86_64__)
static int pclmul_enabled = 0;
#endif

Expand Down
27 changes: 23 additions & 4 deletions extra/mariabackup/xtrabackup.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4398,10 +4398,29 @@ xtrabackup_apply_delta(
if (off == 0) {
/* Read tablespace size from page 0,
and extend the file to specified size.*/
os_offset_t n_pages = mach_read_from_4(buf + FSP_HEADER_OFFSET + FSP_SIZE);
success = os_file_set_size(dst_path, dst_file, n_pages*page_size);
if (!success)
goto error;
os_offset_t n_pages = mach_read_from_4(
buf + FSP_HEADER_OFFSET + FSP_SIZE);
if (mach_read_from_4(buf
+ FIL_PAGE_SPACE_ID)) {
if (!os_file_set_size(
dst_path, dst_file,
n_pages * page_size))
goto error;
} else if (fil_space_t* space
= fil_space_acquire(0)) {
/* The system tablespace can
consist of multiple files. The
first one has full tablespace
size in page 0, but only the last
file should be extended. */
fil_node_t* n = UT_LIST_GET_FIRST(
space->chain);
bool fail = !strcmp(n->name, dst_path)
&& !fil_space_extend(
space, n_pages);
fil_space_release(space);
if (fail) goto error;
}
}

success = os_file_write(IORequestWrite,
Expand Down
2 changes: 1 addition & 1 deletion mysql-test/mysql-test-run.pl
Original file line number Diff line number Diff line change
Expand Up @@ -2802,7 +2802,7 @@ ($)
# Some InnoDB options are incompatible with the default bootstrap.
# If they are used, re-bootstrap
if ( $extra_opts and
"@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)/ )
"@$extra_opts" =~ /--innodb[-_](?:page[-_]size|checksum[-_]algorithm|undo[-_]tablespaces|log[-_]group[-_]home[-_]dir|data[-_]home[-_]dir)|data[-_]file[-_]path/ )
{
mysql_install_db($mysqld, undef, $extra_opts);
}
Expand Down
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/mdev-14447.opt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--sequence --innodb-data-file-path=ibdata_first:3M;ibdata_second:1M:autoextend
19 changes: 19 additions & 0 deletions mysql-test/suite/mariabackup/mdev-14447.result
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
call mtr.add_suppression("InnoDB: New log files created");
CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB;
# Create full backup , modify table, then create incremental/differential backup
BEGIN;
INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000;
COMMIT;
SELECT count(*) FROM t;
count(*)
100000
# Prepare full backup, apply incremental one
# Restore and check results
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT count(*) FROM t;
count(*)
100000
DROP TABLE t;
46 changes: 46 additions & 0 deletions mysql-test/suite/mariabackup/mdev-14447.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
call mtr.add_suppression("InnoDB: New log files created");

let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;

CREATE TABLE t(a varchar(40) PRIMARY KEY, b varchar(40), c varchar(40), d varchar(40), index(b,c,d)) ENGINE INNODB;

echo # Create full backup , modify table, then create incremental/differential backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
--enable_result_log
BEGIN;
INSERT INTO t select uuid(), uuid(), uuid(), uuid() from seq_1_to_100000;
COMMIT;
SELECT count(*) FROM t;

exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;

--disable_result_log
echo # Prepare full backup, apply incremental one;
exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir;
exec $XTRABACKUP --prepare --apply-log-only --target-dir=$basedir --incremental-dir=$incremental_dir ;

echo # Restore and check results;
let $targetdir=$basedir;
#-- source include/restart_and_restore.inc

let $_datadir= `SELECT @@datadir`;
let $innodb_data_file_path=`SELECT @@innodb_data_file_path`;
echo # shutdown server;
--source include/shutdown_mysqld.inc
echo # remove datadir;
rmdir $_datadir;
echo # xtrabackup move back;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir "--innodb_data_file_path=$innodb_data_file_path" --target-dir=$targetdir;
echo # restart server;
--source include/start_mysqld.inc


--enable_result_log
SELECT count(*) FROM t;
DROP TABLE t;

# Cleanup
rmdir $basedir;
rmdir $incremental_dir;
5 changes: 4 additions & 1 deletion storage/innobase/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,13 @@ inline void* aligned_malloc(size_t size, size_t align) {
void *result;
#ifdef _MSC_VER
result = _aligned_malloc(size, align);
#else
#elif defined (HAVE_POSIX_MEMALIGN)
if(posix_memalign(&result, align, size)) {
result = 0;
}
#else
/* Use unaligned malloc as fallback */
result = malloc(size);
#endif
return result;
}
Expand Down
5 changes: 5 additions & 0 deletions storage/innobase/innodb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,11 @@ IF(NOT MSVC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=i686")
ENDIF()

CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
IF(HAVE_POSIX_MEMALIGN)
ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
ENDIF()

# Only use futexes on Linux if GCC atomics are available
IF(NOT MSVC AND NOT CMAKE_CROSSCOMPILING)
CHECK_C_SOURCE_RUNS(
Expand Down
6 changes: 6 additions & 0 deletions storage/xtradb/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ IF(HAVE_SCHED_GETCPU)
ENDIF()

IF(NOT MSVC)

CHECK_FUNCTION_EXISTS(posix_memalign HAVE_POSIX_MEMALIGN)
IF(HAVE_POSIX_MEMALIGN)
ADD_DEFINITIONS(-DHAVE_POSIX_MEMALIGN)
ENDIF()

# either define HAVE_IB_GCC_ATOMIC_BUILTINS or not
# workaround for old gcc on x86, gcc atomic ops only work under -march=i686
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "i686" AND CMAKE_COMPILER_IS_GNUCC AND
Expand Down
5 changes: 4 additions & 1 deletion storage/xtradb/buf/buf0buf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,13 @@ inline void* aligned_malloc(size_t size, size_t align) {
void *result;
#ifdef _MSC_VER
result = _aligned_malloc(size, align);
#else
#elif defined (HAVE_POSIX_MEMALIGN)
if(posix_memalign(&result, align, size)) {
result = 0;
}
#else
/* Use unaligned malloc as fallback */
result = malloc(size);
#endif
return result;
}
Expand Down

0 comments on commit f1cc6e3

Please sign in to comment.