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.
Please provide a description of this PR:
原本的问题:
node.CachedListeners 的设计目的是减少 envoyfilter patch 操作的开销,它用于存储 patch 后的完整 Listener。然而,node.CachedListeners 构建的缓存可能会被错误地使用。例如,在下图中,step2 根据 key1 ~ key4 构建了 node.CachedListeners,当 step3 删除 key3 和 key4 时,由于 miss == 0(key1 和 key2 能匹配 step1),因此 step2 中构建的 node.CachedListeners 会直接被 step3 使用,导致使用了错误的缓存。
修复方法:
我把 envoyfilter patch 也放到 buildGatewayListeners 里了,这样加到 cache 的时候会把 patch 好的 Listener 加进去,就不用在
node.CachedListeners
中再存一份了。fixes: alibaba/higress#1774
To help us figure out who should review this PR, please put an X in all the areas that this PR affects.
Please check any characteristics that apply to this pull request.