MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
Cause Stale thd->m_stmt_da->m_sql_errno which is from different invocation. Fix Reset error state before attempt to open table.
This commit is contained in:
parent
0fe212a880
commit
53dd0e4f75
30
mysql-test/suite/innodb/r/purge_secondary_mdev-16222.result
Normal file
30
mysql-test/suite/innodb/r/purge_secondary_mdev-16222.result
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#
|
||||||
|
# MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
|
||||||
|
#
|
||||||
|
set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
|
||||||
|
set global innodb_purge_rseg_truncate_frequency= 1;
|
||||||
|
set @saved_dbug= @@global.debug_dbug;
|
||||||
|
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
|
||||||
|
create table t1 (
|
||||||
|
pk serial, vb tinyblob as (b) virtual, b tinyblob,
|
||||||
|
primary key(pk), index (vb(64)))
|
||||||
|
engine innodb;
|
||||||
|
insert ignore into t1 (b) values ('foo');
|
||||||
|
select * into outfile 'load.data' from t1;
|
||||||
|
load data infile 'load.data' replace into table t1;
|
||||||
|
set debug_sync= "now WAIT_FOR latch_released";
|
||||||
|
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
|
||||||
|
drop table t1;
|
||||||
|
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
|
||||||
|
create table t1 (
|
||||||
|
pk serial, vb tinyblob as (b) virtual, b tinyblob,
|
||||||
|
primary key(pk), index (vb(64)))
|
||||||
|
engine innodb;
|
||||||
|
insert ignore into t1 (b) values ('foo');
|
||||||
|
select * into outfile 'load.data' from t1;
|
||||||
|
load data infile 'load.data' replace into table t1;
|
||||||
|
set debug_sync= "now WAIT_FOR got_no_such_table";
|
||||||
|
set global debug_dbug= @saved_dbug;
|
||||||
|
drop table t1;
|
||||||
|
set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
|
||||||
|
set debug_sync= "RESET";
|
1
mysql-test/suite/innodb/t/purge_secondary_mdev-16222.opt
Normal file
1
mysql-test/suite/innodb/t/purge_secondary_mdev-16222.opt
Normal file
@ -0,0 +1 @@
|
|||||||
|
--innodb-purge-threads=1
|
53
mysql-test/suite/innodb/t/purge_secondary_mdev-16222.test
Normal file
53
mysql-test/suite/innodb/t/purge_secondary_mdev-16222.test
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
--source include/have_debug.inc
|
||||||
|
--source include/have_innodb.inc
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-16222 Assertion `0' failed in row_purge_remove_sec_if_poss_leaf on table with virtual columns and indexes
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
--let $datadir= `select @@datadir`
|
||||||
|
set @saved_frequency= @@global.innodb_purge_rseg_truncate_frequency;
|
||||||
|
set global innodb_purge_rseg_truncate_frequency= 1;
|
||||||
|
set @saved_dbug= @@global.debug_dbug;
|
||||||
|
set global debug_dbug= "+d,ib_purge_virtual_mdev_16222_1,ib_purge_virtual_mdev_16222_2";
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
pk serial, vb tinyblob as (b) virtual, b tinyblob,
|
||||||
|
primary key(pk), index (vb(64)))
|
||||||
|
engine innodb;
|
||||||
|
|
||||||
|
insert ignore into t1 (b) values ('foo');
|
||||||
|
|
||||||
|
select * into outfile 'load.data' from t1;
|
||||||
|
load data infile 'load.data' replace into table t1;
|
||||||
|
|
||||||
|
set debug_sync= "now WAIT_FOR latch_released";
|
||||||
|
set global debug_dbug= "-d,ib_purge_virtual_mdev_16222_1";
|
||||||
|
drop table t1;
|
||||||
|
--remove_file $datadir/test/load.data
|
||||||
|
|
||||||
|
set debug_sync= "now SIGNAL drop_started WAIT_FOR got_no_such_table";
|
||||||
|
|
||||||
|
create table t1 (
|
||||||
|
pk serial, vb tinyblob as (b) virtual, b tinyblob,
|
||||||
|
primary key(pk), index (vb(64)))
|
||||||
|
engine innodb;
|
||||||
|
|
||||||
|
insert ignore into t1 (b) values ('foo');
|
||||||
|
|
||||||
|
select * into outfile 'load.data' from t1;
|
||||||
|
load data infile 'load.data' replace into table t1;
|
||||||
|
|
||||||
|
set debug_sync= "now WAIT_FOR got_no_such_table";
|
||||||
|
# FIXME: Racing condition here:
|
||||||
|
# 1. purge thread goes into sending got_no_such_table
|
||||||
|
# 2. test thread finishes debug_sync= "RESET" below
|
||||||
|
# 3. purge thread sends got_no_such_table
|
||||||
|
set global debug_dbug= @saved_dbug;
|
||||||
|
|
||||||
|
# cleanup
|
||||||
|
drop table t1;
|
||||||
|
--remove_file $datadir/test/load.data
|
||||||
|
|
||||||
|
set global innodb_purge_rseg_truncate_frequency= @saved_frequency;
|
||||||
|
set debug_sync= "RESET";
|
@ -4491,6 +4491,11 @@ unsigned long long thd_get_query_id(const MYSQL_THD thd)
|
|||||||
return((unsigned long long)thd->query_id);
|
return((unsigned long long)thd->query_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void thd_clear_error(MYSQL_THD thd)
|
||||||
|
{
|
||||||
|
thd->clear_error();
|
||||||
|
}
|
||||||
|
|
||||||
extern "C" const struct charset_info_st *thd_charset(MYSQL_THD thd)
|
extern "C" const struct charset_info_st *thd_charset(MYSQL_THD thd)
|
||||||
{
|
{
|
||||||
return(thd->charset());
|
return(thd->charset());
|
||||||
|
@ -2077,6 +2077,11 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DBUG_EXECUTE_IF("ib_purge_virtual_mdev_16222_1",
|
||||||
|
DBUG_ASSERT(!debug_sync_set_action(
|
||||||
|
thd,
|
||||||
|
STRING_WITH_LEN("now SIGNAL drop_started"))););
|
||||||
|
|
||||||
/* mark for close and remove all cached entries */
|
/* mark for close and remove all cached entries */
|
||||||
thd->push_internal_handler(&err_handler);
|
thd->push_internal_handler(&err_handler);
|
||||||
error= mysql_rm_table_no_locks(thd, tables, if_exists, drop_temporary,
|
error= mysql_rm_table_no_locks(thd, tables, if_exists, drop_temporary,
|
||||||
|
@ -7682,6 +7682,7 @@ int TABLE::update_virtual_fields(handler *h, enum_vcol_update_mode update_mode)
|
|||||||
|
|
||||||
int TABLE::update_virtual_field(Field *vf)
|
int TABLE::update_virtual_field(Field *vf)
|
||||||
{
|
{
|
||||||
|
DBUG_ASSERT(!in_use->is_error());
|
||||||
Query_arena backup_arena;
|
Query_arena backup_arena;
|
||||||
DBUG_ENTER("TABLE::update_virtual_field");
|
DBUG_ENTER("TABLE::update_virtual_field");
|
||||||
in_use->set_n_backup_active_arena(expr_arena, &backup_arena);
|
in_use->set_n_backup_active_arena(expr_arena, &backup_arena);
|
||||||
|
@ -119,6 +119,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
|
|||||||
|
|
||||||
extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
|
extern "C" void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
|
||||||
unsigned long long thd_get_query_id(const MYSQL_THD thd);
|
unsigned long long thd_get_query_id(const MYSQL_THD thd);
|
||||||
|
void thd_clear_error(MYSQL_THD thd);
|
||||||
|
|
||||||
TABLE *find_fk_open_table(THD *thd, const char *db, size_t db_len,
|
TABLE *find_fk_open_table(THD *thd, const char *db, size_t db_len,
|
||||||
const char *table, size_t table_len);
|
const char *table, size_t table_len);
|
||||||
MYSQL_THD create_thd();
|
MYSQL_THD create_thd();
|
||||||
@ -21493,6 +21495,8 @@ static TABLE* innodb_acquire_mdl(THD* thd, dict_table_t* table)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_SYNC(thd, "ib_purge_virtual_latch_released");
|
||||||
|
|
||||||
const table_id_t table_id = table->id;
|
const table_id_t table_id = table->id;
|
||||||
retry_mdl:
|
retry_mdl:
|
||||||
const bool unaccessible = !table->is_readable() || table->corrupted;
|
const bool unaccessible = !table->is_readable() || table->corrupted;
|
||||||
@ -21504,6 +21508,10 @@ retry_mdl:
|
|||||||
|
|
||||||
TABLE* mariadb_table = open_purge_table(thd, db_buf, db_buf_len,
|
TABLE* mariadb_table = open_purge_table(thd, db_buf, db_buf_len,
|
||||||
tbl_buf, tbl_buf_len);
|
tbl_buf, tbl_buf_len);
|
||||||
|
if (!mariadb_table)
|
||||||
|
thd_clear_error(thd);
|
||||||
|
|
||||||
|
DEBUG_SYNC(thd, "ib_purge_virtual_got_no_such_table");
|
||||||
|
|
||||||
table = dict_table_open_on_id(table_id, false, DICT_TABLE_OP_NORMAL);
|
table = dict_table_open_on_id(table_id, false, DICT_TABLE_OP_NORMAL);
|
||||||
|
|
||||||
@ -21553,6 +21561,20 @@ fail:
|
|||||||
for purge thread */
|
for purge thread */
|
||||||
static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
|
static TABLE* innodb_find_table_for_vc(THD* thd, dict_table_t* table)
|
||||||
{
|
{
|
||||||
|
DBUG_EXECUTE_IF(
|
||||||
|
"ib_purge_virtual_mdev_16222_1",
|
||||||
|
DBUG_ASSERT(!debug_sync_set_action(
|
||||||
|
thd,
|
||||||
|
STRING_WITH_LEN("ib_purge_virtual_latch_released "
|
||||||
|
"SIGNAL latch_released "
|
||||||
|
"WAIT_FOR drop_started"))););
|
||||||
|
DBUG_EXECUTE_IF(
|
||||||
|
"ib_purge_virtual_mdev_16222_2",
|
||||||
|
DBUG_ASSERT(!debug_sync_set_action(
|
||||||
|
thd,
|
||||||
|
STRING_WITH_LEN("ib_purge_virtual_got_no_such_table "
|
||||||
|
"SIGNAL got_no_such_table"))););
|
||||||
|
|
||||||
if (THDVAR(thd, background_thread)) {
|
if (THDVAR(thd, background_thread)) {
|
||||||
/* Purge thread acquires dict_operation_lock while
|
/* Purge thread acquires dict_operation_lock while
|
||||||
processing undo log record. Release the dict_operation_lock
|
processing undo log record. Release the dict_operation_lock
|
||||||
@ -21888,6 +21910,7 @@ innobase_get_computed_value(
|
|||||||
dbug_tmp_restore_column_map(mysql_table->write_set, old_write_set);
|
dbug_tmp_restore_column_map(mysql_table->write_set, old_write_set);
|
||||||
|
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
|
// FIXME: Why this error message is macro-hidden?
|
||||||
#ifdef INNODB_VIRTUAL_DEBUG
|
#ifdef INNODB_VIRTUAL_DEBUG
|
||||||
ib::warn() << "Compute virtual column values failed ";
|
ib::warn() << "Compute virtual column values failed ";
|
||||||
fputs("InnoDB: Cannot compute value for following record ",
|
fputs("InnoDB: Cannot compute value for following record ",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user