summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael P2011-07-14 04:56:00 +0000
committerMichael P2011-07-14 04:56:00 +0000
commitfb2a3a864dee367f2cfe76a3a4fff5e02cb94fc1 (patch)
treeca7f3807510fde2895da757f3bf72986fd009f6e
parentf0f4ae5fddf646b1a41dd4d512fccdf9c9587254 (diff)
Performance issue with snapshot processing
This commit solves an issue with snapshot processing in the case where cluster was used under multiple Coordinators. When a Coordinator/Coordinator connection was initialized, backend coordinator initialized a transaction to GTM that was never committed. A consequence of that was Snapshot xmin that remained to a constant value. Another consequence was recent global Xmin value set to a lower value, making autovacuum having absolutely no effects. This fix improves performance of the whole cluster by making autovacuum remove correctly old tuples for long-period runs.
-rw-r--r--src/backend/access/transam/varsup.c3
-rw-r--r--src/backend/storage/ipc/procarray.c3
-rw-r--r--src/gtm/main/gtm_txn.c4
3 files changed, 7 insertions, 3 deletions
diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c
index a5ff7537b3..1c684f5dfc 100644
--- a/src/backend/access/transam/varsup.c
+++ b/src/backend/access/transam/varsup.c
@@ -203,7 +203,8 @@ GetNewTransactionId(bool isSubXact)
increment_xid = false;
elog(DEBUG1, "xid (%d) does not follow ShmemVariableCache->nextXid (%d)",
xid, ShmemVariableCache->nextXid);
- } else
+ }
+ else
ShmemVariableCache->nextXid = xid;
}
else
diff --git a/src/backend/storage/ipc/procarray.c b/src/backend/storage/ipc/procarray.c
index 2de6db4511..5477df663b 100644
--- a/src/backend/storage/ipc/procarray.c
+++ b/src/backend/storage/ipc/procarray.c
@@ -1234,7 +1234,8 @@ GetSnapshotData(Snapshot snapshot)
if (GetSnapshotDataDataNode(snapshot))
return snapshot;
/* else fallthrough */
- } else if (IS_PGXC_COORDINATOR && !IsConnFromCoord())
+ }
+ else if (IS_PGXC_COORDINATOR && !IsConnFromCoord() && IsNormalProcessingMode())
{
/* Snapshot has ever been received from remote Coordinator */
if (GetSnapshotDataCoordinator(snapshot))
diff --git a/src/gtm/main/gtm_txn.c b/src/gtm/main/gtm_txn.c
index 7d13076486..37b40a68e3 100644
--- a/src/gtm/main/gtm_txn.c
+++ b/src/gtm/main/gtm_txn.c
@@ -1363,7 +1363,7 @@ ProcessCommitTransactionCommand(Port *myport, StringInfo message)
pq_getmsgend(message);
oldContext = MemoryContextSwitchTo(TopMemoryContext);
-
+
elog(LOG, "Committing transaction id %u", gxid);
/*
@@ -1455,6 +1455,8 @@ ProcessCommitPreparedTransactionCommand(Port *myport, StringInfo message)
oldContext = MemoryContextSwitchTo(TopMemoryContext);
+ elog(LOG, "Committing: prepared id %u and commit prepared id %u ", gxid[0], gxid[1]);
+
/*
* Commit the prepared transaction.
*/