mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Followup to Bug#45225 Locking: hang if drop table with no timeout
This patch prevents system threads and system table accesses from using user-specified values for "lock_wait_timeout". Instead all such accesses are done using the default value (1 year). This prevents background tasks (such as replication, events, accessing stored function definitions, logging, reading time-zone information, etc.) from failing in cases where the global value of "lock_wait_timeout" is set very low. The patch also simplifies the open tables API. Rather than adding another convenience function for opening and locking system tables, this patch removes most of the existing convenience functions for open_and_lock_tables_derived(). Before, open_and_lock_tables() was a convenience function that enforced derived tables handling, while open_and_lock_tables_derived() was the main function where derived tables handling was optional. Now, this convencience function is gone and the main function is renamed to open_and_lock_tables(). No test case added as it would have required the use of --sleep to check that system threads and system tables have a different timeout value from the user-specified "lock_wait_timeout" system variable.
This commit is contained in:
@ -1280,7 +1280,7 @@ public:
|
||||
OT_DISCOVER,
|
||||
OT_REPAIR
|
||||
};
|
||||
Open_table_context(THD *thd);
|
||||
Open_table_context(THD *thd, ulong timeout);
|
||||
|
||||
bool recover_from_failed_open(THD *thd, MDL_request *mdl_request,
|
||||
TABLE_LIST *table);
|
||||
@ -1305,6 +1305,11 @@ public:
|
||||
|
||||
MDL_request *get_global_mdl_request(THD *thd);
|
||||
|
||||
inline ulong get_timeout() const
|
||||
{
|
||||
return m_timeout;
|
||||
}
|
||||
|
||||
private:
|
||||
/** List of requests for all locks taken so far. Used for waiting on locks. */
|
||||
MDL_request_list m_mdl_requests;
|
||||
@ -1322,6 +1327,11 @@ private:
|
||||
opening tables for statements which take upgradable shared metadata locks.
|
||||
*/
|
||||
MDL_request *m_global_mdl_request;
|
||||
/**
|
||||
Lock timeout in seconds. Initialized to LONG_TIMEOUT when opening system
|
||||
tables or to the "lock_wait_timeout" system variable for regular tables.
|
||||
*/
|
||||
uint m_timeout;
|
||||
};
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user