Skip to content

Commit 1c563a2

Browse files
Clarify when to use PageSetLSN/PageGetLSN().
Update README to explain prerequisites for correct access to LSN fields of a page. Independent chunk removed from checksums patch to reduce size of patch.
1 parent a068c39 commit 1c563a2

File tree

1 file changed

+8
-0
lines changed
  • src/backend/access/transam

1 file changed

+8
-0
lines changed

src/backend/access/transam/README

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,14 @@ something like
564564
if (BufferIsValid(buffer0))
565565
UnlockReleaseBuffer(buffer0);
566566

567+
Note that we must only use PageSetLSN/PageGetLSN() when we know the action
568+
is serialised. Only Startup process may modify data blocks during recovery,
569+
so Startup process may execute PageGetLSN() without fear of serialisation
570+
problems. All other processes must only call PageSet/GetLSN when holding
571+
either an exclusive buffer lock or a shared lock plus buffer header lock,
572+
or be writing the data block directly rather than through shared buffers
573+
while holding AccessExclusiveLock on the relation.
574+
567575
Due to all these constraints, complex changes (such as a multilevel index
568576
insertion) normally need to be described by a series of atomic-action WAL
569577
records. What do you do if the intermediate states are not self-consistent?

0 commit comments

Comments
 (0)