return_xids_with_vxids.diff
application/octet-stream
Filename: return_xids_with_vxids.diff
Type: application/octet-stream
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| src/backend/storage/lmgr/lock.c | 17 | 3 |
diff --git a/src/backend/storage/lmgr/lock.c b/src/backend/storage/lmgr/lock.c
index 108b4d9023..fef6ad37a5 100644
--- a/src/backend/storage/lmgr/lock.c
+++ b/src/backend/storage/lmgr/lock.c
@@ -2928,7 +2928,7 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
/*
* Allocate memory to store results, and fill with InvalidVXID. We only
- * need enough space for MaxBackends + max_prepared_xacts + a terminator.
+ * need enough space for MaxBackends * 2 + max_prepared_xacts + a terminator.
* InHotStandby allocate once in TopMemoryContext.
*/
if (InHotStandby)
@@ -2937,12 +2937,12 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
vxids = (VirtualTransactionId *)
MemoryContextAlloc(TopMemoryContext,
sizeof(VirtualTransactionId) *
- (MaxBackends + max_prepared_xacts + 1));
+ (MaxBackends * 2 + max_prepared_xacts + 1));
}
else
vxids = (VirtualTransactionId *)
palloc0(sizeof(VirtualTransactionId) *
- (MaxBackends + max_prepared_xacts + 1));
+ (MaxBackends * 2 + max_prepared_xacts + 1));
/* Compute hash code and partition lock, and look up conflicting modes. */
hashcode = LockTagHashCode(locktag);
@@ -3019,6 +3019,13 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
if (VirtualTransactionIdIsValid(vxid))
vxids[count++] = vxid;
+
+ if (TransactionIdIsValid(proc->xid))
+ {
+ vxids[count].backendId = InvalidBackendId;
+ vxids[count].localTransactionId = proc->xid;
+ count++;
+ }
/* else, xact already committed or aborted */
/* No need to examine remaining slots. */
@@ -3089,6 +3096,13 @@ GetLockConflicts(const LOCKTAG *locktag, LOCKMODE lockmode, int *countp)
if (i >= fast_count)
vxids[count++] = vxid;
}
+
+ if (TransactionIdIsValid(proc->xid))
+ {
+ vxids[count].backendId = InvalidBackendId;
+ vxids[count].localTransactionId = proc->xid;
+ count++;
+ }
/* else, xact already committed or aborted */
}
}