autovac-temp-REL9_4_STABLE.patch
text/x-diff
Filename: autovac-temp-REL9_4_STABLE.patch
Type: text/x-diff
Part: 0
Message:
Re: removal of dangling temp tables
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/postmaster/autovacuum.c | 9 | 2 |
commit 5aa717be9fe7288cbec043cdea0fb757433f3462[m
Author: Alvaro Herrera <alvherre@alvh.no-ip.org>
AuthorDate: Wed Dec 26 15:12:44 2018 -0300
CommitDate: Wed Dec 26 15:12:45 2018 -0300
Improve autovacuum logic about temp tables nearing XID wraparound
diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c
index c18285d690..62a06add56 100644
--- a/src/backend/postmaster/autovacuum.c
+++ b/src/backend/postmaster/autovacuum.c
@@ -2108,11 +2108,18 @@ do_autovacuum(void)
if (classForm->relpersistence == RELPERSISTENCE_TEMP)
{
int backendID;
+ PGPROC *proc;
backendID = GetTempNamespaceBackendId(classForm->relnamespace);
- /* We just ignore it if the owning backend is still active */
- if (backendID == MyBackendId || BackendIdGetProc(backendID) == NULL)
+ /*
+ * We just ignore it if the owning backend is still active in the
+ * same database.
+ */
+ if (backendID != InvalidBackendId &&
+ (backendID == MyBackendId ||
+ (proc = BackendIdGetProc(backendID)) == NULL ||
+ proc->databaseId != MyDatabaseId))
{
/*
* We found an orphan temp table (which was probably left