thanks for the review - pushed the following to 10.5:
42735c557e7 upstream/bb-10.5-mdev-34636 upstream/10.5 MDEV-34636 Spider: reset wide_handler->trx in two occasions
f43ea935a12 MDEV-34636 Remove implementation of ha-spider::extra() with MERGE flags
Yuchen Pei
added a comment - thanks for the review - pushed the following to 10.5:
42735c557e7 upstream/bb-10.5-mdev-34636 upstream/10.5 MDEV-34636 Spider: reset wide_handler->trx in two occasions
f43ea935a12 MDEV-34636 Remove implementation of ha-spider::extra() with MERGE flags
eaf360a48b0 upstream/bb-10.5-mdev-34636 MDEV-34636 Spider: reset wide_handler->trx in two occasions
a28f4001065 MDEV-34636 Remove implementation of ha-spider::extra() with MERGE flags
Yuchen Pei
added a comment - Hi holyfoot , ptal thanks
eaf360a48b0 upstream/bb-10.5-mdev-34636 MDEV-34636 Spider: reset wide_handler->trx in two occasions
a28f4001065 MDEV-34636 Remove implementation of ha-spider::extra() with MERGE flags
ERROR 1486 (HY000): Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
Roel Van de Paar
added a comment - Also documenting 10.5 CLI output:
10.5.26 b8f92ade57691a78cc97c5d79eae0a27a10cb8f2 (Debug)
...
10.5.26-dbg>INSERT INTO t2 SELECT * FROM t3;
ERROR 1136 (21S01): Column count doesn't match value count at row 1
10.5.26-dbg>SELECT * FROM t3;
ERROR 1429 (HY000): Unable to connect to foreign data source: localhost
10.5.26-dbg>ALTER TABLE t1 CHANGE COLUMN c1 d1 INT;
ERROR 1486 (HY000): Constant, random or timezone-dependent expressions in (sub)partitioning function are not allowed
This issue actually could be the same problem as the assertion failure in MDEV-34588. The following is based on 10.6 216fdb155683e960297b089e024c439593bbe6a8.
If we remove the implementation of ha_spider::extra() with the MERGE SE specific flags (see the diff block below), we get an assertion failure in spider/bugfix.mdev_29963 and it is the same assertion failure as reported in MDEV-34588. Upon inspection, it happens at the data node when running LOCK TABLES t2 WRITE;, and the data node query is "lock tables `test`.`t` write".
The thd at ha_spider::store_lock is different from that retrieved from spider->wide_handler->trx->thd. Below is the stack trace at the assertion failure:
If we place a breakpoint at ha_spider::extra() and do rc in rr, it is hit in the same query at the data node with a MERGE specific flag. The stack looks like spider was relying on ha_spider::extra() to reset the trx, since ha_spider::open() is not always called from open_table() (called from open_and_process_table()):
However ha_spider::extra() was not called because the MDEV-33502 change mentioned below decided not to call ha_spider::extra() from ha_partition::extra() with the MERGE-specific flag.
Yuchen Pei
added a comment - This issue actually could be the same problem as the assertion failure in MDEV-34588 . The following is based on 10.6 216fdb155683e960297b089e024c439593bbe6a8.
If we remove the implementation of ha_spider::extra() with the MERGE SE specific flags (see the diff block below), we get an assertion failure in spider/bugfix.mdev_29963 and it is the same assertion failure as reported in MDEV-34588 . Upon inspection, it happens at the data node when running LOCK TABLES t2 WRITE; , and the data node query is "lock tables `test`.`t` write" .
modified storage/spider/ha_spider.cc
@@ -1376,7 +1376,6 @@ int ha_spider::reset()
int ha_spider::extra(
enum ha_extra_function operation
) {
- int error_num;
DBUG_ENTER("ha_spider::extra");
DBUG_PRINT("info",("spider this=%p", this));
DBUG_PRINT("info",("spider operation=%d", (int) operation));
@@ -1428,16 +1427,6 @@ int ha_spider::extra(
wide_handler->insert_with_update = TRUE;
break;
#endif
- case HA_EXTRA_ATTACH_CHILDREN:
- DBUG_PRINT("info",("spider HA_EXTRA_ATTACH_CHILDREN"));
- if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
- DBUG_RETURN(error_num);
- break;
- case HA_EXTRA_ADD_CHILDREN_LIST:
- DBUG_PRINT("info",("spider HA_EXTRA_ADD_CHILDREN_LIST"));
- if (!(wide_handler->trx = spider_get_trx(ha_thd(), TRUE, &error_num)))
- DBUG_RETURN(error_num);
- break;
#if defined(HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN) || defined(HA_EXTRA_HAS_HA_EXTRA_USE_CMP_REF)
#ifdef HA_EXTRA_HAS_STARTING_ORDERED_INDEX_SCAN
case HA_EXTRA_STARTING_ORDERED_INDEX_SCAN:
The thd at ha_spider::store_lock is different from that retrieved from spider->wide_handler->trx->thd . Below is the stack trace at the assertion failure:
__GI___assert_fail > thd_get_ha_data > spider_get_trx > spider_check_trx_and_get_conn > ha_spider::append_lock_tables_list > ha_spider::store_lock > get_lock_data > mysql_lock_tables > lock_tables > lock_tables_open_and_lock_tables > mysql_execute_command > ...
If we place a breakpoint at ha_spider::extra() and do rc in rr, it is hit in the same query at the data node with a MERGE specific flag. The stack looks like spider was relying on ha_spider::extra() to reset the trx, since ha_spider::open() is not always called from open_table() (called from open_and_process_table()):
ha_spider::extra > open_and_process_table > open_tables > open_tables > lock_tables_open_and_lock_tables > mysql_execute_command > ...
The same happens in the MDEV-34588 case. There, the assertion failure happens at the statement LOCK TABLES t2 READ,t1 WRITE .
__GI___assert_fail > thd_get_ha_data > spider_get_trx > spider_check_trx_and_get_conn > ha_spider::append_lock_tables_list > ha_spider::store_lock > ha_partition::store_lock > get_lock_data > mysql_lock_tables > lock_tables > lock_tables_open_and_lock_tables > mysql_execute_command > ...
However ha_spider::extra() was not called because the MDEV-33502 change mentioned below decided not to call ha_spider::extra() from ha_partition::extra() with the MERGE-specific flag.
ha_partition::extra > open_and_process_table > open_tables > open_tables > lock_tables_open_and_lock_tables > mysql_execute_command > ...
Note the similarities in the stacks too.
thanks for the review - pushed the following to 10.5:
42735c557e7 upstream/bb-10.5-mdev-34636 upstream/10.5 MDEV-34636 Spider: reset wide_handler->trx in two occasions
f43ea935a12 MDEV-34636 Remove implementation of ha-spider::extra() with MERGE flags