Hello, everyone!
With winter approaching, it’s the perfect time to dive back into work on this patch! :)
The first attached patch implements Matthias's idea of periodically resetting the snapshot during the initial heap scan. The next step will be to add support for parallel builds.
Additionally, here are a few comments on previous emails:
> In heapam_index_build_range_scan, it seems like you're popping the
> snapshot and registering a new one while holding a tuple from
> heap_getnext(), thus while holding a page lock. I'm not so sure that's
> OK, expecially when catalogs are also involved (specifically for
> expression indexes, where functions could potentially be updated or
> dropped if we re-create the visibility snapshot)
Now, visibility snapshots are updated between pages.
As for the catalog snapshot:
* Dropping functions isn’t possible due to dependencies and locking constraints.
* Updating functions is possible, but it offers the same level of isolation as we have now:
1) Functions are already converted into an execution state and aren’t re-read from the catalog during the scan.
2) During the validation phase, the latest version of a function will be used.
3) Even in the initial phase, predicates and expressions could be read using different catalog snapshots, as it’s possible to receive a cache invalidation message before the first FormIndexDatum is created.
Best regards,
Mikhail.