mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +03:00
Teach autovacuum how to determine whether a temp table belongs to a crashed
backend. If so, send a LOG message to the postmaster log, and if the table is beyond the vacuum-for-wraparound horizon, forcibly drop it. Per recent discussions. Perhaps we ought to back-patch this, but it probably needs to age a bit in HEAD first.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.72 2008/06/20 00:24:53 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/sinvaladt.c,v 1.73 2008/07/01 02:09:34 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -357,6 +357,33 @@ CleanupInvalidationState(int status, Datum arg)
|
||||
LWLockRelease(SInvalWriteLock);
|
||||
}
|
||||
|
||||
/*
|
||||
* BackendIdIsActive
|
||||
* Test if the given backend ID is currently assigned to a process.
|
||||
*/
|
||||
bool
|
||||
BackendIdIsActive(int backendID)
|
||||
{
|
||||
bool result;
|
||||
SISeg *segP = shmInvalBuffer;
|
||||
|
||||
/* Need to lock out additions/removals of backends */
|
||||
LWLockAcquire(SInvalWriteLock, LW_SHARED);
|
||||
|
||||
if (backendID > 0 && backendID <= segP->lastBackend)
|
||||
{
|
||||
ProcState *stateP = &segP->procState[backendID - 1];
|
||||
|
||||
result = (stateP->procPid != 0);
|
||||
}
|
||||
else
|
||||
result = false;
|
||||
|
||||
LWLockRelease(SInvalWriteLock);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* SIInsertDataEntries
|
||||
* Add new invalidation message(s) to the buffer.
|
||||
|
||||
Reference in New Issue
Block a user