Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Add maintenance_io_concurrency flag to some read stream users master github/master
authorMelanie Plageman <melanieplageman@gmail.com>
Mon, 28 Apr 2025 18:19:45 +0000 (14:19 -0400)
committerMelanie Plageman <melanieplageman@gmail.com>
Mon, 28 Apr 2025 18:19:45 +0000 (14:19 -0400)
Index vacuuming and [auto]prewarm AIO concurrency should be governed by
maintenance_io_concurrency. As such, pass those read stream users the
READ_STREAM_MAINTENANCE flag which will calculate their read stream
distance with maintenance_io_concurrency instead of
effective_io_concurrency. This was an oversight in the original commits
making those operations use the read stream API.

Discussion: https://postgr.es/m/flat/CAAKRu_aopDxTo4b41Mt_7Zc-z0_ngocrY8SFCCY6Aph1HgwuNw%40mail.gmail.com

contrib/pg_prewarm/autoprewarm.c
contrib/pg_prewarm/pg_prewarm.c
src/backend/access/gist/gistvacuum.c
src/backend/access/nbtree/nbtree.c
src/backend/access/spgist/spgvacuum.c

index bde0523f082cdfb4b8e270de22050706680bb28d..c52f4d4dc9ea2b2a08ce1f8e206412e2059147eb 100644 (file)
@@ -621,7 +621,8 @@ autoprewarm_database_main(Datum main_arg)
                    .nblocks = nblocks,
            };
 
-           stream = read_stream_begin_relation(READ_STREAM_DEFAULT |
+           stream = read_stream_begin_relation(READ_STREAM_MAINTENANCE |
+                                               READ_STREAM_DEFAULT |
                                                READ_STREAM_USE_BATCHING,
                                                NULL,
                                                rel,
index c0efb530c4e5f9b1dc017375be960b959f980516..50808569bd7416d94a75aef94b18c94baee08065 100644 (file)
@@ -202,7 +202,8 @@ pg_prewarm(PG_FUNCTION_ARGS)
         * It is safe to use batchmode as block_range_read_stream_cb takes no
         * locks.
         */
-       stream = read_stream_begin_relation(READ_STREAM_FULL |
+       stream = read_stream_begin_relation(READ_STREAM_MAINTENANCE |
+                                           READ_STREAM_FULL |
                                            READ_STREAM_USE_BATCHING,
                                            NULL,
                                            rel,
index 6a359c98c608e703c5f687f71e4501b18bf91aeb..dca236b6e57359b85bbe1554315ffcfbd1174d5d 100644 (file)
@@ -215,7 +215,8 @@ gistvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
     * It is safe to use batchmode as block_range_read_stream_cb takes no
     * locks.
     */
-   stream = read_stream_begin_relation(READ_STREAM_FULL |
+   stream = read_stream_begin_relation(READ_STREAM_MAINTENANCE |
+                                       READ_STREAM_FULL |
                                        READ_STREAM_USE_BATCHING,
                                        info->strategy,
                                        rel,
index accc7fe8bbe8bde4f0e155552e69b7436b97500d..765659887af735a4741cb8d0d059fad68a95e53e 100644 (file)
@@ -1232,7 +1232,8 @@ btvacuumscan(IndexVacuumInfo *info, IndexBulkDeleteResult *stats,
     * It is safe to use batchmode as block_range_read_stream_cb takes no
     * locks.
     */
-   stream = read_stream_begin_relation(READ_STREAM_FULL |
+   stream = read_stream_begin_relation(READ_STREAM_MAINTENANCE |
+                                       READ_STREAM_FULL |
                                        READ_STREAM_USE_BATCHING,
                                        info->strategy,
                                        rel,
index 81171f354518e8d59302e6d68180f3c8bf7120b0..2678f7ab7829aac0b3df6bb866fbaa2873abd033 100644 (file)
@@ -827,7 +827,8 @@ spgvacuumscan(spgBulkDeleteState *bds)
     * It is safe to use batchmode as block_range_read_stream_cb takes no
     * locks.
     */
-   stream = read_stream_begin_relation(READ_STREAM_FULL |
+   stream = read_stream_begin_relation(READ_STREAM_MAINTENANCE |
+                                       READ_STREAM_FULL |
                                        READ_STREAM_USE_BATCHING,
                                        bds->info->strategy,
                                        index,