mirror of
https://github.com/postgres/postgres.git
synced 2025-09-03 15:22:11 +03:00
Substantial rewrite of async.c to avoid problems with non-reentrant stdio
and possibly other problems. Minor changes in xact.c and postgres.c's main loop to support new handling of async NOTIFY.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.23 1998/09/01 04:27:19 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/transam/xact.c,v 1.24 1998/10/06 02:39:58 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* Transaction aborts can now occur two ways:
|
||||
@@ -901,6 +901,9 @@ CommitTransaction()
|
||||
/* handle commit for large objects [ PA, 7/17/98 ] */
|
||||
_lo_commit();
|
||||
|
||||
/* NOTIFY commit must also come before lower-level cleanup */
|
||||
AtCommit_Notify();
|
||||
|
||||
CloseSequences();
|
||||
DestroyTempRels();
|
||||
AtEOXact_portals();
|
||||
@@ -916,10 +919,6 @@ CommitTransaction()
|
||||
* ----------------
|
||||
*/
|
||||
s->state = TRANS_DEFAULT;
|
||||
{ /* want this after commit */
|
||||
if (IsNormalProcessingMode())
|
||||
Async_NotifyAtCommit();
|
||||
}
|
||||
|
||||
/*
|
||||
* Let others to know about no transaction in progress - vadim
|
||||
@@ -967,6 +966,7 @@ AbortTransaction()
|
||||
* do abort processing
|
||||
* ----------------
|
||||
*/
|
||||
AtAbort_Notify();
|
||||
CloseSequences();
|
||||
AtEOXact_portals();
|
||||
RecordTransactionAbort();
|
||||
@@ -982,17 +982,6 @@ AbortTransaction()
|
||||
* ----------------
|
||||
*/
|
||||
s->state = TRANS_DEFAULT;
|
||||
{
|
||||
|
||||
/*
|
||||
* We need to do this in case another process notified us while we
|
||||
* are in the middle of an aborted transaction. We need to notify
|
||||
* our frontend after we finish the current transaction. -- jw,
|
||||
* 1/3/94
|
||||
*/
|
||||
if (IsNormalProcessingMode())
|
||||
Async_NotifyAtAbort();
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------
|
||||
@@ -1455,6 +1444,30 @@ UserAbortTransactionBlock()
|
||||
s->blockState = TBLOCK_ENDABORT;
|
||||
}
|
||||
|
||||
/* --------------------------------
|
||||
* AbortOutOfAnyTransaction
|
||||
*
|
||||
* This routine is provided for error recovery purposes. It aborts any
|
||||
* active transaction or transaction block, leaving the system in a known
|
||||
* idle state.
|
||||
* --------------------------------
|
||||
*/
|
||||
void
|
||||
AbortOutOfAnyTransaction()
|
||||
{
|
||||
TransactionState s = CurrentTransactionState;
|
||||
|
||||
/*
|
||||
* Get out of any low-level transaction
|
||||
*/
|
||||
if (s->state != TRANS_DEFAULT)
|
||||
AbortTransaction();
|
||||
/*
|
||||
* Now reset the high-level state
|
||||
*/
|
||||
s->blockState = TBLOCK_DEFAULT;
|
||||
}
|
||||
|
||||
bool
|
||||
IsTransactionBlock()
|
||||
{
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,7 +7,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.90 1998/10/02 01:14:14 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/tcop/postgres.c,v 1.91 1998/10/06 02:40:01 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* this is the "main" module of the postgres backend and
|
||||
@@ -1511,7 +1511,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
if (!IsUnderPostmaster)
|
||||
{
|
||||
puts("\nPOSTGRES backend interactive interface ");
|
||||
puts("$Revision: 1.90 $ $Date: 1998/10/02 01:14:14 $\n");
|
||||
puts("$Revision: 1.91 $ $Date: 1998/10/06 02:40:01 $\n");
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
@@ -1559,7 +1559,16 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
ReadyForQuery(whereToSendOutput);
|
||||
|
||||
/* ----------------
|
||||
* (2) read a command.
|
||||
* (2) deal with pending asynchronous NOTIFY from other backends,
|
||||
* and enable async.c's signal handler to execute NOTIFY directly.
|
||||
* ----------------
|
||||
*/
|
||||
QueryCancel = false; /* forget any earlier CANCEL signal */
|
||||
|
||||
EnableNotifyInterrupt();
|
||||
|
||||
/* ----------------
|
||||
* (3) read a command.
|
||||
* ----------------
|
||||
*/
|
||||
MemSet(parser_input, 0, MAX_PARSE_BUFFER);
|
||||
@@ -1569,7 +1578,13 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
QueryCancel = false; /* forget any earlier CANCEL signal */
|
||||
|
||||
/* ----------------
|
||||
* (3) process the command.
|
||||
* (4) disable async.c's signal handler.
|
||||
* ----------------
|
||||
*/
|
||||
DisableNotifyInterrupt();
|
||||
|
||||
/* ----------------
|
||||
* (5) process the command.
|
||||
* ----------------
|
||||
*/
|
||||
switch (firstchar)
|
||||
@@ -1640,7 +1655,7 @@ PostgresMain(int argc, char *argv[], int real_argc, char *real_argv[])
|
||||
}
|
||||
|
||||
/* ----------------
|
||||
* (4) commit the current transaction
|
||||
* (6) commit the current transaction
|
||||
*
|
||||
* Note: if we had an empty input buffer, then we didn't
|
||||
* call pg_exec_query, so we don't bother to commit this transaction.
|
||||
|
@@ -70,10 +70,6 @@ static char *opt_names[] = {
|
||||
"syslog", /* use syslog for error messages */
|
||||
"hostlookup", /* enable hostname lookup in ps_status */
|
||||
"showportnumber", /* show port number in ps_status */
|
||||
"notifyunlock", /* enable unlock of pg_listener after
|
||||
* notify */
|
||||
"notifyhack" /* enable notify hack to remove duplicate
|
||||
* tuples */
|
||||
};
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user