Skip to content

Commit 4d84292

Browse files
MDEV-36325 MDEV-36357 Call limit_mode on spider_db_conn instead of spider_db_result in spider_db_store_result
This prevents segv on NULL result_list->current->result on handler calls that are not the first. Reasons supporting this change: - spider_db_result::limit_mode is not called anywhere else. The only calls to limit_mode method are on spider_db_conn - it is very unlikely (impossible?) for the connection to change from one backend to another between execution of sql statements and storing result: /* in spider_bg_conn_action: */ if (dbton_handler->execute_sql( sql_type, conn, result_list->quick_mode, &spider->need_mons[conn->link_idx]) // [... 9 lines elided] if (!(result_list->bgs_error = spider_db_store_result(spider, conn->link_idx, result_list->table))) this also means it is very unlikely (impossible?) for the backend type (dbton_id) to differ between conn->db_conn and result_list->current->result, also considering that spider_db_result::dbton_id comes from spider_db_conn::dbton_id: spider_db_result::spider_db_result( SPIDER_DB_CONN *in_db_conn ) : db_conn(in_db_conn), dbton_id(in_db_conn->dbton_id) Since this was the only call to spider_db_result::limit_mode, we also remove the method altogether.
1 parent 11f61d9 commit 4d84292

File tree

4 files changed

+1
-12
lines changed

4 files changed

+1
-12
lines changed

storage/spider/mysql-test/spider/bg/t/basic_sql.test

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -476,11 +476,8 @@ SELECT count(*) FROM ta_l ORDER BY a;
476476
--enable_query_log
477477
--enable_result_log
478478
--connection master_1
479-
# MDEV-36357
480-
--disable_view_protocol
481479
SELECT a.a, a.b, date_format(a.c, '%Y-%m-%d %H:%i:%s') FROM tb_l a WHERE
482480
EXISTS (SELECT * FROM ta_l b WHERE b.b = a.b) ORDER BY a.a;
483-
--enable_view_protocol
484481
--disable_query_log
485482
--disable_result_log
486483
--connection child2_1

storage/spider/spd_db_conn.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3104,7 +3104,7 @@ int spider_db_store_result(
31043104
result_list->quick_phase == 2
31053105
) {
31063106
if (result_list->low_mem_read &&
3107-
result_list->current->result->limit_mode() == 0)
3107+
conn->db_conn->limit_mode() == 0)
31083108
{
31093109
do {
31103110
spider_db_free_one_result(result_list,

storage/spider/spd_db_include.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,6 @@ int spider_db_result::fetch_table_checksum(
4747
DBUG_RETURN(0);
4848
}
4949

50-
uint spider_db_result::limit_mode()
51-
{
52-
DBUG_ENTER("spider_db_result::limit_mode");
53-
DBUG_PRINT("info",("spider this=%p", this));
54-
DBUG_RETURN(spider_dbton[dbton_id].db_util->limit_mode());
55-
}
56-
5750
spider_db_conn::spider_db_conn(
5851
SPIDER_CONN *in_conn
5952
) : conn(in_conn), dbton_id(in_conn->dbton_id)

storage/spider/spd_db_include.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -883,7 +883,6 @@ class spider_db_result
883883
SPIDER_SHARE *spider_share,
884884
CHARSET_INFO *access_charset
885885
) = 0;
886-
virtual uint limit_mode();
887886
};
888887

889888
class spider_db_conn

0 commit comments

Comments
 (0)