mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-11418 - AliSQL: [Feature] Issue#1 KILL IDLE TRANSACTIONS
Terminate idle transactions safely in server layer by setting up socket timeout parameter. Percona provides another patch to resolve similar problem, but it calls server layer's callback in InnoDB plugin to close THD, which crashes in some testcases. See https://bugs.launchpad.net/percona-server/+bug/901060 for more detailed information. 1. export parameter trx_idle_timeout to handle all kinds of transactions, the priority is highest 2. export parameter trx_readonly_idle_timeout to handle read-only transactions 3. export parameter trx_changes_idle_timeout to handle read-write transactions
This commit is contained in:
@ -695,6 +695,10 @@ typedef struct system_variables
|
||||
my_bool session_track_state_change;
|
||||
|
||||
ulong threadpool_priority;
|
||||
|
||||
uint idle_transaction_timeout;
|
||||
uint idle_readonly_transaction_timeout;
|
||||
uint idle_readwrite_transaction_timeout;
|
||||
} SV;
|
||||
|
||||
/**
|
||||
@ -4287,6 +4291,29 @@ public:
|
||||
current_linfo= 0;
|
||||
mysql_mutex_unlock(&LOCK_thread_count);
|
||||
}
|
||||
|
||||
|
||||
uint get_net_wait_timeout()
|
||||
{
|
||||
if (in_active_multi_stmt_transaction())
|
||||
{
|
||||
if (transaction.all.is_trx_read_write())
|
||||
{
|
||||
if (variables.idle_readwrite_transaction_timeout > 0)
|
||||
return variables.idle_readwrite_transaction_timeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (variables.idle_readonly_transaction_timeout > 0)
|
||||
return variables.idle_readonly_transaction_timeout;
|
||||
}
|
||||
|
||||
if (variables.idle_transaction_timeout > 0)
|
||||
return variables.idle_transaction_timeout;
|
||||
}
|
||||
|
||||
return variables.net_wait_timeout;
|
||||
}
|
||||
};
|
||||
|
||||
inline void add_to_active_threads(THD *thd)
|
||||
|
Reference in New Issue
Block a user