Skip to content

Commit 2aca19f

Browse files
committed
Use WaitLatch() instead of pg_usleep() at the end of backups
This concerns pg_stop_backup() and BASE_BACKUP, when waiting for the WAL segments required for a backup to be archived. This simplifies a bit the handling of the wait event used in this code path. Author: Bharath Rupireddy Reviewed-by: Michael Paquier, Stephen Frost Discussion: https://postgr.es/m/CALj2ACU4AdPCq6NLfcA-ZGwX7pPCK5FgEj-CAU0xCKzkASSy_A@mail.gmail.com
1 parent 9753324 commit 2aca19f

File tree

1 file changed

+5
-3
lines changed
  • src/backend/access/transam

1 file changed

+5
-3
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11638,9 +11638,11 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
1163811638
reported_waiting = true;
1163911639
}
1164011640

11641-
pgstat_report_wait_start(WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE);
11642-
pg_usleep(1000000L);
11643-
pgstat_report_wait_end();
11641+
(void) WaitLatch(MyLatch,
11642+
WL_LATCH_SET | WL_TIMEOUT | WL_EXIT_ON_PM_DEATH,
11643+
1000L,
11644+
WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE);
11645+
ResetLatch(MyLatch);
1164411646

1164511647
if (++waits >= seconds_before_warning)
1164611648
{

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