On Fri, 19 Feb 2021 at 20:37, David Rowley <dgrowle...@gmail.com> wrote: > > On Thu, 18 Feb 2021 at 09:45, David Rowley <dgrowle...@gmail.com> wrote: > > > > On Wed, 17 Feb 2021 at 11:05, Andres Freund <and...@anarazel.de> wrote: > > > How does this interact with rescans? > > > > We must call table_rescan() before calling table_set_tidrange() again. > > That perhaps could be documented better. I'm just unsure if that > > should be documented in tableam.h or if it's a restriction that only > > needs to exist in heapam.c > > I've changed things around so that we no longer explicitly call > table_rescan() in nodeTidrangescan.c. Instead table_set_tidrange() > does a rescan call. I also adjusted the documentation to mention that > changing the tid range starts the scan again. This does mean we'll do > a ->scan_rescan() the first time we do table_set_tidrange(). I'm not > all that sure that matters.
I've pushed this now. I did end up changing the function name in tableam.h so that we no longer expose the table_set_tidrange(). Instead, the range is set by either table_beginscan_tidrange() or table_rescan_tidrange(). There's no need to worry about what would happen if someone were to change the TID range mid-scan. Apart from that, I adjusted a few comments and changed the regression tests a little to get rid of the tidrangescan_empty table. This was created to ensure empty tables work correctly. Instead, I just did those tests before populating the tidrangescan table. This just makes the test run a little faster since we're creating and dropping 1 less table. David