Details
-
Bug
-
Status: Stalled (View Workflow)
-
Major
-
Resolution: Unresolved
-
None
Description
I have added an assertion to ensure that the correct table is chosen in innodb_find_table_for_vc:
--- a/storage/innobase/handler/ha_innodb.cc
|
+++ b/storage/innobase/handler/ha_innodb.cc
|
@@ -20007,6 +20007,9 @@
|
} else { |
if (table->vc_templ->mysql_table_query_id |
== thd_get_query_id(thd)) {
|
+ DEBUG_SYNC(thd, "find_table_for_vc_table_valid"); |
+ DBUG_ASSERT(table->vc_templ->mysql_table_query_id
|
+ == thd_get_query_id(thd));
|
return table->vc_templ->mysql_table; |
}
|
}
|
This is important, since the table is thread-local data.
The above assertion fails with the following test:
--source include/have_debug_sync.inc
|
--source include/have_innodb.inc
|
--source include/have_sequence.inc
|
--connect (con2, localhost, root,,)
|
--connection default
|
set default_storage_engine= innodb; |
|
|
create table t1 (a int primary key); |
insert into t1(a) select * from seq_1_to_65536; |
create table t2 (a int, b int as (a), key(b), foreign key (a) references t1 (a) |
on delete cascade on update cascade); |
insert into t2(a) select * from seq_1_to_65536; |
set debug_sync= "find_table_for_vc_table_valid SIGNAL found WAIT_FOR go"; |
--send
|
UPDATE t1 set a = a + 1000000 where a <= 2; |
--connection con2
|
set debug_sync= "now WAIT_FOR found TIMEOUT 3"; |
UPDATE t1 set a= 330000 where a = 33333; |
set debug_sync= "now SIGNAL go"; |
|
--connection default
|
--reap
|
|
# Cleanup
|
drop table t2, t1; |
set debug_sync= reset; |
--connection default |
I believe we need enough rows to have more that one leaf page in the tree, to avoid a row lock timeout.
The best way to fix it is to put mysql_table to a threadlocal data as well. A good place can be row_prebuilt_t (and table is already there): to access child prebuilt, parent prebuilt should contain references to it, we can fill it on open under certain conditions, or on demand
Attachments
Issue Links
- blocks
-
MDEV-12302 Execute triggers for foreign key updates/deletes
- Confirmed
- causes
-
MDEV-30869 Failing assertion: rec == NULL || !(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG)
- Open
- is blocked by
-
MDEV-12302 Execute triggers for foreign key updates/deletes
- Confirmed
-
MDEV-29299 SELECT from table with vcol index reports warning
- Closed
-
MDEV-30182 Optimize open_tables to take O(N) time
- Stalled
-
MDEV-30378 Versioned REPLACE succeeds with ON DELETE RESTRICT constraint
- Closed
- relates to
-
MDEV-19601 MDEV-13708 is still unfixed
- Stalled
-
MDEV-20640 [ERROR] InnoDB: tried to purge non-delete-marked record and Assertion `0' failed in row_purge_remove_sec_if_poss_leaf
- Closed
-
MDEV-29182 Assertion `fld->field_no < table->n_v_def' failed on cascade FK update of table with vcol index in parent
- Confirmed
-
MDEV-30182 Optimize open_tables to take O(N) time
- Stalled
-
MDEV-30674 Implement CHECK constraints validation on cascading updates
- Closed
-
MDEV-20640 [ERROR] InnoDB: tried to purge non-delete-marked record and Assertion `0' failed in row_purge_remove_sec_if_poss_leaf
- Closed
-
MDEV-22880 Honor constraints on UPDATE CASCADE
- Open
-
MDEV-26951 gcol.innodb_virtual_basic fails with "purge non-delete-marked" error
- Stalled
-
MDEV-30021 FK actions are ignored after tc_purge and COMMIT
- Stalled
-
MDEV-30103 FK constraint fails upon referenced table eviction
- Stalled