Skip to content
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

[Linear cache] Support use of stable versions in sotw #12

Merged
merged 2 commits into from
Feb 17, 2024

Conversation

valerian-roche
Copy link
Collaborator

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state.
A side effect is that watch resumption would always return all known resources. Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription.

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return.
It still has two main limitations:

  • it is less efficient (as we compute an entire response to then not reply)
  • we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch from e1b22c6 to aa001de Compare February 7, 2024 15:06
@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch from faa818f to 97b046f Compare February 8, 2024 20:03
@valerian-roche valerian-roche changed the base branch from vr/linear-reorganize to vr/linear-lazy-versions February 8, 2024 20:03
@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch from 97b046f to 16f4615 Compare February 8, 2024 20:49
if response != nil {
// If the request
// - is the first
// - provides a non-empty version, matching the version prefix

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is there a condition for the version prefixes here? (I don't even see it in the code, so perhaps it's just the comment?)
I think the concept shouldn't even exist when stable version are used, since the whole point is to reuse versions across reconnects (presumably also across processes and restarts).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The prefix is actually covered through the check of ignoreCurrentSubscriptionResources. I agree VersionPrefix makes little sense in this case, but I'm not sure we want to fully reject then
Tbh removing version prefix would allow to simplify quite a lot of code, and if we find no major issues with stable versions I might push for it

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. This potential cleanup and the fact that version prefix does not serve a real purpose with stable versions may be worth a comment, for future readers.

@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch 2 times, most recently from ba5d383 to 71686da Compare February 16, 2024 19:51
@valerian-roche valerian-roche changed the base branch from vr/linear-lazy-versions to dd/sotw-fixes February 16, 2024 20:00
@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch from 71686da to 11e1362 Compare February 16, 2024 20:01
@valerian-roche valerian-roche force-pushed the dd/sotw-fixes branch 2 times, most recently from fe601c1 to 99822ee Compare February 16, 2024 20:20
@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch from 11e1362 to 4c322a7 Compare February 16, 2024 20:22
When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
@valerian-roche valerian-roche force-pushed the vr/linear-sotw-stable-versions branch from 4c322a7 to 8bb7c6b Compare February 16, 2024 20:54
@valerian-roche valerian-roche merged commit d020b1d into dd/sotw-fixes Feb 17, 2024
4 checks passed
valerian-roche added a commit that referenced this pull request Feb 23, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
zhiyanfoo pushed a commit that referenced this pull request Apr 10, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
valerian-roche added a commit that referenced this pull request Apr 10, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
valerian-roche added a commit that referenced this pull request May 9, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
valerian-roche added a commit that referenced this pull request Aug 8, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
shamdor pushed a commit that referenced this pull request Sep 23, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
wdauchy pushed a commit that referenced this pull request Oct 25, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
wdauchy pushed a commit that referenced this pull request Oct 25, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
wdauchy pushed a commit that referenced this pull request Oct 25, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
valerian-roche added a commit that referenced this pull request Dec 16, 2024
[Linear cache] Support use of stable versions in sotw

When using sotw watches, the current behavior of the linear cache is to use the current version of the cache (monotonically increased on resource updates) as the version returned. In the past the request-provided version was compared to the version of the last resource update to compute the returned resources, allowing watch resumption when a client would reconnect.
This behavior was actually not working as the subscribed resources could change while no cache updates occurred, or the newly requested resources were at an older cache version. PR #10 therefore no longer use this behavior to track resources to be returned, instead relying on the subscription state. A side effect is that watch resumption would always return all known resources.
Delta watches have a mechanism to avoid this issue, by tracking per resource version and sending them as part of the initial request of a new subscription. 

Sotw do not allow per resource version in requests and responses, but by encoding the current subscription state through a hash of the returned versions map, this PR now allows resumption if the hash matches the response we would otherwise return. It still has two main limitations: it is less efficient (as we compute an entire response to then not reply) and we cannot track which resource (if any) changed, and will therefore return them all if anything has changed.

Signed-off-by: Valerian Roche <valerian.roche@datadoghq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants