-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultServiceDiscoveryRetryStrategy
may emit duplicated SD events
#1586
DefaultServiceDiscoveryRetryStrategy
may emit duplicated SD events
#1586
Conversation
Motivation: When `DefaultServiceDiscoveryRetryStrategy` retains addresses till success and recovers from the previous SD error, it doesn't check which of new addresses were previously retained. As the result, it may propagate duplicated "available" events to `RoundRobinLoadBalancer`. Modifications: - Filter out previously retained events when we recover from SD-error; - Enhance `overlapAddressPostRetry()` tests to catch this use-case; - Filter out events for duplicated addresses on each resolution; - Add `duplicatedAddresses()` test to catch this use-case; Result: `DefaultServiceDiscoveryRetryStrategyTest` does not emit duplicated SD events for the same availability state.
...alk-http-api/src/main/java/io/servicetalk/http/api/DefaultServiceDiscoveryRetryStrategy.java
Outdated
Show resolved
Hide resolved
} | ||
// FIXME: remove addresses that are available and unavailable in the same events collection |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "last event wins" is the expected strategy. what did you have in mind here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Collection
has two entries:
- foo, available
- foo, unavailable
we will propagate both events to RRLB instead of propagating nothing. It will add more work for RRLB to add the address and remove it immediately. Due to concurrency between threads, that address can be used by a client before the 2nd event is processed
...alk-http-api/src/main/java/io/servicetalk/http/api/DefaultServiceDiscoveryRetryStrategy.java
Outdated
Show resolved
Hide resolved
...http-api/src/test/java/io/servicetalk/http/api/DefaultServiceDiscoveryRetryStrategyTest.java
Outdated
Show resolved
Hide resolved
...alk-http-api/src/main/java/io/servicetalk/http/api/DefaultServiceDiscoveryRetryStrategy.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not confident I understand it will enough to approve or disapprove.
...alk-http-api/src/main/java/io/servicetalk/http/api/DefaultServiceDiscoveryRetryStrategy.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch @idelpivnitskiy !
...http-api/src/test/java/io/servicetalk/http/api/DefaultServiceDiscoveryRetryStrategyTest.java
Outdated
Show resolved
Hide resolved
…1586) Motivation: When `DefaultServiceDiscoveryRetryStrategy` retains addresses till success and recovers from the previous SD error, it doesn't check which of new addresses were previously retained. As the result, it may propagate duplicated "available" events to `RoundRobinLoadBalancer`. RRLB does not support duplicated entries. It may lead to retaining duplicated addresses after they become unavailable, causing failures of requests. Modifications: - Filter out previously retained events when we recover from SD-error; - Do not return duplicated `unavailable` events on subsequent SD-errors; - Enhance tests to catch these use-cases; Result: `DefaultServiceDiscoveryRetryStrategyTest` does not emit duplicated SD events for the same availability state => RRLB does not retain duplicated entries.
…1586) Motivation: When `DefaultServiceDiscoveryRetryStrategy` retains addresses till success and recovers from the previous SD error, it doesn't check which of new addresses were previously retained. As the result, it may propagate duplicated "available" events to `RoundRobinLoadBalancer`. RRLB does not support duplicated entries. It may lead to retaining duplicated addresses after they become unavailable, causing failures of requests. Modifications: - Filter out previously retained events when we recover from SD-error; - Do not return duplicated `unavailable` events on subsequent SD-errors; - Enhance tests to catch these use-cases; Result: `DefaultServiceDiscoveryRetryStrategyTest` does not emit duplicated SD events for the same availability state => RRLB does not retain duplicated entries.
…1586) Motivation: When `DefaultServiceDiscoveryRetryStrategy` retains addresses till success and recovers from the previous SD error, it doesn't check which of new addresses were previously retained. As the result, it may propagate duplicated "available" events to `RoundRobinLoadBalancer`. RRLB does not support duplicated entries. It may lead to retaining duplicated addresses after they become unavailable, causing failures of requests. Modifications: - Filter out previously retained events when we recover from SD-error; - Do not return duplicated `unavailable` events on subsequent SD-errors; - Enhance tests to catch these use-cases; Result: `DefaultServiceDiscoveryRetryStrategyTest` does not emit duplicated SD events for the same availability state => RRLB does not retain duplicated entries.
Motivation:
When
DefaultServiceDiscoveryRetryStrategy
retains addresses tillsuccess and recovers from the previous SD error, it doesn't check which
of new addresses were previously retained. As the result, it may
propagate duplicated "available" events to
RoundRobinLoadBalancer
.RRLB does not support duplicated entries. It may lead to retaining
duplicated addresses after they become unavailable, causing failures
of requests.
Modifications:
unavailable
events on subsequent SD-errors;Result:
DefaultServiceDiscoveryRetryStrategyTest
does not emit duplicated SDevents for the same availability state => RRLB does not retain duplicated
entries.