summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2019-03-08 00:26:55 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2019-03-08 00:26:55 +0200
commit2d0dd62cf7e824f5bbc8d0367730adcdaf0eed68 (patch)
tree804b14fb55650c3af866d8bc19048594569e7f98
parentd30f17af4969cc1ce34f1925f5ea2bced9c6f7e9 (diff)
parentbf71d263621c90cbddc7bde9bf071dae503f333f (diff)
downloadmariadb-git-2d0dd62cf7e824f5bbc8d0367730adcdaf0eed68.tar.gz
Merge 10.2 into 10.3
-rw-r--r--client/mysqladmin.cc2
-rw-r--r--dbug/tests.c8
-rw-r--r--include/my_pthread.h4
-rw-r--r--mysql-test/main/derived_cond_pushdown.result21
-rw-r--r--mysql-test/main/derived_cond_pushdown.test22
-rw-r--r--mysql-test/main/mysqld--help.test2
-rw-r--r--mysql-test/suite/innodb/r/alter_crash.result3
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result77
-rw-r--r--mysql-test/suite/innodb/t/alter_crash.test6
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test51
-rw-r--r--mysql-test/suite/sys_vars/inc/sysvars_server.inc2
-rw-r--r--mysql-test/suite/sys_vars/t/thread_stack_basic.test10
-rw-r--r--sql/item_cmpfunc.cc17
-rw-r--r--sql/item_cmpfunc.h1
-rw-r--r--storage/innobase/dict/dict0dict.cc11
-rw-r--r--storage/innobase/handler/handler0alter.cc45
-rw-r--r--storage/innobase/include/dict0dict.h20
-rw-r--r--storage/innobase/row/row0mysql.cc11
-rw-r--r--storage/mroonga/ha_mroonga.cpp4
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result3
-rw-r--r--storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test5
-rw-r--r--tests/mysql_client_test.c4
22 files changed, 261 insertions, 68 deletions
diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc
index 5e7fb80b2b5..b5e54be899a 100644
--- a/client/mysqladmin.cc
+++ b/client/mysqladmin.cc
@@ -318,7 +318,6 @@ int main(int argc,char *argv[])
char **commands, **save_argv, **temp_argv;
MY_INIT(argv[0]);
- mysql_init(&mysql);
sf_leaking_memory=1; /* don't report memory leaks on early exits */
load_defaults_or_exit("my", load_default_groups, &argc, &argv);
save_argv = argv; /* Save for free_defaults */
@@ -347,6 +346,7 @@ int main(int argc,char *argv[])
sf_leaking_memory=0; /* from now on we cleanup properly */
+ mysql_init(&mysql);
if (opt_compress)
mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS);
if (opt_connect_timeout)
diff --git a/dbug/tests.c b/dbug/tests.c
index 22a445fdeca..70424046bf4 100644
--- a/dbug/tests.c
+++ b/dbug/tests.c
@@ -86,3 +86,11 @@ int main (int argc __attribute__((unused)),
return 0;
#endif /* DBUG_OFF */
}
+
+#ifdef __SANITIZE_ADDRESS__
+/* Disable LeakSanitizer in this executable */
+const char* __asan_default_options()
+{
+ return "detect_leaks=0";
+}
+#endif
diff --git a/include/my_pthread.h b/include/my_pthread.h
index 2712c7d8ffd..302d4e95cea 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -691,8 +691,12 @@ extern void my_mutex_end(void);
We need to have at least 256K stack to handle calls to myisamchk_init()
with the current number of keys and key parts.
*/
+#ifdef __SANITIZE_ADDRESS__
+#define DEFAULT_THREAD_STACK (364*1024L)
+#else
#define DEFAULT_THREAD_STACK (292*1024L)
#endif
+#endif
#define MY_PTHREAD_LOCK_READ 0
#define MY_PTHREAD_LOCK_WRITE 1
diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result
index ff6d94ab858..8086c4480f6 100644
--- a/mysql-test/main/derived_cond_pushdown.result
+++ b/mysql-test/main/derived_cond_pushdown.result
@@ -10496,6 +10496,27 @@ EXPLAIN
}
DROP VIEW v1,v2;
DROP TABLE t1;
+#
+# MDEV-18383: pushdown condition with the IF structure
+# defined with Item_cond item
+#
+CREATE TABLE t1(a INT, b INT);
+CREATE TABLE t2(c INT, d INT);
+INSERT INTO t1 VALUES (1,2),(3,4),(5,6);
+INSERT INTO t2 VALUES (1,3),(3,7),(5,1);
+SELECT *
+FROM t1,
+(
+SELECT MAX(d) AS max_d,c
+FROM t2
+GROUP BY c
+) AS tab
+WHERE t1.a=tab.c AND
+IF(2,t1.a=1 OR t1.b>5,1=1);
+a b max_d c
+1 2 3 1
+5 6 1 5
+DROP TABLE t1,t2;
# End of 10.2 tests
#
# MDEV-14579: pushdown conditions into materialized views/derived tables
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index 076d39c1abd..c6c8c26271f 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -2102,6 +2102,28 @@ eval EXPLAIN FORMAT=JSON $q2;
DROP VIEW v1,v2;
DROP TABLE t1;
+--echo #
+--echo # MDEV-18383: pushdown condition with the IF structure
+--echo # defined with Item_cond item
+--echo #
+
+CREATE TABLE t1(a INT, b INT);
+CREATE TABLE t2(c INT, d INT);
+INSERT INTO t1 VALUES (1,2),(3,4),(5,6);
+INSERT INTO t2 VALUES (1,3),(3,7),(5,1);
+
+SELECT *
+FROM t1,
+(
+ SELECT MAX(d) AS max_d,c
+ FROM t2
+ GROUP BY c
+) AS tab
+WHERE t1.a=tab.c AND
+ IF(2,t1.a=1 OR t1.b>5,1=1);
+
+DROP TABLE t1,t2;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test
index 27d3286685b..68ee2f087ab 100644
--- a/mysql-test/main/mysqld--help.test
+++ b/mysql-test/main/mysqld--help.test
@@ -57,7 +57,7 @@ perl;
# fixes for 32-bit
s/\b4294967295\b/18446744073709551615/;
s/\b2146435072\b/9223372036853727232/;
- s/\b196608\b/262144/;
+ s/\b372736\b/299008/;
s/\b4294963200\b/18446744073709547520/;
foreach $var (@env) { s/\Q$ENV{$var}\E/$var/ }
next if /use --skip-(use-)?symbolic-links to disable/; # for valgrind, again
diff --git a/mysql-test/suite/innodb/r/alter_crash.result b/mysql-test/suite/innodb/r/alter_crash.result
index 3c3aaa68b6a..cb9c17e45ea 100644
--- a/mysql-test/suite/innodb/r/alter_crash.result
+++ b/mysql-test/suite/innodb/r/alter_crash.result
@@ -3,6 +3,9 @@
#
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB;
SET @saved_debug_dbug = @@SESSION.debug_dbug;
+SET DEBUG_DBUG='+d,create_index_metadata_fail';
+ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
+ERROR HY000: The table 't1' is full
SET DEBUG_DBUG='+d,ib_create_table_fail_too_many_trx';
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
ERROR HY000: Too many active concurrent transactions
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index a6322284923..75197099c11 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -137,6 +137,8 @@ SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
unique_constraint_name
PRIMARY
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
unique_constraint_name
@@ -194,17 +196,19 @@ DROP DATABASE best;
#
# MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
#
-connect fk, localhost, root,,;
+connect con1, localhost, root,,;
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
connection default;
INSERT INTO t3 SET a=1;
-connection fk;
+connection con1;
kill query @id;
connection default;
ERROR 70100: Query execution was interrupted
-disconnect fk;
+connection con1;
+ROLLBACK;
+connection default;
DROP TABLE t3,t1;
#
# MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
@@ -298,7 +302,7 @@ INSERT INTO matchmaking_group_users VALUES (10,1),(11,2);
INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
BEGIN;
UPDATE users SET name = 'qux' WHERE id = 1;
-connect con1,localhost,root,,;
+connection con1;
SET innodb_lock_wait_timeout= 1;
DELETE FROM matchmaking_groups WHERE id = 10;
connection default;
@@ -443,6 +447,69 @@ connection con1;
kill query @id;
connection default;
ERROR 70100: Query execution was interrupted
-disconnect con1;
+connection con1;
+ROLLBACK;
+connection default;
DROP TABLE t2,t1;
+#
+# MDEV-18272 InnoDB index corruption after failed DELETE CASCADE
+#
+CREATE TABLE t1 (
+pk TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+a TINYINT UNSIGNED NOT NULL, b TINYINT UNSIGNED NOT NULL, KEY(b),
+CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE
+) ENGINE=InnoDB;
+INSERT INTO t1 (a,b) VALUES
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,1),(0,1),(1,0);
+connection con1;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+connection default;
+DELETE IGNORE FROM t1 WHERE b = 1;
+Warnings:
+Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 20. Please drop extra constraints and try again
+Warning 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB
+Warning 152 InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 20. Please drop extra constraints and try again
+Warning 1296 Got error 193 '`test`.`t1`, CONSTRAINT `t1_ibfk_1` FOREIGN KEY (`a`) REFERENCES `t1` (`b`) ON DELETE CASCADE' from InnoDB
+SELECT a FROM t1 FORCE INDEX(a);
+a
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+0
+1
+SELECT * FROM t1;
+pk a b
+1 0 0
+2 0 0
+3 0 0
+4 0 0
+5 0 0
+6 0 0
+7 0 0
+8 0 0
+9 0 0
+10 0 0
+11 0 0
+12 0 0
+13 0 1
+14 0 1
+15 1 0
+disconnect con1;
+InnoDB 0 transactions not purged
+CHECK TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 check status OK
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
# End of 10.2 tests
diff --git a/mysql-test/suite/innodb/t/alter_crash.test b/mysql-test/suite/innodb/t/alter_crash.test
index 101e0fa44c2..c7cd1bcfe66 100644
--- a/mysql-test/suite/innodb/t/alter_crash.test
+++ b/mysql-test/suite/innodb/t/alter_crash.test
@@ -7,8 +7,6 @@
--source include/not_crashrep.inc
--disable_query_log
-call mtr.add_suppression('InnoDB: cannot find a free slot for an undo log');
-call mtr.add_suppression('InnoDB: row_merge_rename_index_to_add failed with error 47');
call mtr.add_suppression('InnoDB: Flagged corruption of `c[23]`');
call mtr.add_suppression('InnoDB: Index `c[23]` .*is corrupted');
--enable_query_log
@@ -19,6 +17,10 @@ call mtr.add_suppression('InnoDB: Index `c[23]` .*is corrupted');
CREATE TABLE t1(c1 INT PRIMARY KEY, c2 CHAR(1), c3 INT UNSIGNED) ENGINE=InnoDB;
SET @saved_debug_dbug = @@SESSION.debug_dbug;
+SET DEBUG_DBUG='+d,create_index_metadata_fail';
+--error ER_RECORD_FILE_FULL
+ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
+
SET DEBUG_DBUG='+d,ib_create_table_fail_too_many_trx';
--error ER_TOO_MANY_CONCURRENT_TRXS
ALTER TABLE t1 ADD INDEX (c2), ADD INDEX (c3);
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 4330f807d69..a4e045d4d5e 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -103,6 +103,9 @@ WHERE table_name = 't2';
--source include/restart_mysqld.inc
+SET @saved_frequency = @@GLOBAL.innodb_purge_rseg_truncate_frequency;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = 1;
+
SELECT unique_constraint_name FROM information_schema.referential_constraints
WHERE table_name = 't2';
@@ -148,6 +151,7 @@ SET FOREIGN_KEY_CHECKS=1;
call mtr.add_suppression("InnoDB: Possible reasons:");
call mtr.add_suppression("InnoDB: \\([12]\\) Table ");
call mtr.add_suppression("InnoDB: If table `test`\\.`t2` is a temporary table");
+call mtr.add_suppression("InnoDB: Cannot delete/update rows with cascading foreign key constraints that exceed max depth of 15\\.");
--enable_query_log
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
@@ -165,7 +169,7 @@ DROP DATABASE best;
--echo #
--echo # MDEV-17541 KILL QUERY during lock wait in FOREIGN KEY check hangs
--echo #
-connect (fk, localhost, root,,);
+connect (con1, localhost, root,,);
INSERT INTO t1 SET a=1;
BEGIN;
DELETE FROM t1;
@@ -174,7 +178,7 @@ connection default;
let $ID= `SELECT @id := CONNECTION_ID()`;
send INSERT INTO t3 SET a=1;
-connection fk;
+connection con1;
# Check that the above SELECT is blocked
let $wait_condition=
select count(*) = 1 from information_schema.processlist
@@ -186,7 +190,10 @@ kill query @id;
connection default;
--error ER_QUERY_INTERRUPTED
reap;
-disconnect fk;
+
+connection con1;
+ROLLBACK;
+connection default;
DROP TABLE t3,t1;
@@ -286,7 +293,7 @@ INSERT INTO matchmaking_group_maps VALUES (10,55),(11,66);
BEGIN;
UPDATE users SET name = 'qux' WHERE id = 1;
---connect (con1,localhost,root,,)
+--connection con1
SET innodb_lock_wait_timeout= 1;
DELETE FROM matchmaking_groups WHERE id = 10;
@@ -442,10 +449,44 @@ kill query @id;
connection default;
--error ER_QUERY_INTERRUPTED
reap;
-disconnect con1;
+
+connection con1;
+ROLLBACK;
+connection default;
DROP TABLE t2,t1;
+--echo #
+--echo # MDEV-18272 InnoDB index corruption after failed DELETE CASCADE
+--echo #
+CREATE TABLE t1 (
+ pk TINYINT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
+ a TINYINT UNSIGNED NOT NULL, b TINYINT UNSIGNED NOT NULL, KEY(b),
+ CONSTRAINT FOREIGN KEY (a) REFERENCES t1 (b) ON DELETE CASCADE
+) ENGINE=InnoDB;
+
+INSERT INTO t1 (a,b) VALUES
+(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),(0,0),
+(0,1),(0,1),(1,0);
+connection con1;
+START TRANSACTION WITH CONSISTENT SNAPSHOT;
+
+connection default;
+DELETE IGNORE FROM t1 WHERE b = 1;
+
+SELECT a FROM t1 FORCE INDEX(a);
+# This would wrongly return the empty result if
+# the "goto rollback_to_savept" in row_mysql_handle_errors() is reverted.
+SELECT * FROM t1;
+# Allow purge to continue by closing the read view.
+disconnect con1;
+
+# Wait for purge. With the fix reverted, the server would crash here.
+--source include/wait_all_purged.inc
+CHECK TABLE t1;
+DROP TABLE t1;
+SET GLOBAL innodb_purge_rseg_truncate_frequency = @saved_frequency;
+
--echo # End of 10.2 tests
--source include/wait_until_count_sessions.inc
diff --git a/mysql-test/suite/sys_vars/inc/sysvars_server.inc b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
index d14e905378c..1e504837587 100644
--- a/mysql-test/suite/sys_vars/inc/sysvars_server.inc
+++ b/mysql-test/suite/sys_vars/inc/sysvars_server.inc
@@ -13,7 +13,7 @@ set sql_mode=ansi_quotes;
set global div_precision_increment=5;
--replace_regex /^\/\S+/PATH/
---replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_result $MASTER_MYPORT MASTER_MYPORT 372736 299008
select * from information_schema.system_variables
where variable_name not like 'aria%' and
variable_name not like 'debug%' and
diff --git a/mysql-test/suite/sys_vars/t/thread_stack_basic.test b/mysql-test/suite/sys_vars/t/thread_stack_basic.test
index 2d4d144572d..bfd3fb40db3 100644
--- a/mysql-test/suite/sys_vars/t/thread_stack_basic.test
+++ b/mysql-test/suite/sys_vars/t/thread_stack_basic.test
@@ -1,17 +1,17 @@
#
# only global
#
---replace_result 196608 262144
+--replace_result 372736 299008
select @@global.thread_stack;
--error ER_INCORRECT_GLOBAL_LOCAL_VAR
select @@session.thread_stack;
---replace_result 196608 262144
+--replace_result 372736 299008
show global variables like 'thread_stack';
---replace_result 196608 262144
+--replace_result 372736 299008
show session variables like 'thread_stack';
---replace_result 196608 262144
+--replace_result 372736 299008
select * from information_schema.global_variables where variable_name='thread_stack';
---replace_result 196608 262144
+--replace_result 372736 299008
select * from information_schema.session_variables where variable_name='thread_stack';
#
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index b1f7e54546a..b2fa753f2bd 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4984,6 +4984,23 @@ Item *Item_cond::build_clone(THD *thd)
}
+bool Item_cond::excl_dep_on_table(table_map tab_map)
+{
+ if (used_tables() & OUTER_REF_TABLE_BIT)
+ return false;
+ if (!(used_tables() & ~tab_map))
+ return true;
+ List_iterator_fast<Item> li(list);
+ Item *item;
+ while ((item= li++))
+ {
+ if (!item->excl_dep_on_table(tab_map))
+ return false;
+ }
+ return true;
+}
+
+
bool Item_cond::excl_dep_on_grouping_fields(st_select_lex *sel)
{
List_iterator_fast<Item> li(list);
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 60b56090a23..4a1202837f4 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -2954,6 +2954,7 @@ public:
Item_transformer transformer, uchar *arg_t);
bool eval_not_null_tables(void *opt_arg);
Item *build_clone(THD *thd);
+ bool excl_dep_on_table(table_map tab_map);
bool excl_dep_on_grouping_fields(st_select_lex *sel);
};
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 39e66057ac3..35de10f3f14 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -6082,23 +6082,16 @@ dict_ind_free()
/** Get an index by name.
@param[in] table the table where to look for the index
@param[in] name the index name to look for
-@param[in] committed true=search for committed,
-false=search for uncommitted
@return index, NULL if does not exist */
dict_index_t*
-dict_table_get_index_on_name(
- dict_table_t* table,
- const char* name,
- bool committed)
+dict_table_get_index_on_name(dict_table_t* table, const char* name)
{
dict_index_t* index;
index = dict_table_get_first_index(table);
while (index != NULL) {
- if (index->is_committed() == committed
- && strcmp(index->name, name) == 0) {
-
+ if (index->is_committed() && !strcmp(index->name, name)) {
return(index);
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 98c94b65c7b..84f0857dcb7 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -4820,11 +4820,13 @@ create_index_dict(
que_run_threads(thr);
+ DBUG_ASSERT(trx->error_state != DB_SUCCESS || index != node->index);
+ DBUG_ASSERT(trx->error_state != DB_SUCCESS || node->index);
index = node->index;
que_graph_free((que_t*) que_node_get_parent(thr));
- DBUG_RETURN(trx->error_state == DB_SUCCESS ? index : NULL);
+ DBUG_RETURN(index);
}
/** Update internal structures with concurrent writes blocked,
@@ -5551,18 +5553,23 @@ new_table_failed:
}
for (ulint a = 0; a < ctx->num_to_add_index; a++) {
- dict_index_t*& index = ctx->add_index[a];
+ dict_index_t* index = ctx->add_index[a];
const bool has_new_v_col = index->has_new_v_col;
index = create_index_dict(ctx->trx, index, add_v);
- if (!index) {
- error = ctx->trx->error_state;
- ut_ad(error != DB_SUCCESS);
+ error = ctx->trx->error_state;
+ if (error != DB_SUCCESS) {
+ if (index) {
+ dict_mem_index_free(index);
+ }
while (++a < ctx->num_to_add_index) {
dict_mem_index_free(ctx->add_index[a]);
}
goto error_handling;
+ } else {
+ DBUG_ASSERT(index != ctx->add_index[a]);
}
+ ctx->add_index[a] = index;
index->parser = index_defs[a].parser;
index->has_new_v_col = has_new_v_col;
/* Note the id of the transaction that created this
@@ -5636,15 +5643,31 @@ new_table_failed:
for (ulint a = 0; a < ctx->num_to_add_index; a++) {
dict_index_t* index = ctx->add_index[a];
const bool has_new_v_col = index->has_new_v_col;
+ DBUG_EXECUTE_IF(
+ "create_index_metadata_fail",
+ if (a + 1 == ctx->num_to_add_index) {
+ ctx->trx->error_state =
+ DB_OUT_OF_FILE_SPACE;
+ goto index_created;
+ });
index = create_index_dict(ctx->trx, index, add_v);
- if (!index) {
- error = ctx->trx->error_state;
- ut_ad(error != DB_SUCCESS);
+#ifndef DBUG_OFF
+index_created:
+#endif
+ error = ctx->trx->error_state;
+ if (error != DB_SUCCESS) {
+ if (index) {
+ dict_mem_index_free(index);
+ }
+ a++;
error_handling_drop_uncached:
- do {
- dict_mem_index_free(ctx->add_index[a]);
- } while (++a < ctx->num_to_add_index);
+ while (a < ctx->num_to_add_index) {
+ dict_mem_index_free(
+ ctx->add_index[a++]);
+ }
goto error_handling;
+ } else {
+ DBUG_ASSERT(index != ctx->add_index[a]);
}
ctx->add_index[a]= index;
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index bf9fcd70f18..1223fa5df91 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -2,7 +2,7 @@
Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 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
@@ -1529,31 +1529,21 @@ dict_tables_have_same_db(
/** Get an index by name.
@param[in] table the table where to look for the index
@param[in] name the index name to look for
-@param[in] committed true=search for committed,
-false=search for uncommitted
@return index, NULL if does not exist */
dict_index_t*
-dict_table_get_index_on_name(
- dict_table_t* table,
- const char* name,
- bool committed=true)
+dict_table_get_index_on_name(dict_table_t* table, const char* name)
MY_ATTRIBUTE((warn_unused_result));
/** Get an index by name.
@param[in] table the table where to look for the index
@param[in] name the index name to look for
-@param[in] committed true=search for committed,
-false=search for uncommitted
@return index, NULL if does not exist */
inline
const dict_index_t*
-dict_table_get_index_on_name(
- const dict_table_t* table,
- const char* name,
- bool committed=true)
+dict_table_get_index_on_name(const dict_table_t* table, const char* name)
{
- return(dict_table_get_index_on_name(
- const_cast<dict_table_t*>(table), name, committed));
+ return dict_table_get_index_on_name(const_cast<dict_table_t*>(table),
+ name);
}
/***************************************************************
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index d4d455551b3..e5bc21c21a7 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -705,8 +705,7 @@ handle_new_error:
switch (err) {
case DB_LOCK_WAIT_TIMEOUT:
if (row_rollback_on_timeout) {
- trx_rollback_to_savepoint(trx, NULL);
- break;
+ goto rollback;
}
/* fall through */
case DB_DUPLICATE_KEY:
@@ -725,6 +724,7 @@ handle_new_error:
case DB_TABLE_NOT_FOUND:
case DB_DECRYPTION_FAILED:
case DB_COMPUTE_VALUE_FAILED:
+ rollback_to_savept:
DBUG_EXECUTE_IF("row_mysql_crash_if_error", {
log_buffer_flush_to_disk();
DBUG_SUICIDE(); });
@@ -751,6 +751,7 @@ handle_new_error:
case DB_DEADLOCK:
case DB_LOCK_TABLE_FULL:
+ rollback:
/* Roll back the whole transaction; this resolution was added
to version 3.23.43 */
@@ -772,19 +773,19 @@ handle_new_error:
" tablespace. If the mysqld server crashes after"
" the startup or when you dump the tables. "
<< FORCE_RECOVERY_MSG;
- break;
+ goto rollback_to_savept;
case DB_FOREIGN_EXCEED_MAX_CASCADE:
ib::error() << "Cannot delete/update rows with cascading"
" foreign key constraints that exceed max depth of "
<< FK_MAX_CASCADE_DEL << ". Please drop excessive"
" foreign constraints and try again";
- break;
+ goto rollback_to_savept;
case DB_UNSUPPORTED:
ib::error() << "Cannot delete/update rows with cascading"
" foreign key constraints in timestamp-based temporal"
" table. Please drop excessive"
" foreign constraints and try again";
- break;
+ goto rollback_to_savept;
default:
ib::fatal() << "Unknown error code " << err << ": "
<< ut_strerr(err);
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index a80776fe5f5..a3f34f3cc42 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -2600,7 +2600,7 @@ ha_mroonga::~ha_mroonga()
}
if (blob_buffers)
{
- delete [] blob_buffers;
+ ::delete [] blob_buffers;
}
grn_obj_unlink(ctx, &top_left_point);
grn_obj_unlink(ctx, &bottom_right_point);
@@ -14539,6 +14539,7 @@ enum_alter_inplace_result ha_mroonga::wrapper_check_if_supported_inplace_alter(
ALTER_COLUMN_NULLABLE |
ALTER_COLUMN_NOT_NULLABLE |
ALTER_COLUMN_STORAGE_TYPE |
+ ALTER_ADD_STORED_GENERATED_COLUMN |
ALTER_COLUMN_COLUMN_FORMAT
)
)
@@ -14657,7 +14658,6 @@ enum_alter_inplace_result ha_mroonga::storage_check_if_supported_inplace_alter(
ALTER_DROP_UNIQUE_INDEX |
MRN_ALTER_INPLACE_INFO_ADD_VIRTUAL_COLUMN |
MRN_ALTER_INPLACE_INFO_ADD_STORED_BASE_COLUMN |
- MRN_ALTER_INPLACE_INFO_ADD_STORED_GENERATED_COLUMN |
ALTER_DROP_COLUMN |
ALTER_COLUMN_NAME;
if (ha_alter_info->handler_flags & explicitly_unsupported_flags) {
diff --git a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result
index 20213f0cbf8..924c3134a3e 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result
+++ b/storage/mroonga/mysql-test/mroonga/storage/r/column_generated_stored_add_column.result
@@ -1,9 +1,10 @@
-DROP TABLE IF EXISTS logs;
+set names utf8mb4;
CREATE TABLE logs (
id INT,
record JSON
) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4;
INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}');
+INSERT INTO logs(id, record) VALUES (1, json_object('message', repeat('☹', 253)));
ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED;
ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"';
INSERT INTO logs(id, record) VALUES (2, '{"level": "info", "message": "restart"}');
diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test
index 8561688db3a..deae021d540 100644
--- a/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test
+++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_generated_stored_add_column.test
@@ -18,9 +18,7 @@
--source ../../include/mroonga/skip_mariadb_10_1_or_earlier.inc
--source ../../include/mroonga/have_mroonga.inc
---disable_warnings
-DROP TABLE IF EXISTS logs;
---enable_warnings
+set names utf8mb4;
CREATE TABLE logs (
id INT,
@@ -28,6 +26,7 @@ CREATE TABLE logs (
) ENGINE=Mroonga DEFAULT CHARSET=utf8mb4;
INSERT INTO logs(id, record) VALUES (1, '{"level": "info", "message": "start"}');
+INSERT INTO logs(id, record) VALUES (1, json_object('message', repeat('☹', 253)));
ALTER TABLE logs ADD COLUMN message VARCHAR(255) GENERATED ALWAYS AS (json_extract(`record`, '$.message')) STORED;
ALTER TABLE logs ADD FULLTEXT INDEX(message) comment 'tokenizer "TokenBigramSplitSymbolAlphaDigit"';
diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c
index 6c5efd72c40..a3907636001 100644
--- a/tests/mysql_client_test.c
+++ b/tests/mysql_client_test.c
@@ -18503,6 +18503,7 @@ static void test_bug42373()
DIE_UNLESS(rc == 1);
mysql_stmt_close(stmt);
+ mysql_close(&con);
/* Now try with a multi-statement. */
DIE_UNLESS(mysql_client_init(&con));
@@ -18965,8 +18966,6 @@ static void test_progress_reporting()
conn= client_connect(CLIENT_PROGRESS_OBSOLETE, MYSQL_PROTOCOL_TCP, 0);
- if (!(conn->server_capabilities & CLIENT_PROGRESS_OBSOLETE))
- return;
DIE_UNLESS(conn->client_flag & CLIENT_PROGRESS_OBSOLETE);
mysql_options(conn, MYSQL_PROGRESS_CALLBACK, (void*) report_progress);
@@ -20363,6 +20362,7 @@ static void test_bulk_delete()
DIE_IF(atoi(row[0]) != 3);
}
DIE_IF(i != 1);
+ mysql_free_result(result);
rc= mysql_query(mysql, "DROP TABLE t1");
myquery(rc);