test_group_commit.patch
application/octet-stream
Filename: test_group_commit.patch
Type: application/octet-stream
Part: 3
Patch
Format: unified
| File | + | − |
|---|---|---|
| src/backend/access/transam/clog.c | 10 | 0 |
| src/test/modules/test_injection_points/Makefile | 1 | 1 |
diff --git a/src/backend/access/transam/clog.c b/src/backend/access/transam/clog.c
index 9745a1f9f9..fe56d42a07 100644
--- a/src/backend/access/transam/clog.c
+++ b/src/backend/access/transam/clog.c
@@ -44,6 +44,7 @@
#include "storage/proc.h"
#include "storage/sync.h"
#include "utils/guc_hooks.h"
+#include "utils/injection_point.h"
/*
* Defines for CLOG page sizes. A page is the same BLCKSZ as is used
@@ -313,6 +314,7 @@ TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
*/
if (LWLockConditionalAcquire(lock, LW_EXCLUSIVE))
{
+ INJECTION_POINT("ClogGroupCommit");
/* Got the lock without waiting! Do the update. */
TransactionIdSetPageStatusInternal(xid, nsubxids, subxids, status,
lsn, pageno);
@@ -472,7 +474,10 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
if (pg_atomic_compare_exchange_u32(&procglobal->clogGroupFirst,
&nextidx,
(uint32) proc->pgprocno))
+ {
+ elog(LOG, "procno %d for xid %d added for group update", proc->pgprocno, xid);
break;
+ }
}
/*
@@ -485,6 +490,8 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
{
int extraWaits = 0;
+ elog(LOG, "procno %d is follower and wait for group leader to update commit status of xid %d", proc->pgprocno, xid);
+
/* Sleep until the leader updates our XID status. */
pgstat_report_wait_start(WAIT_EVENT_XACT_GROUP_UPDATE);
for (;;)
@@ -502,6 +509,7 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
/* Fix semaphore count for any absorbed wakeups */
while (extraWaits-- > 0)
PGSemaphoreUnlock(proc->sem);
+ elog(LOG, "procno %d is follower and commit status of xid %d is updated by leader", proc->pgprocno, xid);
return true;
}
@@ -516,6 +524,7 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
prevpageno = ProcGlobal->allProcs[nextidx].clogGroupMemberPage;
prevlock = SimpleLruGetBankLock(XactCtl, prevpageno);
LWLockAcquire(prevlock, LW_EXCLUSIVE);
+ elog(LOG, "procno %d is group leader and got the lock", proc->pgprocno);
/*
* Now that we've got the lock, clear the list of processes waiting for
@@ -576,6 +585,7 @@ TransactionGroupUpdateXidStatus(TransactionId xid, XidStatus status,
nextproc->clogGroupMemberXidStatus,
nextproc->clogGroupMemberLsn,
nextproc->clogGroupMemberPage);
+ elog(LOG, "group leader updated status of xid %d", nextproc->clogGroupMemberXid);
/* Move to next proc in list. */
nextidx = pg_atomic_read_u32(&nextproc->clogGroupNext);
diff --git a/src/test/modules/test_injection_points/Makefile b/src/test/modules/test_injection_points/Makefile
index 4696c1b013..8974182b56 100644
--- a/src/test/modules/test_injection_points/Makefile
+++ b/src/test/modules/test_injection_points/Makefile
@@ -8,7 +8,7 @@ PGFILEDESC = "test_injection_points - test injection points"
EXTENSION = test_injection_points
DATA = test_injection_points--1.0.sql
-REGRESS = test_injection_points
+#REGRESS = test_injection_points
TAP_TESTS = 1