Don't return cached heartbeat read when query service is down to avoi… #4689
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.
…d situation where replica tablet never recovers.
Closes #4673
The core of the problem in 4673, is that the HeartbeatReporter does not obey the contract expected by the healthcheck - that it reports a current reading of the health. I don't see a straightforward way to fix this without rewriting the reader entirely. The next best thing I could see to do was to return healthy when we knew the reader was closed and the query service was shutdown. This will force the healthcheck to attempt to restart the query service and if that fails, then it will report that error and remain unhealthy. I considered putting this logic in the reader, but if we only know the reader is closed then there's the possibility of a pathological situation where the query service is running and the reader is closed and then we would have no visibility into this.
cc @leoxlin