v2-0002-Fix-stale-comments-about-prepared-xact-proc-numbe.patch
application/octet-stream
Filename: v2-0002-Fix-stale-comments-about-prepared-xact-proc-numbe.patch
Type: application/octet-stream
Part: 1
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: format-patch
Series: patch v2-0002
Subject: Fix stale comments about prepared-xact proc number layout
| File | + | − |
|---|---|---|
| src/backend/access/transam/multixact.c | 4 | 3 |
| src/backend/access/transam/twophase.c | 4 | 3 |
From 9f6e79663d9988148051930009a1d400206d7671 Mon Sep 17 00:00:00 2001 From: "Chao Li (Evan)" <lic@highgo.com> Date: Wed, 25 Feb 2026 09:27:59 +0800 Subject: [PATCH v2 2/2] Fix stale comments about prepared-xact proc number layout Update two comments to match current ProcNumber/PGPROC layout after backend ID and proc-array indexing changes: - multixact.c: clarify that per-backend multixact horizon arrays include auxiliary process slots between normal backends and prepared xacts. - twophase.c: clarify that dummy proc numbers for prepared transactions start at MaxBackends + NUM_AUXILIARY_PROCS (not MaxBackends). Author: Chao Li <lic@highgo.com> Reviewed-by: Discussion: https://postgr.es/m/7acc94b0-ea82-4657-b1b0-77842cb7a60c@postgrespro.ru --- src/backend/access/transam/multixact.c | 7 ++++--- src/backend/access/transam/twophase.c | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/backend/access/transam/multixact.c b/src/backend/access/transam/multixact.c index 15dd928eb95..ddc79d19fd6 100644 --- a/src/backend/access/transam/multixact.c +++ b/src/backend/access/transam/multixact.c @@ -162,9 +162,10 @@ typedef struct MultiXactStateData * immediately following the MultiXactStateData struct. Each is indexed by * ProcNumber. * - * In both arrays, there's a slot for all normal backends - * (0..MaxBackends-1) followed by a slot for max_prepared_xacts prepared - * transactions. + * In both arrays, there are slots for all normal backends + * (0..MaxBackends-1), followed by slots for auxiliary processes + * (MaxBackends..MaxBackends + NUM_AUXILIARY_PROCS - 1), followed by slots + * for max_prepared_xacts prepared transactions. * * OldestMemberMXactId[k] is the oldest MultiXactId each backend's current * transaction(s) could possibly be a member of, or InvalidMultiXactId diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index e4340b59640..8d1644f6988 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -900,9 +900,10 @@ TwoPhaseGetXidByVirtualXID(VirtualTransactionId vxid, * Get the dummy proc number for prepared transaction * * Dummy proc numbers are similar to proc numbers of real backends. They - * start at MaxBackends, and are unique across all currently active real - * backends and prepared transactions. If lock_held is set to true, - * TwoPhaseStateLock will not be taken, so the caller had better hold it. + * start at MaxBackends + NUM_AUXILIARY_PROCS, and are unique across all + * currently active real backends and prepared transactions. If lock_held + * is set to true, TwoPhaseStateLock will not be taken, so the caller had + * better hold it. */ ProcNumber TwoPhaseGetDummyProcNumber(FullTransactionId fxid, bool lock_held) -- 2.50.1 (Apple Git-155)