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 8, 2017
2 parents e6ab6c4 + 644ffde commit 7c85a8d
Show file tree
Hide file tree
Showing 14 changed files with 164 additions and 9 deletions.
2 changes: 1 addition & 1 deletion extra/mariabackup/xtrabackup.cc
Expand Up @@ -2838,7 +2838,7 @@ static dberr_t enumerate_ibd_files(process_single_tablespace_func_t callback)
/* We found a symlink or a file */
if (strlen(fileinfo.name) > 4) {
bool is_isl= false;
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".ibd"))))
if (ends_with(fileinfo.name, ".ibd") || ((is_isl = ends_with(fileinfo.name, ".isl"))))
(*callback)(dbinfo.name, fileinfo.name, is_isl);
}
}
Expand Down
24 changes: 24 additions & 0 deletions mysql-test/r/type_bit.result
Expand Up @@ -806,3 +806,27 @@ SUM(a)
NULL
DROP TABLE t1;
End of 5.1 tests
#
# Start of 10.1 tests
#
#
# MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
#
CREATE TABLE t1 (val bit(1));
INSERT INTO t1 VALUES (0);
CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
SELECT * FROM t2;
c
0
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
`c` decimal(1,0) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2;
SELECT COALESCE(val, 1) FROM t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
def COALESCE(val, 1) 246 2 1 Y 32896 0 63
COALESCE(val, 1)
0
DROP TABLE t1;
13 changes: 13 additions & 0 deletions mysql-test/suite/mariabackup/data_directory.result
@@ -0,0 +1,13 @@
CREATE TABLE t(a INT) ENGINE=InnoDB DATA DIRECTORY='table_data_dir';
INSERT INTO t VALUES(1);
# xtrabackup backup
# xtrabackup prepare
DROP TABLE t;
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT * FROM t;
a
1
DROP TABLE t;
23 changes: 23 additions & 0 deletions mysql-test/suite/mariabackup/data_directory.test
@@ -0,0 +1,23 @@
let $table_data_dir=$MYSQLTEST_VARDIR/ddir;
mkdir $table_data_dir;
--replace_result $table_data_dir table_data_dir
EVAL CREATE TABLE t(a INT) ENGINE=InnoDB DATA DIRECTORY='$table_data_dir';
INSERT INTO t VALUES(1);
echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
--enable_result_log
--source include/shutdown_mysqld.inc
echo # xtrabackup prepare;
--disable_result_log
exec $XTRABACKUP --prepare --target-dir=$targetdir;
--source include/start_mysqld.inc
DROP TABLE t;
rmdir $table_data_dir;
-- source include/restart_and_restore.inc
--enable_result_log
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
rmdir $table_data_dir;
1 change: 1 addition & 0 deletions mysql-test/suite/mariabackup/partition_datadir.opt
@@ -0,0 +1 @@
--partition
22 changes: 22 additions & 0 deletions mysql-test/suite/mariabackup/partition_datadir.result
@@ -0,0 +1,22 @@
CREATE TABLE t(i int)
ENGINE=InnoDB
PARTITION BY RANGE (i)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION P1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300) DATA DIRECTORY = 'MYSQLTEST_VARDIR/partitdata',
PARTITION p3 VALUES LESS THAN (400) DATA DIRECTORY = 'MYSQLTEST_VARDIR/partitdata',
PARTITION p4 VALUES LESS THAN MAXVALUE);
INSERT INTO t VALUES (1), (101), (201), (301), (401);
DROP TABLE t;
# shutdown server
# remove datadir
# xtrabackup move back
# restart server
SELECT * FROM t;
i
1
101
201
301
401
DROP TABLE t;
24 changes: 24 additions & 0 deletions mysql-test/suite/mariabackup/partition_datadir.test
@@ -0,0 +1,24 @@
let $targetdir=$MYSQLTEST_VARDIR/backup;
mkdir $targetdir;
mkdir $MYSQLTEST_VARDIR/partitdata;

--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
eval CREATE TABLE t(i int)
ENGINE=InnoDB
PARTITION BY RANGE (i)
(PARTITION p0 VALUES LESS THAN (100),
PARTITION P1 VALUES LESS THAN (200),
PARTITION p2 VALUES LESS THAN (300) DATA DIRECTORY = '$MYSQLTEST_VARDIR/partitdata',
PARTITION p3 VALUES LESS THAN (400) DATA DIRECTORY = '$MYSQLTEST_VARDIR/partitdata',
PARTITION p4 VALUES LESS THAN MAXVALUE);
INSERT INTO t VALUES (1), (101), (201), (301), (401);
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
exec $XTRABACKUP --prepare --target-dir=$targetdir;
DROP TABLE t;
rmdir $MYSQLTEST_VARDIR/partitdata;
--source include/restart_and_restore.inc
--enable_result_log
SELECT * FROM t;
DROP TABLE t;
rmdir $targetdir;
rmdir $MYSQLTEST_VARDIR/partitdata;
2 changes: 2 additions & 0 deletions mysql-test/t/delimiter_command_case_sensitivity.test
@@ -1,2 +1,4 @@
source include/not_embedded.inc;

# MDEV-10728
--exec $MYSQL --default-character-set=binary < "t/delimiter_case_mdev_10728.sql"
19 changes: 19 additions & 0 deletions mysql-test/t/type_bit.test
Expand Up @@ -439,3 +439,22 @@ SELECT SUM(a) FROM t1 GROUP BY c, b, a;
DROP TABLE t1;

--echo End of 5.1 tests

--echo #
--echo # Start of 10.1 tests
--echo #

--echo #
--echo # MDEV-8867 Wrong field type or metadata for COALESCE(bit_column, 1)
--echo #

CREATE TABLE t1 (val bit(1));
INSERT INTO t1 VALUES (0);
CREATE TABLE t2 AS SELECT COALESCE(val, 1) AS c FROM t1;
SELECT * FROM t2;
SHOW CREATE TABLE t2;
DROP TABLE t2;
--enable_metadata
SELECT COALESCE(val, 1) FROM t1;
--disable_metadata
DROP TABLE t1;
27 changes: 25 additions & 2 deletions storage/innobase/fil/fil0fil.cc
Expand Up @@ -4343,8 +4343,19 @@ fil_ibd_discover(

/* Look for a remote file-per-table tablespace. */

df_rem_per.set_name(db);
if (df_rem_per.open_link_file() == DB_SUCCESS) {
switch (srv_operation) {
case SRV_OPERATION_BACKUP:
case SRV_OPERATION_RESTORE_DELTA:
ut_ad(0);
break;
case SRV_OPERATION_RESTORE_EXPORT:
case SRV_OPERATION_RESTORE:
break;
case SRV_OPERATION_NORMAL:
df_rem_per.set_name(db);
if (df_rem_per.open_link_file() != DB_SUCCESS) {
break;
}

/* An ISL file was found with contents. */
if (df_rem_per.open_read_only(false) != DB_SUCCESS
Expand Down Expand Up @@ -4434,6 +4445,18 @@ fil_ibd_load(
return(FIL_LOAD_OK);
}

if (srv_operation == SRV_OPERATION_RESTORE) {
/* Replace absolute DATA DIRECTORY file paths with
short names relative to the backup directory. */
if (const char* name = strrchr(filename, OS_PATH_SEPARATOR)) {
while (--name > filename
&& *name != OS_PATH_SEPARATOR);
if (name > filename) {
filename = name + 1;
}
}
}

Datafile file;
file.set_filepath(filename);
file.open_read_only(false);
Expand Down
5 changes: 3 additions & 2 deletions storage/innobase/handler/ha_innodb.cc
Expand Up @@ -20201,7 +20201,7 @@ wsrep_innobase_kill_one_trx(
wsrep_thd_awake(thd, signal);
} else {
/* abort currently executing query */
DBUG_PRINT("wsrep",("sending KILL_QUERY to: %ld",
DBUG_PRINT("wsrep",("sending KILL_QUERY to: %lu",
thd_get_thread_id(thd)));
WSREP_DEBUG("kill query for: %ld",
thd_get_thread_id(thd));
Expand Down Expand Up @@ -20345,7 +20345,8 @@ wsrep_fake_trx_id(
mutex_enter(&trx_sys->mutex);
trx_id_t trx_id = trx_sys_get_new_trx_id();
mutex_exit(&trx_sys->mutex);
WSREP_DEBUG("innodb fake trx id: %lu thd: %s", trx_id, wsrep_thd_query(thd));
WSREP_DEBUG("innodb fake trx id: " TRX_ID_FMT " thd: %s",
trx_id, wsrep_thd_query(thd));
wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id);
}

Expand Down
2 changes: 1 addition & 1 deletion storage/xtradb/fil/fil0fil.cc
Expand Up @@ -4857,7 +4857,7 @@ fil_load_single_table_tablespace(


/* Check for a link file which locates a remote tablespace. */
remote.success = fil_open_linked_file(
remote.success = (IS_XTRABACKUP() && !srv_backup_mode) ? 0 : fil_open_linked_file(
tablename, &remote.filepath, &remote.file, FALSE);

/* Read the first page of the remote tablespace */
Expand Down
7 changes: 4 additions & 3 deletions storage/xtradb/handler/ha_innodb.cc
Expand Up @@ -10947,7 +10947,7 @@ wsrep_append_foreign_key(
shared ? WSREP_KEY_SHARED : WSREP_KEY_EXCLUSIVE,
copy);
if (rcode) {
DBUG_PRINT("wsrep", ("row key failed: %lu", rcode));
DBUG_PRINT("wsrep", ("row key failed: %zu", rcode));
WSREP_ERROR("Appending cascaded fk row key failed: %s, %lu",
(wsrep_thd_query(thd)) ?
wsrep_thd_query(thd) : "void", rcode);
Expand Down Expand Up @@ -19714,7 +19714,7 @@ wsrep_innobase_kill_one_trx(
wsrep_thd_awake(thd, signal);
} else {
/* abort currently executing query */
DBUG_PRINT("wsrep",("sending KILL_QUERY to: %ld",
DBUG_PRINT("wsrep",("sending KILL_QUERY to: %lu",
thd_get_thread_id(thd)));
WSREP_DEBUG("kill query for: %ld",
thd_get_thread_id(thd));
Expand Down Expand Up @@ -19841,7 +19841,8 @@ wsrep_fake_trx_id(
mutex_enter(&trx_sys->mutex);
trx_id_t trx_id = trx_sys_get_new_trx_id();
mutex_exit(&trx_sys->mutex);
WSREP_DEBUG("innodb fake trx id: %lu thd: %s", trx_id, wsrep_thd_query(thd));
WSREP_DEBUG("innodb fake trx id: " TRX_ID_FMT " thd: %s",
trx_id, wsrep_thd_query(thd));
wsrep_ws_handle_for_trx(wsrep_thd_ws_handle(thd), trx_id);
}

Expand Down
2 changes: 2 additions & 0 deletions storage/xtradb/lock/lock0lock.cc
Expand Up @@ -2141,6 +2141,7 @@ lock_rec_insert_by_trx_age(
return DB_SUCCESS;
}

#ifdef UNIV_DEBUG
static
bool
lock_queue_validate(
Expand Down Expand Up @@ -2174,6 +2175,7 @@ lock_queue_validate(
}
return true;
}
#endif /* UNIV_DEBUG */

static
void
Expand Down

0 comments on commit 7c85a8d

Please sign in to comment.