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

Commitdae17e5

Browse files
committed
Back-patch fix to ensure we abort any open transaction at backend exit.
1 parenta2661b5 commitdae17e5

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

‎src/backend/tcop/postgres.c

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.155 2000/05/21 02:23:30 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.155.2.1 2000/08/30 21:19:32 tgl Exp $
1212
*
1313
* NOTES
1414
* this is the "main" module of the postgres backend and
@@ -1452,14 +1452,14 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
14521452
if (!IsUnderPostmaster)
14531453
{
14541454
puts("\nPOSTGRES backend interactive interface ");
1455-
puts("$Revision: 1.155 $ $Date: 2000/05/21 02:23:30 $\n");
1455+
puts("$Revision: 1.155.2.1 $ $Date: 2000/08/30 21:19:32 $\n");
14561456
}
14571457

14581458
/*
14591459
* Initialize the deferred trigger manager
14601460
*/
14611461
if (DeferredTriggerInit()!=0)
1462-
proc_exit(0);
1462+
gotonormalexit;
14631463

14641464
SetProcessingMode(NormalProcessing);
14651465

@@ -1479,12 +1479,11 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
14791479
TPRINTF(TRACE_VERBOSE,"AbortCurrentTransaction");
14801480

14811481
AbortCurrentTransaction();
1482-
InError= false;
1482+
14831483
if (ExitAfterAbort)
1484-
{
1485-
ProcReleaseLocks();/* Just to be sure... */
1486-
proc_exit(0);
1487-
}
1484+
gotoerrorexit;
1485+
1486+
InError= false;
14881487
}
14891488

14901489
Warn_restart_ready= true;/* we can now handle elog(ERROR) */
@@ -1553,8 +1552,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
15531552
if (HandleFunctionRequest()==EOF)
15541553
{
15551554
/* lost frontend connection during F message input */
1556-
pq_close();
1557-
proc_exit(0);
1555+
gotonormalexit;
15581556
}
15591557
break;
15601558

@@ -1608,11 +1606,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
16081606
*/
16091607
case'X':
16101608
caseEOF:
1611-
if (!IsUnderPostmaster)
1612-
ShutdownXLOG();
1613-
pq_close();
1614-
proc_exit(0);
1615-
break;
1609+
gotonormalexit;
16161610

16171611
default:
16181612
elog(ERROR,"unknown frontend message was received");
@@ -1642,10 +1636,20 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
16421636
if (IsUnderPostmaster)
16431637
NullCommand(Remote);
16441638
}
1645-
}/* infinite for-loop */
1639+
}/* end of main loop */
1640+
1641+
normalexit:
1642+
ExitAfterAbort= true;/* ensure we will exit if elog during abort */
1643+
AbortOutOfAnyTransaction();
1644+
if (!IsUnderPostmaster)
1645+
ShutdownXLOG();
1646+
1647+
errorexit:
1648+
pq_close();
1649+
ProcReleaseLocks();/* Just to be sure... */
1650+
proc_exit(0);
16461651

1647-
proc_exit(0);/* shouldn't get here... */
1648-
return1;
1652+
return1;/* keep compiler quiet */
16491653
}
16501654

16511655
#ifndefHAVE_GETRUSAGE

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp