git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 758f44b)
Try to fix pg_upgrade test on Windows, again.
Wed, 1 Feb 2023 01:29:51 +0000 (14:29 +1300)
Wed, 1 Feb 2023 01:40:25 +0000 (14:40 +1300)
Further to commit 54e72b66e, if rmtree() fails while cleaning up in
pg_upgrade, try again. This gives our Windows unlink() wrapper a chance
to reach its wait-for-the-other-process-to-go-away logic, if the first
go around initiated the unlink of a file that a concurrently exiting
program still has open.

Discussion: https://postgr.es/m/CA%2BhUKGKCVy2%3Do%3Dd8c2Va6a_3Rpf_KkhUitkWCZ3hzuO2VwLMXA%40mail.gmail.com


diff --git a/src/bin/pg_upgrade/util.c b/src/bin/pg_upgrade/util.c
index 42dcbfc5b5c2b343f6b66b193483c45b588e68aa..21ba4c8f12b2314a4e3fbfe7a99a26f5fd6074e0 100644 (file)
--- a/src/bin/pg_upgrade/util.c
+++ b/src/bin/pg_upgrade/util.c
@@ -68,7 +68,12 @@ cleanup_output_dirs(void)
if (log_opts.retain)
return;
- (void) rmtree(log_opts.basedir, true);
+ /*
+ * Try twice. The second time might wait for files to finish being
+ * unlinked, on Windows.
+ */
+ if (!rmtree(log_opts.basedir, true))
+ rmtree(log_opts.basedir, true);
/* Remove pg_upgrade_output.d only if empty */
switch (pg_check_dir(log_opts.rootdir))
@@ -80,7 +85,13 @@ cleanup_output_dirs(void)
case 1: /* exists and empty */
case 2: /* exists and contains only dot files */
- (void) rmtree(log_opts.rootdir, true);
+
+ /*
+ * Try twice. The second time might wait for files to finish
+ * being unlinked, on Windows.
+ */
+ if (!rmtree(log_opts.rootdir, true))
+ rmtree(log_opts.rootdir, true);
break;
case 4: /* exists */
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /