[MDEV-27260] Implement and evaluate select handler for Spider Created: 2021-12-14  Updated: 2023-09-20

Status: Open
Project: MariaDB Server
Component/s: Storage Engine - Spider
Fix Version/s: None

Type: Task Priority: Major
Reporter: Nayuta Yanagisawa (Inactive) Assignee: Yuchen Pei
Resolution: Unresolved Votes: 0
Labels: None

Issue Links:
Relates

 Description   

Spider's GROUP BY handler (GBH) implementation is one of the prominent sources of the Spider bugs. Implement the select handler for Spider and evaluate if we can replace the existing GBH with the select handler.

The select handler intercepts the query processing much earlier than GBH. I expect that this makes it easier for Spider to generate queries for data nodes.

Related documents:



 Comments   
Comment by Nayuta Yanagisawa (Inactive) [ 2022-02-21 ]

item->name.str maintains the string expression corresponding to the item. The problem here is that item->name.str may contain database name and table name as you can see in the following example.

SELECT IF(COUNT(auto_test_local.tbl_a.id > 0),'Y','N') FROM tbl_a;

(rr) p item->name.str
$7 = 0x7f555401c070 "IF(COUNT(auto_test_local.tbl_a.id > 0),'Y','N')"

On the other hand, the name of a table on a Spider node is not necessarily the same as that on a data node. This also holds for database names. Thus, it seems to be difficult to utilize item->name.str in the Spider query generation.

Comment by Roel Van de Paar [ 2022-02-21 ]

Not sure if it helps at all, but here is how I extract crashing queries from core dumps in gdb (automated in scripts):

[Current thread is 1 (Thread 0x1475c01af700 (LWP 3825774))]
(gdb) print dispatch_command::packet
$1 = 0x14754000b889 "ALTER TABLE t1 PARTITION BY system_time INTERVAL (SELECT i FROM t2) DAY (PARTITION p1 HISTORY, PARTITION pn CURRENT)"
(gdb) print do_command::thd->query_string.string.str
$2 = 0x147540013de0 "ALTER TABLE t1 PARTITION BY system_time INTERVAL (SELECT i FROM t2) DAY (PARTITION p1 HISTORY, PARTITION pn CURRENT)"

There also used to be do_command::thd->m_query_string.str, but it is not used for MariaDB.

Comment by Nayuta Yanagisawa (Inactive) [ 2022-02-22 ]

Thank you for your comment. I think the full query string doesn't help Spider because the name of a table on a Spider node is not necessarily the same as that on a data node and thus Spider need to replace it.

Comment by Nayuta Yanagisawa (Inactive) [ 2022-03-04 ]

I write down ideas in a brainstorming manner.

It seems not to be that difficult to replace a database or a table name, in item->name.str, with the corresponding database or table name in the remote data node. Isn't this replacement enough for generating queries for data nodes?

Generated at Thu Feb 08 09:51:34 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.