Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb8d0cda

Browse files
committed
Further second thoughts about idle_session_timeout patch.
On reflection, the order of operations in PostgresMain() is wrong.These timeouts ought to be shut down before, not after, we do thepost-command-read CHECK_FOR_INTERRUPTS, to guarantee that anytimeout error will be detected there rather than at some ill-definedlater point (possibly after having wasted a lot of work).This is really an error in the original idle_in_transaction_timeoutpatch, so back-patch to 9.6 where that was introduced.
1 parentebb5457 commitb8d0cda

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

‎src/backend/tcop/postgres.c‎

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4323,22 +4323,11 @@ PostgresMain(int argc, char *argv[],
43234323
firstchar=ReadCommand(&input_message);
43244324

43254325
/*
4326-
* (4) disable async signal conditions again.
4326+
* (4) turn off the idle-in-transaction and idle-session timeouts, if
4327+
* active. We do this before step (5) so that any last-moment timeout
4328+
* is certain to be detected in step (5).
43274329
*
4328-
* Query cancel is supposed to be a no-op when there is no query in
4329-
* progress, so if a query cancel arrived while we were idle, just
4330-
* reset QueryCancelPending. ProcessInterrupts() has that effect when
4331-
* it's called when DoingCommandRead is set, so check for interrupts
4332-
* before resetting DoingCommandRead.
4333-
*/
4334-
CHECK_FOR_INTERRUPTS();
4335-
DoingCommandRead= false;
4336-
4337-
/*
4338-
* (5) turn off the idle-in-transaction and idle-session timeouts, if
4339-
* active.
4340-
*
4341-
* At most one of these two will be active, so there's no need to
4330+
* At most one of these timeouts will be active, so there's no need to
43424331
* worry about combining the timeout.c calls into one.
43434332
*/
43444333
if (idle_in_transaction_timeout_enabled)
@@ -4352,6 +4341,18 @@ PostgresMain(int argc, char *argv[],
43524341
idle_session_timeout_enabled= false;
43534342
}
43544343

4344+
/*
4345+
* (5) disable async signal conditions again.
4346+
*
4347+
* Query cancel is supposed to be a no-op when there is no query in
4348+
* progress, so if a query cancel arrived while we were idle, just
4349+
* reset QueryCancelPending. ProcessInterrupts() has that effect when
4350+
* it's called when DoingCommandRead is set, so check for interrupts
4351+
* before resetting DoingCommandRead.
4352+
*/
4353+
CHECK_FOR_INTERRUPTS();
4354+
DoingCommandRead= false;
4355+
43554356
/*
43564357
* (6) check for any other interesting events that happened while we
43574358
* slept.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp