mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-29605 Reset queued ping info of all spider connections associated with a closed spider handler
A spider_conn may outlive its associated ha_spider (in the field queued_ping_spider) used for connecting to and pinging the data node (a call to spider_db_ping(), guarded by the boolean field queued_ping). In a call to ha_spider::close() (which is often preceded with the deletion of the ha_spider itself), many cleanups happen, including freeing the associated spider_share, which is used by the spider_conn in spider_db_ping. Therefore it is necessary to reset both the queued_ping_spider and queued_ping fields, so that any further spider interaction with the data node will not trigger the call using the ha_spider including its freed spider_share. Also out of caution added an assert and internal error in case a connection has not been established (the db_conn field of type MYSQL * is NULL), and attempt to connect is skipped because both queued_connect and queued_ping are false. Note that this unlikely (if not impossible) scenario would not be a regression caused by this change, as it strictly falls under the scenario of this bug.
This commit is contained in:
@@ -2100,6 +2100,10 @@ int spider_db_mbase::exec_query(
|
||||
general_log_write(current_thd, COM_QUERY, tmp_query_str.ptr(),
|
||||
tmp_query_str.length());
|
||||
}
|
||||
/* There should be a live connection to the data node */
|
||||
DBUG_ASSERT(db_conn);
|
||||
if (!db_conn)
|
||||
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
|
||||
if (!spider_param_dry_access())
|
||||
{
|
||||
error_num = mysql_real_query(db_conn, query, length);
|
||||
|
Reference in New Issue
Block a user