File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -1181,6 +1181,9 @@ SELECT current_setting('fsync') = 'off'
11811181-- from it to cause it to be read back into shared buffers.
11821182SELECT sum(reads) AS io_sum_shared_before_reads
11831183 FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1184+ -- Do this in a transaction to prevent spurious failures due to concurrent accesses to our newly
1185+ -- rewritten table, e.g. by autovacuum.
1186+ BEGIN;
11841187ALTER TABLE test_io_shared SET TABLESPACE regress_tblspace;
11851188-- SELECT from the table so that the data is read into shared buffers and
11861189-- io_context 'normal', io_object 'relation' reads are counted.
@@ -1190,6 +1193,7 @@ SELECT COUNT(*) FROM test_io_shared;
11901193 100
11911194(1 row)
11921195
1196+ COMMIT;
11931197SELECT pg_stat_force_next_flush();
11941198 pg_stat_force_next_flush
11951199--------------------------
Original file line number Diff line number Diff line change @@ -576,10 +576,14 @@ SELECT current_setting('fsync') = 'off'
576576-- from it to cause it to be read back into shared buffers.
577577SELECT sum (reads) AS io_sum_shared_before_reads
578578 FROM pg_stat_io WHERE io_context = ' normal' AND io_object = ' relation' \gset
579+ -- Do this in a transaction to prevent spurious failures due to concurrent accesses to our newly
580+ -- rewritten table, e.g. by autovacuum.
581+ BEGIN ;
579582ALTER TABLE test_io_shared SET TABLESPACE regress_tblspace;
580583-- SELECT from the table so that the data is read into shared buffers and
581584-- io_context 'normal', io_object 'relation' reads are counted.
582585SELECT COUNT (* ) FROM test_io_shared;
586+ COMMIT ;
583587SELECT pg_stat_force_next_flush();
584588SELECT sum (reads) AS io_sum_shared_after_reads
585589 FROM pg_stat_io WHERE io_context = ' normal' AND io_object = ' relation' \gset
You can’t perform that action at this time.
0 commit comments