summaryrefslogtreecommitdiff
path: root/src/backend/utils
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2015-02-03 23:25:47 +0100
committerAndres Freund <andres@anarazel.de>2015-02-03 23:25:47 +0100
commit2505ce0be0b686c5a0a5141e9d080e7fdc35988a (patch)
tree32291d2aaca4045b4e1949fd2e6b5d8d70e46c55 /src/backend/utils
parentd06995710bc7e347d39866c1793ae282498d65e0 (diff)
downloadpostgresql-2505ce0be0b686c5a0a5141e9d080e7fdc35988a.tar.gz
Remove remnants of ImmediateInterruptOK handling.
Now that nothing sets ImmediateInterruptOK to true anymore, we can remove all the supporting code. Reviewed-By: Heikki Linnakangas
Diffstat (limited to 'src/backend/utils')
-rw-r--r--src/backend/utils/error/elog.c29
-rw-r--r--src/backend/utils/init/globals.c1
-rw-r--r--src/backend/utils/misc/timeout.c38
3 files changed, 6 insertions, 62 deletions
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 0f7aa1993a..4e0cc30f1c 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -412,7 +412,6 @@ errfinish(int dummy,...)
{
ErrorData *edata = &errordata[errordata_stack_depth];
int elevel;
- bool save_ImmediateInterruptOK;
MemoryContext oldcontext;
ErrorContextCallback *econtext;
@@ -421,18 +420,6 @@ errfinish(int dummy,...)
elevel = edata->elevel;
/*
- * Ensure we can't get interrupted while performing error reporting. This
- * is needed to prevent recursive entry to functions like syslog(), which
- * may not be re-entrant.
- *
- * Note: other places that save-and-clear ImmediateInterruptOK also do
- * HOLD_INTERRUPTS(), but that should not be necessary here since we don't
- * call anything that could turn on ImmediateInterruptOK.
- */
- save_ImmediateInterruptOK = ImmediateInterruptOK;
- ImmediateInterruptOK = false;
-
- /*
* Do processing in ErrorContext, which we hope has enough reserved space
* to report an error.
*/
@@ -463,10 +450,6 @@ errfinish(int dummy,...)
* itself be inside a holdoff section. If necessary, such a handler
* could save and restore InterruptHoldoffCount for itself, but this
* should make life easier for most.)
- *
- * Note that we intentionally don't restore ImmediateInterruptOK here,
- * even if it was set at entry. We definitely don't want that on
- * while doing error cleanup.
*/
InterruptHoldoffCount = 0;
QueryCancelHoldoffCount = 0;
@@ -573,15 +556,9 @@ errfinish(int dummy,...)
}
/*
- * We reach here if elevel <= WARNING. OK to return to caller, so restore
- * caller's setting of ImmediateInterruptOK.
- */
- ImmediateInterruptOK = save_ImmediateInterruptOK;
-
- /*
- * But check for cancel/die interrupt first --- this is so that the user
- * can stop a query emitting tons of notice or warning messages, even if
- * it's in a loop that otherwise fails to check for interrupts.
+ * Check for cancel/die interrupt first --- this is so that the user can
+ * stop a query emitting tons of notice or warning messages, even if it's
+ * in a loop that otherwise fails to check for interrupts.
*/
CHECK_FOR_INTERRUPTS();
}
diff --git a/src/backend/utils/init/globals.c b/src/backend/utils/init/globals.c
index 8cf2ead392..23e594e584 100644
--- a/src/backend/utils/init/globals.c
+++ b/src/backend/utils/init/globals.c
@@ -30,7 +30,6 @@ volatile bool InterruptPending = false;
volatile bool QueryCancelPending = false;
volatile bool ProcDiePending = false;
volatile bool ClientConnectionLost = false;
-volatile bool ImmediateInterruptOK = false;
volatile uint32 InterruptHoldoffCount = 0;
volatile uint32 QueryCancelHoldoffCount = 0;
volatile uint32 CritSectionCount = 0;
diff --git a/src/backend/utils/misc/timeout.c b/src/backend/utils/misc/timeout.c
index ce4bc13ec3..a7ec665f6c 100644
--- a/src/backend/utils/misc/timeout.c
+++ b/src/backend/utils/misc/timeout.c
@@ -259,27 +259,12 @@ static void
handle_sig_alarm(SIGNAL_ARGS)
{
int save_errno = errno;
- bool save_ImmediateInterruptOK = ImmediateInterruptOK;
/*
- * We may be executing while ImmediateInterruptOK is true (e.g., when
- * mainline is waiting for a lock). If SIGINT or similar arrives while
- * this code is running, we'd lose control and perhaps leave our data
- * structures in an inconsistent state. Disable immediate interrupts, and
- * just to be real sure, bump the holdoff counter as well. (The reason
- * for this belt-and-suspenders-too approach is to make sure that nothing
- * bad happens if a timeout handler calls code that manipulates
- * ImmediateInterruptOK.)
- *
- * Note: it's possible for a SIGINT to interrupt handle_sig_alarm before
- * we manage to do this; the net effect would be as if the SIGALRM event
- * had been silently lost. Therefore error recovery must include some
- * action that will allow any lost interrupt to be rescheduled. Disabling
- * some or all timeouts is sufficient, or if that's not appropriate,
- * reschedule_timeouts() can be called. Also, the signal blocking hazard
- * described below applies here too.
+ * Bump the holdoff counter, to make sure nothing we call will process
+ * interrupts directly. No timeout handler should do that, but these
+ * failures are hard to debug, so better be sure.
*/
- ImmediateInterruptOK = false;
HOLD_INTERRUPTS();
/*
@@ -332,24 +317,7 @@ handle_sig_alarm(SIGNAL_ARGS)
}
}
- /*
- * Re-allow query cancel, and then try to service any cancel request that
- * arrived meanwhile (this might in particular include a cancel request
- * fired by one of the timeout handlers). Since we are in a signal
- * handler, we mustn't call ProcessInterrupts unless ImmediateInterruptOK
- * is set; if it isn't, the cancel will happen at the next mainline
- * CHECK_FOR_INTERRUPTS.
- *
- * Note: a longjmp from here is safe so far as our own data structures are
- * concerned; but on platforms that block a signal before calling the
- * handler and then un-block it on return, longjmping out of the signal
- * handler leaves SIGALRM still blocked. Error cleanup is responsible for
- * unblocking any blocked signals.
- */
RESUME_INTERRUPTS();
- ImmediateInterruptOK = save_ImmediateInterruptOK;
- if (save_ImmediateInterruptOK)
- CHECK_FOR_INTERRUPTS();
errno = save_errno;
}