File tree 2 files changed +8
-0
lines changed
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'
1181
1181
-- from it to cause it to be read back into shared buffers.
1182
1182
SELECT sum(reads) AS io_sum_shared_before_reads
1183
1183
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;
1184
1187
ALTER TABLE test_io_shared SET TABLESPACE regress_tblspace;
1185
1188
-- SELECT from the table so that the data is read into shared buffers and
1186
1189
-- io_context 'normal', io_object 'relation' reads are counted.
@@ -1190,6 +1193,7 @@ SELECT COUNT(*) FROM test_io_shared;
1190
1193
100
1191
1194
(1 row)
1192
1195
1196
+ COMMIT;
1193
1197
SELECT pg_stat_force_next_flush();
1194
1198
pg_stat_force_next_flush
1195
1199
--------------------------
Original file line number Diff line number Diff line change @@ -576,10 +576,14 @@ SELECT current_setting('fsync') = 'off'
576
576
-- from it to cause it to be read back into shared buffers.
577
577
SELECT sum (reads) AS io_sum_shared_before_reads
578
578
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 ;
579
582
ALTER TABLE test_io_shared SET TABLESPACE regress_tblspace;
580
583
-- SELECT from the table so that the data is read into shared buffers and
581
584
-- io_context 'normal', io_object 'relation' reads are counted.
582
585
SELECT COUNT (* ) FROM test_io_shared;
586
+ COMMIT ;
583
587
SELECT pg_stat_force_next_flush();
584
588
SELECT sum (reads) AS io_sum_shared_after_reads
585
589
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