UpdateResource and DeleteResource will call notifyAll once it has changes. And It respond the resource that has been changed.
|
func (cache *LinearCache) notifyAll(modified map[string]struct{}) { |
|
// de-duplicate watches that need to be responded |
|
notifyList := make(map[chan Response][]string) |
|
for name := range modified { |
|
for watch := range cache.watches[name] { |
|
notifyList[watch] = append(notifyList[watch], name) |
|
} |
|
delete(cache.watches, name) |
|
} |
|
for value, stale := range notifyList { |
|
cache.respond(value, stale) |
|
} |
However, the xds-client get the response. It would remove the resources that aren't in the response from local cache.
https://github.com/grpc/grpc-go/blob/011544f72939c85397b0e24378280e6075061cb1/xds/internal/xdsclient/pubsub/update.go#L227-L240
Thus, a DeleteResource has been called, the xds-server would respond the deleted resource. But the resource has been deleted, actually it's empty. The xds-client remove the other resource not in the response from its local cache. it causes the grpc-client is unable to connect to other endpoints that haven't been deleted.
|
for _, name := range staleResources { |
|
resource := cache.resources[name] |
|
if resource != nil { |
|
resources = append(resources, types.ResourceWithTTL{Resource: resource}) |
|
} |
|
} |
UpdateResource and DeleteResource will call notifyAll once it has changes. And It respond the resource that has been changed.
go-control-plane/pkg/cache/v3/linear.go
Lines 140 to 151 in 4455b63
However, the xds-client get the response. It would remove the resources that aren't in the response from local cache.
https://github.com/grpc/grpc-go/blob/011544f72939c85397b0e24378280e6075061cb1/xds/internal/xdsclient/pubsub/update.go#L227-L240
Thus, a DeleteResource has been called, the xds-server would respond the deleted resource. But the resource has been deleted, actually it's empty. The xds-client remove the other resource not in the response from its local cache. it causes the grpc-client is unable to connect to other endpoints that haven't been deleted.
go-control-plane/pkg/cache/v3/linear.go
Lines 126 to 131 in 4455b63