On 21/09/2020 12:06, Andrey M. Borodin wrote:
21 сент. 2020 г., в 13:45, Heikki Linnakangas <hlinn...@iki.fi>
написал(а):
Actually, don't we have a problem with that, even before this
patch? Even though we set the LSN to the magic GistBuildLSN value
when we build the index, WAL replay will write the LSN of the
record instead. That would mess with the LSN-NSN interlock. After
WAL replay (or in a streaming replica), a scan on the GiST index
might traverse right-links unnecessarily.
I think we don't set rightlinks during index build.
The new GiST sorting code does not, but the regular insert-based code does.
That's a bit questionable in the new code actually. Was that a conscious
decision? The right-links are only needed when there are concurrent page
splits, so I think it's OK, but the checks for InvalidBlockNumber in
gistScanPage() and gistFindPage() have comment "/* sanity check */".
Comment changes are needed, at least.
- Heikki