Client: Don't panic on eviction#2484
Conversation
1221eb6 to
3fbe091
Compare
3fbe091 to
976d6c9
Compare
(Not sure why shutdown was missing -- was this intentional?)
976d6c9 to
3fffb98
Compare
3fffb98 to
676db38
Compare
There was a problem hiding this comment.
Note that for simplicity the client eviction reason is not made available.
Rather than plumbing the eviction reason around (e.g. by turning PacketStatus into a union(enum)?), we can use #2472 to inform the operator about the details.
Alternatively, we could select a few eviction reasons that are worth exposing to the client and represent them as distinguished PacketStatus errors.
For example:
const PacketError = error{
TooMuchData,
ClientShutdown,
ClientReleaseIncompatible, // Evicted due to incompatible releases, should upgrade.
ClientEvicted, // The server kicked us, we may try connecting again.
InvalidOperation,
InvalidDataSize,
};There was a problem hiding this comment.
Note to self: RequestException does indicate user-facing exceptions such as TooMuchData, ClientShutdown and now ClientEvicted, on the contrary to what is stated in the comment "thrown when the internal invariants of the underlying native library are violated, which is expected to never happen."
This documentation must be updated, but maybe this exception should be a checked exception explicitly handled by the user, reverting 5c93c3c.
| } | ||
|
|
||
| @Test | ||
| public void testClientEvicted() throws Throwable { |
Great suggestion! I will implement that in a follow-up PR, so that this PR is included in monday's release. |
|
Looks like this PR introduced a flake to the integration tests, so it won't be in monday's release after all. I'll investigate after the weekend! |
Language clients no longer panic when they receive an eviction message from the cluster.
Instead, any in-flight (or future) packets fail with
PacketStatus.ClientEvicted.Note that for simplicity the client eviction reason is not made available.
Rather than plumbing the eviction reason around (e.g. by turning
PacketStatusinto aunion(enum)?), we can use logging to inform the operator about the details.