1
0
mirror of https://github.com/postgres/postgres.git synced 2025-12-19 17:02:53 +03:00

Followup fixes for transaction_timeout

Don't deal with transaction timeout in PostgresMain().  Instead, release
transaction timeout activated by StartTransaction() in
CommitTransaction()/AbortTransaction()/PrepareTransaction().  Deal with both
enabling and disabling transaction timeout in assign_transaction_timeout().

Also, remove potentially flaky timeouts-long isolation test, which has no
guarantees to pass on slow/busy machines.

Reported-by: Andres Freund
Discussion: https://postgr.es/m/20240215230856.pc6k57tqxt7fhldm%40awork3.anarazel.de
This commit is contained in:
Alexander Korotkov
2024-02-16 03:36:38 +02:00
parent 51efe38cb9
commit bf82f43790
4 changed files with 23 additions and 56 deletions

View File

@@ -2262,6 +2262,10 @@ CommitTransaction(void)
s->state = TRANS_COMMIT;
s->parallelModeLevel = 0;
/* Disable transaction timeout */
if (TransactionTimeout > 0)
disable_timeout(TRANSACTION_TIMEOUT, false);
if (!is_parallel_worker)
{
/*
@@ -2535,6 +2539,10 @@ PrepareTransaction(void)
*/
s->state = TRANS_PREPARE;
/* Disable transaction timeout */
if (TransactionTimeout > 0)
disable_timeout(TRANSACTION_TIMEOUT, false);
prepared_at = GetCurrentTimestamp();
/*
@@ -2707,6 +2715,10 @@ AbortTransaction(void)
/* Prevent cancel/die interrupt while cleaning up */
HOLD_INTERRUPTS();
/* Disable transaction timeout */
if (TransactionTimeout > 0)
disable_timeout(TRANSACTION_TIMEOUT, false);
/* Make sure we have a valid memory context and resource owner */
AtAbort_Memory();
AtAbort_ResourceOwner();