fix: renew long-lived subscriptions - #372
Open
mattisonchao wants to merge 1 commit into
Open
Conversation
mattisonchao
force-pushed
the
bugfix/shard-assignment-watch-timeout
branch
from
August 24, 2026 13:09
4a96bc2 to
2dbc3cf
Compare
mattisonchao
force-pushed
the
bugfix/shard-assignment-watch-timeout
branch
from
August 24, 2026 13:27
2dbc3cf to
29eef4f
Compare
mattisonchao
force-pushed
the
bugfix/shard-assignment-watch-timeout
branch
from
August 24, 2026 13:53
29eef4f to
3028568
Compare
Signed-off-by: mattisonchao <mattisonchao@gmail.com>
mattisonchao
force-pushed
the
bugfix/shard-assignment-watch-timeout
branch
from
August 24, 2026 14:08
3028568 to
0a16962
Compare
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.
Motivation
Oxia keeps shard assignments, notifications, and sequence updates open as long-lived client subscriptions. When traffic passes through Istio/Envoy, the proxy can lose or close its upstream connection while its downstream HTTP/2 connection to the client remains open. In that state, transport keepalive can still succeed on the downstream hop, so the client sees an apparently healthy but silent subscription and never reconnects. The existing request timeout only protects establishment before the first response; it does not detect this failure after a subscription is established.
Kubernetes
client-goaddresses the same class of hanging watch by giving each Reflector watch a bounded, randomized lifetime and recreating it from the last known state. Oxia can use the same model: shard assignments restart with a complete snapshot, notifications resume after the last received offset, and sequence updates remain monotonic by suppressing equal or older keys replayed during renewal. Randomizing renewal times also avoids a reconnect wave across clients. See the Kubernetes client-go Reflector.Modifications
subscriptionMaxAge(Duration)for shard assignments, notifications, and sequence updates.[maxAge / 2, maxAge), producing the Kubernetes-style 5–10 minute range by default.disableSubscriptionMaxAge()for deployments that explicitly require unbounded subscriptions.Testing
./gradlew :client:test --tests '*Test' spotlessCheck./gradlew :client-api:javadoc