diff options
author | Bruce Momjian <bruce@momjian.us> | 2021-03-10 17:03:10 -0500 |
---|---|---|
committer | Bruce Momjian <bruce@momjian.us> | 2021-03-10 17:03:10 -0500 |
commit | 845ac7f847a25505e91f30dca4e0330b25785ee0 (patch) | |
tree | b385d914cbea06df30687953f6de27075c8865c6 /src/include/access/gist.h | |
parent | d87251048a0f293ad20cc1fe26ce9f542de105e6 (diff) | |
download | postgresql-845ac7f847a25505e91f30dca4e0330b25785ee0.tar.gz postgresql-845ac7f847a25505e91f30dca4e0330b25785ee0.zip |
C comments: improve description of GiST NSN and GistBuildLSN
GiST indexes are complex, so adding more details in the code might help
someone.
Discussion: https://postgr.es/m/20210302164021.GA364@momjian.us
Diffstat (limited to 'src/include/access/gist.h')
-rw-r--r-- | src/include/access/gist.h | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/src/include/access/gist.h b/src/include/access/gist.h index aa5f1763dd0..4b06575d987 100644 --- a/src/include/access/gist.h +++ b/src/include/access/gist.h @@ -51,13 +51,20 @@ #define F_HAS_GARBAGE (1 << 4) /* some tuples on the page are dead, * but not deleted yet */ -/* NSN - node sequence number, a special-purpose LSN */ +/* + * NSN (node sequence number) is a special-purpose LSN which is stored on each + * index page in GISTPageOpaqueData and updated only during page splits. By + * recording the parent's LSN in GISTSearchItem.parentlsn, it is possible to + * detect concurrent child page splits by checking if parentlsn < child's NSN, + * and handle them properly. The child page's LSN is insufficient for this + * purpose since it is updated for every page change. + */ typedef XLogRecPtr GistNSN; /* - * A bogus LSN / NSN value used during index build. Must be smaller than any - * real or fake unlogged LSN, so that after an index build finishes, all the - * splits are considered completed. + * A fake LSN / NSN value used during index builds. Must be smaller than any + * real or fake (unlogged) LSN generated after the index build completes so + * that all splits are considered complete. */ #define GistBuildLSN ((XLogRecPtr) 1) |