summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/huge_frm-6224.result2
-rw-r--r--mysql-test/r/range_innodb.result24
-rw-r--r--mysql-test/suite/innodb/r/innodb_28867993.result9
-rw-r--r--mysql-test/suite/innodb/t/innodb_28867993.test12
-rw-r--r--mysql-test/t/huge_frm-6224.test11
-rw-r--r--mysql-test/t/range_innodb.test25
-rw-r--r--sql/opt_range.cc3
-rw-r--r--sql/unireg.h2
-rw-r--r--storage/innobase/fil/fil0fil.cc15
-rw-r--r--storage/innobase/srv/srv0start.cc4
-rw-r--r--storage/xtradb/fil/fil0fil.cc16
-rw-r--r--storage/xtradb/srv/srv0start.cc3
12 files changed, 107 insertions, 19 deletions
diff --git a/mysql-test/r/huge_frm-6224.result b/mysql-test/r/huge_frm-6224.result
index 3772317c04d..0d6dd968295 100644
--- a/mysql-test/r/huge_frm-6224.result
+++ b/mysql-test/r/huge_frm-6224.result
@@ -1 +1,3 @@
+set global max_allowed_packet=1024*1024*10;
ERROR HY000: The definition for table `t1` is too big
+set global max_allowed_packet=default;
diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result
index 8bb1c833a56..6572b248911 100644
--- a/mysql-test/r/range_innodb.result
+++ b/mysql-test/r/range_innodb.result
@@ -55,3 +55,27 @@ pk f1 f2 f3 pk f1 f2 f3 f4 f5
2 6 v NULL 14 1 q NULL 4 q
3 7 c NULL 14 1 q NULL 4 q
drop table t1,t2;
+#
+# MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND'
+# failed in handler::ha_rnd_end upon SELECT from partitioned table
+#
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='index_merge_sort_intersection=off';
+create table t0 (a int)engine=innodb;
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (
+a int, b int, c int,
+key(a),key(b),key(c)
+)engine=innodb;
+insert into t1
+select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a
+from t0 A, t0 B, t0 C, t0 D where D.a<5;
+set @@global.debug_dbug="+d,ha_index_init_fail";
+explain select * from t1 where a=10 and b=10;
+id select_type table type possible_keys key key_len ref rows Extra
+1 SIMPLE t1 index_merge a,b a,b 5,5 NULL 1 Using intersect(a,b); Using where
+select * from t1 where a=10 and b=10;
+ERROR HY000: Table definition has changed, please retry transaction
+DROP TABLE t0,t1;
+set @@global.debug_dbug="-d";
+set @@optimizer_switch= @optimizer_switch_save;
diff --git a/mysql-test/suite/innodb/r/innodb_28867993.result b/mysql-test/suite/innodb/r/innodb_28867993.result
new file mode 100644
index 00000000000..acc6734eaee
--- /dev/null
+++ b/mysql-test/suite/innodb/r/innodb_28867993.result
@@ -0,0 +1,9 @@
+create table t1 (a int) engine=innodb;
+insert t1 values (1),(2);
+create database ib_logfile2;
+select * from t1;
+a
+1
+2
+drop table t1;
+drop database ib_logfile2;
diff --git a/mysql-test/suite/innodb/t/innodb_28867993.test b/mysql-test/suite/innodb/t/innodb_28867993.test
new file mode 100644
index 00000000000..61e9578df7b
--- /dev/null
+++ b/mysql-test/suite/innodb/t/innodb_28867993.test
@@ -0,0 +1,12 @@
+#
+# Bug#28867993: POSSIBLE ISSUE WITH MYSQL SERVER RESTART
+#
+
+source include/have_innodb.inc;
+create table t1 (a int) engine=innodb;
+insert t1 values (1),(2);
+create database ib_logfile2;
+source include/restart_mysqld.inc;
+select * from t1;
+drop table t1;
+drop database ib_logfile2;
diff --git a/mysql-test/t/huge_frm-6224.test b/mysql-test/t/huge_frm-6224.test
index 418722a7b51..322abd01738 100644
--- a/mysql-test/t/huge_frm-6224.test
+++ b/mysql-test/t/huge_frm-6224.test
@@ -4,17 +4,24 @@
# verify that huge frms are rejected during creation, not on opening
#
--source include/have_partition.inc
+set global max_allowed_packet=1024*1024*10;
+connect con1,localhost,root;
-let $n=5646;
+let $n=8164;
let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (;
dec $n;
while ($n)
{
- let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,;
+ let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n COMMENT 'partition p01234567890123456789012345678901234567890123456789012345678$n',;
dec $n;
}
--disable_query_log
--error ER_TABLE_DEFINITION_TOO_BIG
eval $a partition foo);
+--enable_query_log
+
+connection default;
+disconnect con1;
+set global max_allowed_packet=default;
diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test
index 605006587cc..a17ef3f1146 100644
--- a/mysql-test/t/range_innodb.test
+++ b/mysql-test/t/range_innodb.test
@@ -3,6 +3,7 @@
--echo #
--source include/have_innodb.inc
+--source include/have_debug.inc
--disable_warnings
drop table if exists t0, t1, t2;
@@ -62,3 +63,27 @@ INSERT INTO t2 VALUES (4,'q'),(NULL,'j');
SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2
WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 );
drop table t1,t2;
+
+--echo #
+--echo # MDEV-14440: Server crash in in handler::ha_external_lock or Assertion `inited==RND'
+--echo # failed in handler::ha_rnd_end upon SELECT from partitioned table
+--echo #
+
+set @optimizer_switch_save= @@optimizer_switch;
+set optimizer_switch='index_merge_sort_intersection=off';
+create table t0 (a int)engine=innodb;
+insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
+create table t1 (
+ a int, b int, c int,
+ key(a),key(b),key(c)
+)engine=innodb;
+insert into t1
+select A.a+10*B.a, A.a+10*B.a, A.a+10*B.a+100*C.a
+from t0 A, t0 B, t0 C, t0 D where D.a<5;
+set @@global.debug_dbug="+d,ha_index_init_fail";
+explain select * from t1 where a=10 and b=10;
+--error ER_TABLE_DEF_CHANGED
+select * from t1 where a=10 and b=10;
+DROP TABLE t0,t1;
+set @@global.debug_dbug="-d";
+set @@optimizer_switch= @optimizer_switch_save;
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 072f607fb51..46b10b559b2 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -1569,6 +1569,7 @@ failure:
head->column_bitmaps_set(save_read_set, save_write_set);
delete file;
file= save_file;
+ free_file= false;
DBUG_RETURN(1);
}
@@ -6557,6 +6558,8 @@ TRP_ROR_INTERSECT *get_best_ror_intersect(const PARAM *param, SEL_TREE *tree,
if (ror_intersect_add(intersect, cpk_scan, TRUE) &&
(intersect->total_cost < min_cost))
intersect_best= intersect; //just set pointer here
+ else
+ cpk_scan= 0; // Don't use cpk_scan
}
else
cpk_scan= 0; // Don't use cpk_scan
diff --git a/sql/unireg.h b/sql/unireg.h
index e1947d8d3cd..86d88fcdc21 100644
--- a/sql/unireg.h
+++ b/sql/unireg.h
@@ -203,7 +203,7 @@ LEX_CUSTRING build_frm_image(THD *thd, const char *table,
#define FRM_HEADER_SIZE 64
#define FRM_FORMINFO_SIZE 288
-#define FRM_MAX_SIZE (512*1024)
+#define FRM_MAX_SIZE (1024*1024)
static inline bool is_binary_frm_header(uchar *head)
{
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 5891db62758..31178b67a06 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2018, MariaDB Corporation.
+Copyright (c) 2014, 2019, MariaDB Corporation.
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
@@ -838,10 +838,9 @@ fil_try_to_close_file_in_LRU(
}
/** Flush any writes cached by the file system.
-@param[in,out] space tablespace */
-static
-void
-fil_flush_low(fil_space_t* space)
+@param[in,out] space tablespace
+@param[in] metadata whether to update file system metadata */
+static void fil_flush_low(fil_space_t* space, bool metadata = false)
{
ut_ad(mutex_own(&fil_system->mutex));
ut_ad(space);
@@ -865,7 +864,7 @@ fil_flush_low(fil_space_t* space)
}
#endif /* UNIV_DEBUG */
- return;
+ if (!metadata) return;
}
/* Prevent dropping of the space while we are flushing */
@@ -1030,12 +1029,12 @@ fil_space_extend_must_retry(
*success = os_file_set_size(node->name, node->handle, new_size,
FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags));
-
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
*success = FALSE;
os_has_said_disk_full = TRUE;);
if (*success) {
+ os_file_flush(node->handle);
os_has_said_disk_full = FALSE;
start_page_no = size;
}
@@ -1063,7 +1062,7 @@ fil_space_extend_must_retry(
= (node->size / pages_per_mb) * pages_per_mb;
}
- fil_flush_low(space);
+ fil_flush_low(space, true);
return(false);
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index db52e31881c..4ce3ea6672d 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -2312,6 +2312,10 @@ innobase_start_or_create_for_mysql()
break;
}
+ if (stat_info.type != OS_FILE_TYPE_FILE) {
+ break;
+ }
+
if (!srv_file_check_mode(logfilename)) {
return(DB_ERROR);
}
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index a8835083165..d6d2a6f887c 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2014, 2018, MariaDB Corporation.
+Copyright (c) 2014, 2019, MariaDB Corporation.
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
@@ -846,10 +846,9 @@ fil_try_to_close_file_in_LRU(
}
/** Flush any writes cached by the file system.
-@param[in,out] space tablespace */
-static
-void
-fil_flush_low(fil_space_t* space)
+@param[in,out] space tablespace
+@param[in] metadata whether to update file system metadata */
+static void fil_flush_low(fil_space_t* space, bool metadata = false)
{
ut_ad(mutex_own(&fil_system->mutex));
ut_ad(space);
@@ -873,7 +872,7 @@ fil_flush_low(fil_space_t* space)
}
#endif /* UNIV_DEBUG */
- return;
+ if (!metadata) return;
}
/* Prevent dropping of the space while we are flushing */
@@ -1037,15 +1036,16 @@ fil_space_extend_must_retry(
*success = os_file_set_size(node->name, node->handle, new_size,
FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags));
-
DBUG_EXECUTE_IF("ib_os_aio_func_io_failure_28",
*success = FALSE;
os_has_said_disk_full = TRUE;);
if (*success) {
+ os_file_flush(node->handle);
os_has_said_disk_full = FALSE;
start_page_no = size;
}
+
mutex_enter(&fil_system->mutex);
ut_a(node->being_extended);
@@ -1069,7 +1069,7 @@ fil_space_extend_must_retry(
= (node->size / pages_per_mb) * pages_per_mb;
}
- fil_flush_low(space);
+ fil_flush_low(space, true);
return(false);
}
diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
index 75b664a0558..2553d405a19 100644
--- a/storage/xtradb/srv/srv0start.cc
+++ b/storage/xtradb/srv/srv0start.cc
@@ -2408,6 +2408,9 @@ innobase_start_or_create_for_mysql()
break;
}
+ if (stat_info.type != OS_FILE_TYPE_FILE) {
+ break;
+ }
if (!srv_file_check_mode(logfilename)) {
return(DB_ERROR);
}