=== Applying patches on top of PostgreSQL commit ID 514bfe2c6dffba2d7a6b7ea7cf029e04a7c41563 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Thu Nov 19 12:37:31 UTC 2026 On branch cf/7280 nothing to commit, working tree clean === using 'git am' to apply patch ./v4-index-maintenance-io.patch === Applying: Use maintenance I/O concurrency for index builds and table rewrites Using index info to reconstruct a base tree... M src/backend/access/heap/heapam.c M src/include/access/tableam.h Falling back to patching base and 3-way merge... Auto-merging src/include/access/tableam.h Auto-merging src/backend/access/heap/heapam.c CONFLICT (content): Merge conflict in src/backend/access/heap/heapam.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 Use maintenance I/O concurrency for index builds and table rewrites When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". === using patch(1) to apply patch ./v4-index-maintenance-io.patch === patching file src/backend/access/brin/brin.c patching file src/backend/access/gin/gininsert.c patching file src/backend/access/heap/heapam.c Hunk #1 FAILED at 1283. Hunk #2 FAILED at 1296. 2 out of 2 hunks FAILED -- saving rejects to file src/backend/access/heap/heapam.c.rej patching file src/backend/access/heap/heapam_handler.c patching file src/backend/access/nbtree/nbtsort.c patching file src/include/access/tableam.h Unstaged changes after reset: M src/backend/access/brin/brin.c M src/backend/access/gin/gininsert.c M src/backend/access/heap/heapam_handler.c M src/backend/access/nbtree/nbtsort.c M src/include/access/tableam.h Removing src/backend/access/heap/heapam.c.rej === using 'git apply' to apply patch ./v4-index-maintenance-io.patch === Applied patch to 'src/backend/access/brin/brin.c' cleanly. Applied patch to 'src/backend/access/gin/gininsert.c' cleanly. Applied patch to 'src/backend/access/heap/heapam.c' with conflicts. Applied patch to 'src/backend/access/heap/heapam_handler.c' cleanly. Applied patch to 'src/backend/access/nbtree/nbtsort.c' cleanly. Applied patch to 'src/include/access/tableam.h' cleanly. U src/backend/access/heap/heapam.c diff --cc src/backend/access/heap/heapam.c index 67073fff6b7,800ac470e2e..00000000000 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@@ -1343,8 -1270,63 +1343,65 @@@ heap_beginscan(Relation relation, Snaps else scan->rs_base.rs_key = NULL; - initscan(scan, key, false); - scan->rs_read_stream = NULL; ++<<<<<<< ours + initscan(scan, key, false); ++======= + + /* + * Set up a read stream for sequential scans and TID range scans. This + * should be done after initscan() because initscan() allocates the + * BufferAccessStrategy object passed to the read stream API. + */ + if (scan->rs_base.rs_flags & SO_TYPE_SEQSCAN || + scan->rs_base.rs_flags & SO_TYPE_TIDRANGESCAN) + { + ReadStreamBlockNumberCB cb; + int stream_flags = READ_STREAM_SEQUENTIAL | READ_STREAM_USE_BATCHING; + + if (scan->rs_base.rs_flags & SO_MAINTENANCE) + stream_flags |= READ_STREAM_MAINTENANCE; + + if (scan->rs_base.rs_parallel) + cb = heap_scan_stream_read_next_parallel; + else + cb = heap_scan_stream_read_next_serial; + + /* --- + * It is safe to use batchmode as the only locks taken by `cb` + * are never taken while waiting for IO: + * - SyncScanLock is used in the non-parallel case + * - in the parallel case, only spinlocks and atomics are used + * --- + */ + scan->rs_read_stream = read_stream_begin_relation(stream_flags, + scan->rs_strategy, + scan->rs_base.rs_rd, + MAIN_FORKNUM, + cb, + scan, + 0); + } + else if (scan->rs_base.rs_flags & SO_TYPE_BITMAPSCAN) + { + scan->rs_read_stream = read_stream_begin_relation(READ_STREAM_DEFAULT | + READ_STREAM_USE_BATCHING, + scan->rs_strategy, + scan->rs_base.rs_rd, + MAIN_FORKNUM, + bitmapheap_stream_read_next, + scan, + sizeof(TBMIterateResult)); + } + + /* enable read stream instrumentation */ + if ((flags & SO_SCAN_INSTRUMENT) && (scan->rs_read_stream != NULL)) + { + scan->rs_base.rs_instrument = palloc0_object(TableScanInstrumentation); + read_stream_enable_stats(scan->rs_read_stream, + &scan->rs_base.rs_instrument->io); + } ++>>>>>>> theirs scan->rs_vmbuffer = InvalidBuffer;