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

Commit048d441

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 parent2e024f8 commit048d441

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
@@ -1095,7 +1095,10 @@ XLogWalRcvSendReply(bool force, bool requestReply)
10951095
* in case they don't have a watch.
10961096
*
10971097
* If the user disables feedback, send one final message to tell sender
1098-
* to forget about the xmin on this standby.
1098+
* to forget about the xmin on this standby. We also send this message
1099+
* on first connect because a previous connection might have set xmin
1100+
* on a replication slot. (If we're not using a slot it's harmless to
1101+
* send a feedback message explicitly setting InvalidTransactionId).
10991102
*/
11001103
staticvoid
11011104
XLogWalRcvSendHSFeedback(boolimmed)
@@ -1105,7 +1108,8 @@ XLogWalRcvSendHSFeedback(bool immed)
11051108
uint32nextEpoch;
11061109
TransactionIdxmin;
11071110
staticTimestampTzsendTime=0;
1108-
staticboolmaster_has_standby_xmin= false;
1111+
/* initially true so we always send at least one feedback message */
1112+
staticboolmaster_has_standby_xmin= true;
11091113

11101114
/*
11111115
* If the user doesn't want status to be reported to the master, be sure
@@ -1130,14 +1134,17 @@ XLogWalRcvSendHSFeedback(bool immed)
11301134
}
11311135

11321136
/*
1133-
* If Hot Standby is not yet active there is nothing to send. Check this
1134-
* after the interval has expired to reduce number of calls.
1137+
* If Hot Standby is not yet accepting connections there is nothing to
1138+
* send. Check this after the interval has expired to reduce number of
1139+
* calls.
1140+
*
1141+
* Bailing out here also ensures that we don't send feedback until we've
1142+
* read our own replication slot state, so we don't tell the master to
1143+
* discard needed xmin or catalog_xmin from any slots that may exist
1144+
* on this replica.
11351145
*/
11361146
if (!HotStandbyActive())
1137-
{
1138-
Assert(!master_has_standby_xmin);
11391147
return;
1140-
}
11411148

11421149
/*
11431150
* Make the expensive call to get the oldest xmin once we are certain

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp