Skip to content

Conversation

@valerian-roche
Copy link
Contributor

The snapshot cache reply logic for sotw and delta watches has grown complex and very distinct from the linear cache. This has created issues recently, mostly related to the logic in CreateWatch having to perfectly match the one in respond to avoid major issues. This commit simplifies the code in the same model as the linear cache: a single method creates the response, and the watch is created if no response is returned.

There is some behavior change: if the type is not Listeners or Clusters, the control-plane will now only return the modified resources, per the xDS protocol. Please create an issue if this creates problems.

Further work will build on this to:

  • support a new snapshot model, allowing per type updates and versions, as well as better delta handling
  • use per-resource version even in sotw to avoid resending resources when not needed.
  • provide support for partial wildcard responses, to provide a new support model for wildcard + resources subscriptions (e.g. for OdCDS).

cache.log.Debugf("respond %s (requested %v) version %q with version %q and resources %v", request.GetTypeUrl(), request.GetResourceNames(), request.GetVersionInfo(), version, slices.Collect(maps.Keys(resp.GetReturnedResources())))
// This implementation can seem more complex than needed, as it does not blindly rely on the request version.
// This allows for a more generic implemenentation when considering wildcard + subscribed, or partial replies.
// In other context a lot could be simplified as

Choose a reason for hiding this comment

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

Is this comment missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch, updated

typeURL, referenceSet, len(items.Items))
}

// Check superset.

Choose a reason for hiding this comment

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

Suggested change
// Check superset.
// Check difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

The snapshot cache reply logic for sotw and delta watches has grown complex and very distinct from the linear cache.
This has created issues recently, mostly related to the logic in `CreateWatch` having to perfectly match the one in `respond` to avoid major issues.
This commit simplifies the code in the same model as the linear cache: a single method creates the response, and the watch is created if no response is returned.

There is some behavior change: if the type is not Listeners or Clusters, the control-plane will now only return the modified resources, per the xDS protocol. Please create an issue if this creates problems.

Further work will build on this to:
 - support a new snapshot model, allowing per type updates and versions, as well as better delta handling
 - use per-resource version even in sotw to avoid resending resources when not needed.
 - provide support for partial wildcard responses, to provide a new support model for wildcard + resources subscriptions (e.g. for OdCDS).

Signed-off-by: Valerian Roche <valerian.roche@gmail.com>
@valerian-roche valerian-roche merged commit bf9b60b into main Jan 19, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants