Skip to content

Commit c289117

Browse files
committed
Try to fix pg_upgrade test on Windows, again.
Further to commit 54e72b6, 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
1 parent 758f44b commit c289117

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

src/bin/pg_upgrade/util.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,12 @@ cleanup_output_dirs(void)
6868
if (log_opts.retain)
6969
return;
7070

71-
(void) rmtree(log_opts.basedir, true);
71+
/*
72+
* Try twice. The second time might wait for files to finish being
73+
* unlinked, on Windows.
74+
*/
75+
if (!rmtree(log_opts.basedir, true))
76+
rmtree(log_opts.basedir, true);
7277

7378
/* Remove pg_upgrade_output.d only if empty */
7479
switch (pg_check_dir(log_opts.rootdir))
@@ -80,7 +85,13 @@ cleanup_output_dirs(void)
8085

8186
case 1: /* exists and empty */
8287
case 2: /* exists and contains only dot files */
83-
(void) rmtree(log_opts.rootdir, true);
88+
89+
/*
90+
* Try twice. The second time might wait for files to finish
91+
* being unlinked, on Windows.
92+
*/
93+
if (!rmtree(log_opts.rootdir, true))
94+
rmtree(log_opts.rootdir, true);
8495
break;
8596

8697
case 4: /* exists */

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy