Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfd5942c

Browse files
committed
Use the regular main processing loop also in walsenders.
The regular backend's main loop handles signal handling and error recoverybetter than the current WAL sender command loop does. For example, if theclient hangs and a SIGTERM is received before starting streaming, thewalsender will now terminate immediately, rather than hang until theconnection times out.
1 parent1997f34 commitfd5942c

File tree

4 files changed

+109
-232
lines changed

4 files changed

+109
-232
lines changed

‎src/backend/replication/basebackup.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#include"lib/stringinfo.h"
2323
#include"libpq/libpq.h"
2424
#include"libpq/pqformat.h"
25+
#include"miscadmin.h"
2526
#include"nodes/pg_list.h"
2627
#include"replication/basebackup.h"
2728
#include"replication/walsender.h"
@@ -30,7 +31,6 @@
3031
#include"storage/ipc.h"
3132
#include"utils/builtins.h"
3233
#include"utils/elog.h"
33-
#include"utils/memutils.h"
3434
#include"utils/ps_status.h"
3535

3636
typedefstruct
@@ -370,19 +370,10 @@ void
370370
SendBaseBackup(BaseBackupCmd*cmd)
371371
{
372372
DIR*dir;
373-
MemoryContextbackup_context;
374-
MemoryContextold_context;
375373
basebackup_optionsopt;
376374

377375
parse_basebackup_options(cmd->options,&opt);
378376

379-
backup_context=AllocSetContextCreate(CurrentMemoryContext,
380-
"Streaming base backup context",
381-
ALLOCSET_DEFAULT_MINSIZE,
382-
ALLOCSET_DEFAULT_INITSIZE,
383-
ALLOCSET_DEFAULT_MAXSIZE);
384-
old_context=MemoryContextSwitchTo(backup_context);
385-
386377
WalSndSetState(WALSNDSTATE_BACKUP);
387378

388379
if (update_process_title)
@@ -403,9 +394,6 @@ SendBaseBackup(BaseBackupCmd *cmd)
403394
perform_base_backup(&opt,dir);
404395

405396
FreeDir(dir);
406-
407-
MemoryContextSwitchTo(old_context);
408-
MemoryContextDelete(backup_context);
409397
}
410398

411399
staticvoid
@@ -606,7 +594,7 @@ sendDir(char *path, int basepathlen, bool sizeonly)
606594
* error in that case. The error handler further up will call
607595
* do_pg_abort_backup() for us.
608596
*/
609-
if (walsender_shutdown_requested||walsender_ready_to_stop)
597+
if (ProcDiePending||walsender_ready_to_stop)
610598
ereport(ERROR,
611599
(errmsg("shutdown requested, aborting active base backup")));
612600

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp