@@ -1663,6 +1663,15 @@ lazy_cleanup_index(Relation indrel,
16631663 * Don't even think about it unless we have a shot at releasing a goodly
16641664 * number of pages. Otherwise, the time taken isn't worth it.
16651665 *
1666+ * Also don't attempt it if we are doing early pruning/vacuuming, because a
1667+ * scan which cannot find a truncated heap page cannot determine that the
1668+ * snapshot is too old to read that page. We might be able to get away with
1669+ * truncating all except one of the pages, setting its LSN to (at least) the
1670+ * maximum of the truncated range if we also treated an index leaf tuple
1671+ * pointing to a missing heap page as something to trigger the "snapshot too
1672+ * old" error, but that seems fragile and seems like it deserves its own patch
1673+ * if we consider it.
1674+ *
16661675 * This is split out so that we can test whether truncation is going to be
16671676 * called for before we actually do it. If you change the logic here, be
16681677 * careful to depend only on fields that lazy_scan_heap updates on-the-fly.