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

Commit95d1b41

Browse files
Reset hot standby xmin after restart
Hot_standby_feedback could be reset by reload and worked correctly, but ifthe server was restarted rather than reloaded the xmin was not reset.Force reset always if hot_standby_feedback is enabled at startup.Ants Aasma, Craig RingerReported-by: Ants Aasma
1 parent2dfc126 commit95d1b41

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

‎src/backend/replication/walreceiver.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,10 @@ XLogWalRcvSendReply(bool force, bool requestReply)
11541154
* in case they don't have a watch.
11551155
*
11561156
* If the user disables feedback, send one final message to tell sender
1157-
* to forget about the xmin on this standby.
1157+
* to forget about the xmin on this standby. We also send this message
1158+
* on first connect because a previous connection might have set xmin
1159+
* on a replication slot. (If we're not using a slot it's harmless to
1160+
* send a feedback message explicitly setting InvalidTransactionId).
11581161
*/
11591162
staticvoid
11601163
XLogWalRcvSendHSFeedback(boolimmed)
@@ -1164,7 +1167,8 @@ XLogWalRcvSendHSFeedback(bool immed)
11641167
uint32nextEpoch;
11651168
TransactionIdxmin;
11661169
staticTimestampTzsendTime=0;
1167-
staticboolmaster_has_standby_xmin= false;
1170+
/* initially true so we always send at least one feedback message */
1171+
staticboolmaster_has_standby_xmin= true;
11681172

11691173
/*
11701174
* If the user doesn't want status to be reported to the master, be sure
@@ -1189,14 +1193,17 @@ XLogWalRcvSendHSFeedback(bool immed)
11891193
}
11901194

11911195
/*
1192-
* If Hot Standby is not yet active there is nothing to send. Check this
1193-
* after the interval has expired to reduce number of calls.
1196+
* If Hot Standby is not yet accepting connections there is nothing to
1197+
* send. Check this after the interval has expired to reduce number of
1198+
* calls.
1199+
*
1200+
* Bailing out here also ensures that we don't send feedback until we've
1201+
* read our own replication slot state, so we don't tell the master to
1202+
* discard needed xmin or catalog_xmin from any slots that may exist
1203+
* on this replica.
11941204
*/
11951205
if (!HotStandbyActive())
1196-
{
1197-
Assert(!master_has_standby_xmin);
11981206
return;
1199-
}
12001207

12011208
/*
12021209
* Make the expensive call to get the oldest xmin once we are certain

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp