Repository navigation
v4: absorb main 3.5.0, part 6 - sentinel: async discovery and recovery (#3301) - #3410
Merged
Merged
Conversation
…port of main #3301) Main's sentinel rework applies to v4 almost unchanged: the sentinel file is main's, with the role re-read for a reported primary that is still a replica going through v4's TryRefreshRole (ROLE) rather than main's CheckInfoReplicationAsync (INFO via the old bridge). - READONLY on a sentinel-managed connection: main hooks ResultProcessor's common error handling; v4 does the same in RespClientConnection.TryHandOff, which sees every reply. It only marks the node as a replica; the sentinel heartbeat resolves the primary. - ConnectImplAsync gains main's endpoints and synchronousConnect parameters alongside v4's groupClientCache. Two v4 core bugs the new tests exposed: - RespTopology.WantsRoles was decided from the configured endpoints. A sentinel-managed connection is configured with the sentinel and handed the primary and replicas separately, so it never re-read roles on a reconfigure, and a switch to a primary it had not seen left the demoted node recorded as a primary for good (SwitchRequestedDuringDiscoveryIsReplayed). It now uses the multiplexer's own endpoints, and is always on for a sentinel-managed (non-sentinel) multiplexer. - The core's per-endpoint callbacks created a ServerEndPoint when asked for one. A heartbeat role read that captured an executor just before its endpoint was retired failed with "no connection", and describing that failure re-created the retired server, which then kept the client on the node sentinel had told it to leave (SeededClientLeavesTheSentinelHost..., intermittently, under load). ModelledServer, and the no-connection message, now only look the server up. Test adjustments for v4: - HandlerSubscribedWhileStuckReceivesMessagesAfterRecovery: v4 does not queue a subscribe with no server; it registers the handler and completes, and the subscription is restored on connect. The test's point (the handler receives messages after recovery) holds. - FailedInfoWriteDoesNotCountAsAReplicationCheck asks TryRefreshRole. - ConnectionsTo counts the dedicated subscription socket via the core: v4's IsSubscriberConnected says subscriptions are available, not that their lazily dialled socket is open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Sixth slice of absorbing main's 3.5.0 into v4 (after #3403, #3406–#3409), and the first of the sentinel batch: main's #3301.
What carries over unchanged
Main's sentinel file applies as-is: async discovery, held-down primaries, seeded connections, switch replay and a sync connect that blocks no worker. The one exception is the role re-read for a reported primary that is still a replica. On v4 that goes through
TryRefreshRole(ROLE), not main'sCheckInfoReplicationAsync(INFOvia the old bridge). Main's tests anddocs/Configuration.mdcome across too.Mapped onto v4
READONLYon a sentinel-managed connection. Main hooksResultProcessor's common error handling; v4 does the same inRespClientConnection.TryHandOff, which sees every reply. It only marks the node as a replica; the sentinel heartbeat resolves the primary.ConnectImplAsyncgains main'sendpoints/synchronousConnectparameters alongside v4'sgroupClientCache.Two v4 core bugs the new tests exposed
RespTopology.WantsRoleswas decided from the configured endpoints. A sentinel-managed connection is configured with the sentinel and handed the primary and replicas separately, so a reconfigure never askedROLE. After a switch to a primary it hadn't seen, the demoted node stayed recorded as a primary for good (SwitchRequestedDuringDiscoveryIsReplayed). It now uses the multiplexer's own endpoints, and is always on for a sentinel-managed (non-sentinel) multiplexer.ServerEndPointwhen asked for one. Sometimes a heartbeat role read captured an executor just before its endpoint was retired. ItsROLEthen failed with "no connection", and describing that failure re-created the server, which kept the client on the node sentinel had told it to leave. This failedSeededClientLeavesTheSentinelHost…intermittently, and only under full-suite load; a probe in a failing run pinned it to that path.ModelledServerwas documented as "if it models one", and it and the no-connection message now only look the server up.Test adjustments for v4
HandlerSubscribedWhileStuckReceivesMessagesAfterRecovery: v4 doesn't queue a subscribe that has no server. It registers the handler and completes, and the subscription is restored on connect. What the test is about (the handler receives messages after recovery) holds.FailedInfoWriteDoesNotCountAsAReplicationCheckasksTryRefreshRole.ConnectionsTocounts the dedicated subscription socket through the core: v4'sIsSubscriberConnectedsays subscriptions are available, not that their lazily dialled socket is open.Tests