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

Commitf9a576b

Browse files
committed
Don't WaitForBackgroundWorkerStartup in monitor.
It doesn't really give us anything and erroneous as process might immediatelyexit, forcing monitor ERROR and restart. Also fix non-transactionality of slotcreation in the latter case.
1 parent33db8d7 commitf9a576b

File tree

1 file changed

+32
-21
lines changed

1 file changed

+32
-21
lines changed

‎src/state.c‎

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3648,9 +3648,6 @@ MtmBgwStart(MtmBgw *bgw)
36483648
bgw->name),
36493649
errhint("You may need to increase max_worker_processes.")));
36503650

3651-
status=WaitForBackgroundWorkerStartup(bgw->handle,&pid);
3652-
if (status!=BGWH_STARTED)
3653-
mtm_log(ERROR,"failed to start background process %s",bgw->name);
36543651
bgw->last_start_time=GetCurrentTimestamp();
36553652
}
36563653

@@ -3749,12 +3746,19 @@ start_node_workers(int node_id, MtmConfig *new_cfg, Datum arg)
37493746
* Create filter slot to filter out already applied changes since the
37503747
* last syncpoint during replication start
37513748
*/
3752-
ReplicationSlotCreate(filter_slot, false,RS_PERSISTENT);
3753-
ReplicationSlotReserveWal();
3754-
/* Write this slot to disk */
3755-
ReplicationSlotMarkDirty();
3756-
ReplicationSlotSave();
3757-
ReplicationSlotRelease();
3749+
/* slot might be already created if we failed before setting init_done */
3750+
intacq=ReplicationSlotAcquire(filter_slot,SAB_Inquire);
3751+
if (acq==0)
3752+
ReplicationSlotRelease();
3753+
elseif (acq==-1)
3754+
{
3755+
ReplicationSlotCreate(filter_slot, false,RS_PERSISTENT);
3756+
ReplicationSlotReserveWal();
3757+
/* Write this slot to disk */
3758+
ReplicationSlotMarkDirty();
3759+
ReplicationSlotSave();
3760+
ReplicationSlotRelease();
3761+
}
37583762
}
37593763

37603764
/* Add dmq destination */
@@ -3789,18 +3793,25 @@ start_node_workers(int node_id, MtmConfig *new_cfg, Datum arg)
37893793
intrc;
37903794

37913795
/* Create logical slot for our publication to this neighbour */
3792-
ReplicationSlotCreate(slot, true,RS_EPHEMERAL);
3793-
ctx=CreateInitDecodingContext(MULTIMASTER_NAME,NIL,
3794-
false,/* do not build snapshot */
3795-
InvalidXLogRecPtr,
3796-
XL_ROUTINE(.page_read=read_local_xlog_page,
3797-
.segment_open=wal_segment_open,
3798-
.segment_close=wal_segment_close),
3799-
NULL,NULL,NULL);
3800-
DecodingContextFindStartpoint(ctx);
3801-
FreeDecodingContext(ctx);
3802-
ReplicationSlotPersist();
3803-
ReplicationSlotRelease();
3796+
/* slot might be already created if we failed before setting init_done */
3797+
intacq=ReplicationSlotAcquire(slot,SAB_Inquire);
3798+
if (acq==0)
3799+
ReplicationSlotRelease();
3800+
elseif (acq==-1)
3801+
{
3802+
ReplicationSlotCreate(slot, true,RS_EPHEMERAL);
3803+
ctx=CreateInitDecodingContext(MULTIMASTER_NAME,NIL,
3804+
false,/* do not build snapshot */
3805+
InvalidXLogRecPtr,
3806+
XL_ROUTINE(.page_read=read_local_xlog_page,
3807+
.segment_open=wal_segment_open,
3808+
.segment_close=wal_segment_close),
3809+
NULL,NULL,NULL);
3810+
DecodingContextFindStartpoint(ctx);
3811+
FreeDecodingContext(ctx);
3812+
ReplicationSlotPersist();
3813+
ReplicationSlotRelease();
3814+
}
38043815

38053816
/*
38063817
* Mark this node as init_done, so at next boot we won't try to create

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp