diff options
author | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-06-30 18:30:32 +0300 |
---|---|---|
committer | Heikki Linnakangas <heikki.linnakangas@iki.fi> | 2023-06-30 18:30:32 +0300 |
commit | a0dd4c95b9dfb9ed679ff8aa6a3beab98969034f (patch) | |
tree | dc7510feaa22703afe84e274b578eead04aab940 /src | |
parent | 054ff3b33a85d62b4d486dabb5e5718399822a18 (diff) | |
download | postgresql-a0dd4c95b9dfb9ed679ff8aa6a3beab98969034f.tar.gz postgresql-a0dd4c95b9dfb9ed679ff8aa6a3beab98969034f.zip |
Improve comment on why we need ctid->(cmin,cmax) mapping.
Combocids are only part of the problem. Explain the problem in more detail.
Reviewed-by: Andres Freund
Discussion: https://www.postgresql.org/message-id/1ba2899e-77f8-7866-79e5-f3b7d1251a3e@iki.fi
Diffstat (limited to 'src')
-rw-r--r-- | src/backend/replication/logical/snapbuild.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/replication/logical/snapbuild.c b/src/backend/replication/logical/snapbuild.c index 0786bb0ab71..e403feeccda 100644 --- a/src/backend/replication/logical/snapbuild.c +++ b/src/backend/replication/logical/snapbuild.c @@ -41,10 +41,15 @@ * transactions we need Snapshots that see intermediate versions of the * catalog in a transaction. During normal operation this is achieved by using * CommandIds/cmin/cmax. The problem with that however is that for space - * efficiency reasons only one value of that is stored - * (cf. combocid.c). Since combo CIDs are only available in memory we log - * additional information which allows us to get the original (cmin, cmax) - * pair during visibility checks. Check the reorderbuffer.c's comment above + * efficiency reasons, the cmin and cmax are not included in WAL records. We + * cannot read the cmin/cmax from the tuple itself, either, because it is + * reset on crash recovery. Even if we could, we could not decode combocids + * which are only tracked in the original backend's memory. To work around + * that, heapam writes an extra WAL record (XLOG_HEAP2_NEW_CID) every time a + * catalog row is modified, which includes the cmin and cmax of the + * tuple. During decoding, we insert the ctid->(cmin,cmax) mappings into the + * reorder buffer, and use them at visibility checks instead of the cmin/cmax + * on the tuple itself. Check the reorderbuffer.c's comment above * ResolveCminCmaxDuringDecoding() for details. * * To facilitate all this we need our own visibility routine, as the normal |