Commit ea947179 authored by Marko Mäkelä's avatar Marko Mäkelä

Merge 10.1 into 10.2

parents 0c02c91b 3d1ad2a5
......@@ -966,6 +966,9 @@ copy_file(ds_ctxt_t *datasink,
ds_file_t *dstfile = NULL;
datafile_cur_t cursor;
xb_fil_cur_result_t res;
const char *dst_path =
(xtrabackup_copy_back || xtrabackup_move_back)?
dst_file_path : trim_dotslash(dst_file_path);
if (!datafile_open(src_file_path, &cursor, thread_n)) {
goto error_close;
......@@ -973,8 +976,7 @@ copy_file(ds_ctxt_t *datasink,
strncpy(dst_name, cursor.rel_path, sizeof(dst_name));
dstfile = ds_open(datasink, trim_dotslash(dst_file_path),
&cursor.statinfo);
dstfile = ds_open(datasink, dst_path, &cursor.statinfo);
if (dstfile == NULL) {
msg("[%02u] error: "
"cannot open the destination stream for %s\n",
......
......@@ -480,7 +480,7 @@ get_mysql_vars(MYSQL *connection)
innodb_data_file_path_var, MYF(MY_FAE));
}
if (innodb_data_home_dir_var && *innodb_data_home_dir_var) {
if (innodb_data_home_dir_var) {
innobase_data_home_dir = my_strdup(
innodb_data_home_dir_var, MYF(MY_FAE));
}
......@@ -1607,6 +1607,44 @@ write_xtrabackup_info(MYSQL *connection, const char * filename, bool history)
extern const char *innodb_checksum_algorithm_names[];
#ifdef _WIN32
#include <algorithm>
#endif
static std::string make_local_paths(const char *data_file_path)
{
if (strchr(data_file_path, '/') == 0
#ifdef _WIN32
&& strchr(data_file_path, '\\') == 0
#endif
){
return std::string(data_file_path);
}
std::ostringstream buf;
char *dup = strdup(innobase_data_file_path);
ut_a(dup);
char *p;
char * token = strtok_r(dup, ";", &p);
while (token) {
if (buf.tellp())
buf << ";";
char *fname = strrchr(token, '/');
#ifdef _WIN32
fname = std::max(fname,strrchr(token, '\\'));
#endif
if (fname)
buf << fname + 1;
else
buf << token;
token = strtok_r(NULL, ";", &p);
}
free(dup);
return buf.str();
}
bool write_backup_config_file()
{
int rc= backup_file_printf("backup-my.cnf",
......@@ -1623,7 +1661,7 @@ bool write_backup_config_file()
"%s%s\n"
"%s\n",
innodb_checksum_algorithm_names[srv_checksum_algorithm],
innobase_data_file_path,
make_local_paths(innobase_data_file_path).c_str(),
srv_n_log_files,
srv_log_file_size,
srv_page_size,
......
......@@ -4566,8 +4566,6 @@ xtrabackup_apply_delta(
posix_fadvise(src_file, 0, 0, POSIX_FADV_SEQUENTIAL);
os_file_set_nocache(src_file, src_path, "OPEN");
dst_file = xb_delta_open_matching_space(
dbname, space_name, info,
dst_path, sizeof(dst_path), &success);
......@@ -4578,8 +4576,6 @@ xtrabackup_apply_delta(
posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED);
os_file_set_nocache(dst_file, dst_path, "OPEN");
/* allocate buffer for incremental backup (4096 pages) */
incremental_buffer_base = static_cast<byte *>
(malloc((page_size / 4 + 1) * page_size));
......@@ -4685,6 +4681,13 @@ xtrabackup_apply_delta(
}
}
/* Free file system buffer cache after the batch was written. */
#ifdef __linux__
os_file_flush_func(dst_file);
#endif
posix_fadvise(dst_file, 0, 0, POSIX_FADV_DONTNEED);
incremental_buffers++;
}
......
......@@ -21,6 +21,9 @@ sub skip_combinations {
my %skip = ( 'include/have_innodb.combinations' => [ @combinations ],
'include/have_xtradb.combinations' => [ @combinations ]);
$skip{'include/innodb_encrypt_log.combinations'} = [ 'crypt' ]
unless $ENV{DEBUG_KEY_MANAGEMENT_SO};
# don't run tests for the wrong platform
$skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ];
......
......@@ -58,6 +58,7 @@ set autocommit=1;
-- source include/search_pattern_in_file.inc
--source include/start_mysqld.inc
let MYSQLD_DATADIR =`SELECT @@datadir`;
--list_files $MYSQLD_DATADIR/test
FLUSH TABLES t1, t2, t3 FOR EXPORT;
......
......@@ -27,11 +27,9 @@ galera_ist_mysqldump : MDEV-13549 Galera test failures
galera_ssl_upgrade : MDEV-13549 Galera test failures
galera.MW-329 : wsrep_local_replays not stable
galera.MW-328A : have_deadlocks test not stable
galera_var_retry_autocommit: MDEV-15794 Test failure on galera.galera_var_retry_autocommit
galera_var_auto_inc_control_on: MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on
pxc-421 : MDEV-15804 Test failure on galera.pxc-421
galera_var_retry_autocommit : MDEV-15794 Test failure on galera.galera_var_retry_autocommit
galera_var_auto_inc_control_on : MDEV-15803 Test failure on galera.galera_var_auto_inc_control_on
query_cache : MDEV-15805 Test failure on galera.query_cache
galera.galera_gra_log : MDEV-15808 Test failure on galera.galera_gra_log
galera.MW-44 : MDEV-15809 Test failure on galera.MW-44
galera.galera_pc_ignore_sb : MDEV-15811 Test failure on galera_pc_ignore_sb
galera_kill_applier : race condition at the start of the test
......
......@@ -4,6 +4,7 @@ CREATE TABLE t1 (f1 INTEGER);
connection node_1;
CREATE TABLE t1 (f1 INTEGER);
connection node_2;
SET SESSION wsrep_on=ON;
SELECT COUNT(*) = 0 FROM t1;
COUNT(*) = 0
1
......@@ -30,6 +31,5 @@ DELIMITER ;
ROLLBACK /* added by mysqlbinlog */;
/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
SET SESSION wsrep_on=ON;
CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query");
DROP TABLE t1;
......@@ -12,7 +12,6 @@ INSERT INTO t1 VALUES (2);
connection node_1;
INSERT INTO t1 VALUES (3);
connection node_2;
set SESSION wsrep_sync_wait=0;
INSERT INTO t1 VALUES (4);
set GLOBAL wsrep_slave_threads=5;
SELECT COUNT(*) = 5 FROM t1;
......
......@@ -17,6 +17,7 @@ CREATE TABLE t1 (f1 INTEGER);
CREATE TABLE t1 (f1 INTEGER);
--connection node_2
SET SESSION wsrep_on=ON;
SELECT COUNT(*) = 0 FROM t1;
# Make sure the GRA file produced is readable and contains the failure
......@@ -24,8 +25,6 @@ SELECT COUNT(*) = 0 FROM t1;
--replace_regex /SET TIMESTAMP=[0-9]+/SET TIMESTAMP=<TIMESTAMP>/ /pseudo_thread_id=[0-9]+/pseudo_thread_id=<PSEUDO_THREAD_ID>/
--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log
SET SESSION wsrep_on=ON;
CALL mtr.add_suppression("Slave SQL: Error 'Table 't1' already exists' on query");
DROP TABLE t1;
......@@ -36,9 +36,7 @@ INSERT INTO t1 VALUES (3);
--eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig';
--enable_query_log
set SESSION wsrep_sync_wait=0;
--source include/wait_until_connected_again.inc
--source include/galera_wait_ready.inc
INSERT INTO t1 VALUES (4);
set GLOBAL wsrep_slave_threads=5;
......
--innodb --innodb-data-home-dir= --innodb-data-file-path=$MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1:3M;ibdata_second:1M:autoextend
\ No newline at end of file
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
# xtrabackup backup
# remove datadir
# xtrabackup copy back
# restart server
SELECT * from t;
i
1
DROP TABLE t;
# This test just backs up and restores empty database
# Innodb system tablespace is specified with absolute path in the .opt file
CREATE TABLE t(i INT) ENGINE INNODB;
INSERT INTO t VALUES(1);
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $_innodb_data_file_path=`select @@innodb_data_file_path`;
let $_innodb_data_home_dir=`select @@innodb_data_home_dir`;
let $_datadir= `SELECT @@datadir`;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
--source include/shutdown_mysqld.inc
echo # remove datadir;
rmdir $_datadir;
#remove out-of-datadir ibdata1
remove_file $MYSQLTEST_VARDIR/tmp/absolute_path_ibdata1;
echo # xtrabackup copy back;
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --copy-back --datadir=$_datadir --target-dir=$targetdir "--innodb_data_file_path=$_innodb_data_file_path" --innodb_data_home_dir=$_innodb_data_home_dir;
echo # restart server;
--source include/start_mysqld.inc
--enable_result_log
SELECT * from t;
DROP TABLE t;
rmdir $targetdir;
......@@ -1974,6 +1974,12 @@ fil_crypt_rotate_pages(
continue;
}
/* If space is marked as stopping, stop rotating
pages. */
if (state->space->is_stopping()) {
break;
}
fil_crypt_rotate_page(key_state, state);
}
}
......@@ -2022,6 +2028,10 @@ fil_crypt_flush_space(
crypt_data->type = CRYPT_SCHEME_UNENCRYPTED;
}
if (space->is_stopping()) {
return;
}
/* update page 0 */
mtr_t mtr;
mtr.start();
......
......@@ -315,6 +315,9 @@ if(MRN_BUNDLED)
${MRN_ALL_SOURCES}
STORAGE_ENGINE MODULE_ONLY
LINK_LIBRARIES ${MRN_LIBRARIES})
if(NOT TARGET mroonga)
return()
endif()
else()
add_library(mroonga MODULE ${MRN_ALL_SOURCES})
......
......@@ -2019,6 +2019,12 @@ fil_crypt_rotate_pages(
continue;
}
/* If space is marked as stopping, stop rotating
pages. */
if (state->space->is_stopping()) {
break;
}
fil_crypt_rotate_page(key_state, state);
}
}
......@@ -2067,20 +2073,22 @@ fil_crypt_flush_space(
crypt_data->type = CRYPT_SCHEME_UNENCRYPTED;
}
/* update page 0 */
mtr_t mtr;
mtr_start(&mtr);
if (!space->is_stopping()) {
/* update page 0 */
mtr_t mtr;
mtr_start(&mtr);
const uint zip_size = fsp_flags_get_zip_size(state->space->flags);
const uint zip_size = fsp_flags_get_zip_size(state->space->flags);
buf_block_t* block = buf_page_get_gen(space->id, zip_size, 0,
buf_block_t* block = buf_page_get_gen(space->id, zip_size, 0,
RW_X_LATCH, NULL, BUF_GET,
__FILE__, __LINE__, &mtr);
byte* frame = buf_block_get_frame(block);
byte* frame = buf_block_get_frame(block);
crypt_data->write_page0(frame, &mtr);
crypt_data->write_page0(frame, &mtr);
mtr_commit(&mtr);
mtr_commit(&mtr);
}
}
/***********************************************************************
......
......@@ -3434,13 +3434,13 @@ fil_iterate(
bool updated = false;
os_offset_t page_off = offset;
ulint n_pages_read = (ulint) n_bytes / iter.page_size;
bool decrypted = false;
const ulint size = iter.page_size;
block->page.offset = page_off / size;
for (ulint i = 0; i < n_pages_read;
++i, page_off += size, block->frame += size,
block->page.offset++) {
bool decrypted = false;
dberr_t err = DB_SUCCESS;
byte* src = readptr + (i * size);
byte* dst = io_buffer + (i * size);
......@@ -3487,6 +3487,7 @@ fil_iterate(
block->frame = src;
frame_changed = true;
} else {
ut_ad(dst != src);
memcpy(dst, src, size);
}
}
......@@ -3547,9 +3548,13 @@ fil_iterate(
ut_ad(encrypted ?
src != dst && dst != writeptr + (i * size):1);
if (encrypted) {
memcpy(writeptr + (i * size),
callback.get_frame(block), size);
/* When tablespace is encrypted or compressed its
first page (i.e. page 0) is not encrypted or
compressed and there is no need to copy frame. */
if (encrypted && block->page.offset != 0) {
byte *local_frame = callback.get_frame(block);
ut_ad((writeptr + (i * size)) != local_frame);
memcpy((writeptr + (i * size)), local_frame, size);
}
if (frame_changed) {
......@@ -3597,6 +3602,7 @@ fil_iterate(
if (tmp == src) {
/* TODO: remove unnecessary memcpy's */
ut_ad(dest != src);
memcpy(dest, src, size);
}
......
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