From c7865aed84942e76d88fc08fdbce74e2b001cec2 Mon Sep 17 00:00:00 2001 From: Vignesh Date: Thu, 13 Mar 2025 14:01:03 +0530 Subject: [PATCH] Fix an intermetant BF failure in 004_subscription. During upgrade, when pg_restore performs CREATE DATABASE, bgwriter or checkpointer may flush buffers and hold a file handle for pg_largeobject, so later TRUNCATE pg_largeobject command will fail if OS (such as older Windows versions) doesn't remove an unlinked file completely till it's open. --- src/bin/pg_upgrade/t/004_subscription.pl | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/bin/pg_upgrade/t/004_subscription.pl b/src/bin/pg_upgrade/t/004_subscription.pl index e3ccff9f270..9510e32a7e3 100644 --- a/src/bin/pg_upgrade/t/004_subscription.pl +++ b/src/bin/pg_upgrade/t/004_subscription.pl @@ -29,6 +29,19 @@ my $oldbindir = $old_sub->config_data('--bindir'); # Initialize the new subscriber my $new_sub = PostgreSQL::Test::Cluster->new('new_sub'); $new_sub->init; + +# During upgrade, when pg_restore performs CREATE DATABASE, bgwriter or +# checkpointer may flush buffers and hold a file handle for the system table. +# So, if later due to some reason we need to re-create the file with the same +# name like a TRUNCATE command on the same table, then the command will fail +# if OS (such as older Windows versions) doesn't remove an unlinked file +# completely till it is open. +$new_sub->append_conf( + 'postgresql.conf', q{ +bgwriter_lru_maxpages = 0 +checkpoint_timeout = 1h +}); + my $newbindir = $new_sub->config_data('--bindir'); # In a VPATH build, we'll be started in the source directory, but we want -- 2.43.0