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

Commit6812330

Browse files
committed
Reorganize logical replication worker disconnect code
Move the walrcv_disconnect() calls into the before_shmem_exit handler.This makes sure the call is always made even during exit by signal, itsaves some duplicate code, and it makes the logic more similar towalreceiver.c.Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
1 parent2d46017 commit6812330

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

‎src/backend/replication/logical/launcher.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,13 @@ logicalrep_launcher_onexit(int code, Datum arg)
614614
staticvoid
615615
logicalrep_worker_onexit(intcode,Datumarg)
616616
{
617+
/* Disconnect gracefully from the remote side. */
618+
if (wrconn)
619+
walrcv_disconnect(wrconn);
620+
617621
logicalrep_worker_detach();
622+
623+
ApplyLauncherWakeup();
618624
}
619625

620626
/* SIGTERM: set flag to exit at next convenient time */

‎src/backend/replication/logical/tablesync.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,6 @@ finish_sync_worker(void)
140140
CommitTransactionCommand();
141141

142142
/* Stop gracefully */
143-
walrcv_disconnect(wrconn);
144143
proc_exit(0);
145144
}
146145

‎src/backend/replication/logical/worker.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,6 @@ reread_subscription(void)
13291329
"stop because the subscription was removed",
13301330
MySubscription->name)));
13311331

1332-
walrcv_disconnect(wrconn);
13331332
proc_exit(0);
13341333
}
13351334

@@ -1344,7 +1343,6 @@ reread_subscription(void)
13441343
"stop because the subscription was disabled",
13451344
MySubscription->name)));
13461345

1347-
walrcv_disconnect(wrconn);
13481346
proc_exit(0);
13491347
}
13501348

@@ -1359,7 +1357,6 @@ reread_subscription(void)
13591357
"restart because the connection information was changed",
13601358
MySubscription->name)));
13611359

1362-
walrcv_disconnect(wrconn);
13631360
proc_exit(0);
13641361
}
13651362

@@ -1374,7 +1371,6 @@ reread_subscription(void)
13741371
"restart because subscription was renamed",
13751372
MySubscription->name)));
13761373

1377-
walrcv_disconnect(wrconn);
13781374
proc_exit(0);
13791375
}
13801376

@@ -1392,7 +1388,6 @@ reread_subscription(void)
13921388
"restart because the replication slot name was changed",
13931389
MySubscription->name)));
13941390

1395-
walrcv_disconnect(wrconn);
13961391
proc_exit(0);
13971392
}
13981393

@@ -1407,7 +1402,6 @@ reread_subscription(void)
14071402
"restart because subscription's publications were changed",
14081403
MySubscription->name)));
14091404

1410-
walrcv_disconnect(wrconn);
14111405
proc_exit(0);
14121406
}
14131407

@@ -1610,8 +1604,6 @@ ApplyWorkerMain(Datum main_arg)
16101604
/* Run the main loop. */
16111605
LogicalRepApplyLoop(origin_startpos);
16121606

1613-
walrcv_disconnect(wrconn);
1614-
16151607
/* We should only get here if we received SIGTERM */
16161608
proc_exit(0);
16171609
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp