1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-17005 add debug logs and set up deterministic test

This commit is contained in:
Nikita Malyavin
2019-07-16 00:38:53 +10:00
parent f27a00435b
commit b0b5485251
3 changed files with 58 additions and 9 deletions

View File

@ -345,3 +345,21 @@ SELECT * FROM t1;
a b c a b c
1 foo 1 1 foo 1
DROP TABLE t1; DROP TABLE t1;
CREATE TABLE t1 (a INT, b INT AS (a), KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 () VALUES (),();
connect con1,localhost,root,,test;
ALTER TABLE t1 ADD COLUMN x INT as (a), add key(x), ALGORITHM=COPY;
SET debug_sync= "ib_open_after_dict_open SIGNAL delete_open WAIT_FOR another_open";
DELETE FROM t1;
connection default;
SET debug_sync= "now WAIT_FOR delete_open";
SET debug_sync= "ib_open_after_dict_open SIGNAL another_open";
SELECT a FROM t1;
a
NULL
NULL
connection con1;
disconnect con1;
connection default;
SET debug_sync= "RESET";
DROP TABLE t1;

View File

@ -1,4 +1,5 @@
--source include/have_innodb.inc --source include/have_innodb.inc
--source include/have_debug_sync.inc
# #
# MDEV-7367: Updating a virtual column corrupts table which crashes server # MDEV-7367: Updating a virtual column corrupts table which crashes server
@ -317,3 +318,27 @@ INSERT INTO t1 (a,b) VALUES (1,'foo');
ALTER TABLE t1 ADD FULLTEXT KEY(b); ALTER TABLE t1 ADD FULLTEXT KEY(b);
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# MDEV-17005 ASAN heap-use-after-free in innobase_get_computed_value
#
CREATE TABLE t1 (a INT, b INT AS (a), KEY(b)) ENGINE=InnoDB;
INSERT INTO t1 () VALUES (),();
--connect (con1,localhost,root,,test)
ALTER TABLE t1 ADD COLUMN x INT as (a), add key(x), ALGORITHM=COPY;
SET debug_sync= "ib_open_after_dict_open SIGNAL delete_open WAIT_FOR another_open";
--send
DELETE FROM t1;
--connection default
SET debug_sync= "now WAIT_FOR delete_open";
SET debug_sync= "ib_open_after_dict_open SIGNAL another_open";
SELECT a FROM t1;
--connection con1
--reap
# Cleanup
--disconnect con1
--connection default
SET debug_sync= "RESET";
DROP TABLE t1;

View File

@ -5923,6 +5923,7 @@ innobase_build_v_templ(
ulint n_v_col = ib_table->n_v_cols; ulint n_v_col = ib_table->n_v_cols;
bool marker[REC_MAX_N_FIELDS]; bool marker[REC_MAX_N_FIELDS];
DBUG_ENTER("innobase_build_v_templ");
ut_ad(ncol < REC_MAX_N_FIELDS); ut_ad(ncol < REC_MAX_N_FIELDS);
if (add_v != NULL) { if (add_v != NULL) {
@ -5939,7 +5940,7 @@ innobase_build_v_templ(
if (!locked) { if (!locked) {
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
} }
return; DBUG_VOID_RETURN;
} }
memset(marker, 0, sizeof(bool) * ncol); memset(marker, 0, sizeof(bool) * ncol);
@ -6049,6 +6050,7 @@ innobase_build_v_templ(
s_templ->db_name = table->s->db.str; s_templ->db_name = table->s->db.str;
s_templ->tb_name = table->s->table_name.str; s_templ->tb_name = table->s->table_name.str;
DBUG_VOID_RETURN;
} }
/** Check consistency between .frm indexes and InnoDB indexes. /** Check consistency between .frm indexes and InnoDB indexes.
@ -6247,6 +6249,8 @@ ha_innobase::open(const char* name, int, uint)
ib_table = open_dict_table(name, norm_name, is_part, ignore_err); ib_table = open_dict_table(name, norm_name, is_part, ignore_err);
DEBUG_SYNC(thd, "ib_open_after_dict_open");
if (NULL == ib_table) { if (NULL == ib_table) {
if (is_part) { if (is_part) {
@ -21614,6 +21618,7 @@ TABLE* innobase_init_vc_templ(dict_table_t* table)
if (table->vc_templ != NULL) { if (table->vc_templ != NULL) {
return NULL; return NULL;
} }
DBUG_ENTER("innobase_init_vc_templ");
table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t()); table->vc_templ = UT_NEW_NOKEY(dict_vcol_templ_t());
@ -21621,13 +21626,13 @@ TABLE* innobase_init_vc_templ(dict_table_t* table)
ut_ad(mysql_table); ut_ad(mysql_table);
if (!mysql_table) { if (!mysql_table) {
return NULL; DBUG_RETURN(NULL);
} }
mutex_enter(&dict_sys->mutex); mutex_enter(&dict_sys->mutex);
innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, true); innobase_build_v_templ(mysql_table, table, table->vc_templ, NULL, true);
mutex_exit(&dict_sys->mutex); mutex_exit(&dict_sys->mutex);
return mysql_table; DBUG_RETURN(mysql_table);
} }
/** Change dbname and table name in table->vc_templ. /** Change dbname and table name in table->vc_templ.
@ -21829,6 +21834,7 @@ innobase_get_computed_value(
ut_ad(thd != NULL); ut_ad(thd != NULL);
ut_ad(mysql_table); ut_ad(mysql_table);
DBUG_ENTER("innobase_get_computed_value");
const mysql_row_templ_t* const mysql_row_templ_t*
vctempl = index->table->vc_templ->vtempl[ vctempl = index->table->vc_templ->vtempl[
index->table->vc_templ->n_col + col->v_pos]; index->table->vc_templ->n_col + col->v_pos];
@ -21917,7 +21923,7 @@ innobase_get_computed_value(
stderr); stderr);
dtuple_print(stderr, row); dtuple_print(stderr, row);
#endif /* INNODB_VIRTUAL_DEBUG */ #endif /* INNODB_VIRTUAL_DEBUG */
return(NULL); DBUG_RETURN(NULL);
} }
if (vctempl->mysql_null_bit_mask if (vctempl->mysql_null_bit_mask
@ -21925,7 +21931,7 @@ innobase_get_computed_value(
& vctempl->mysql_null_bit_mask)) { & vctempl->mysql_null_bit_mask)) {
dfield_set_null(field); dfield_set_null(field);
field->type.prtype |= DATA_VIRTUAL; field->type.prtype |= DATA_VIRTUAL;
return(field); DBUG_RETURN(field);
} }
row_mysql_store_col_in_innobase_format( row_mysql_store_col_in_innobase_format(
@ -21957,7 +21963,7 @@ innobase_get_computed_value(
dfield_dup(field, heap); dfield_dup(field, heap);
} }
return(field); DBUG_RETURN(field);
} }