AlexStocks commented on code in PR #3612: URL: https://github.com/apache/dubbo-go/pull/3612#discussion_r3853310934
########## config_center/zookeeper/config_cache.go: ########## @@ -0,0 +1,237 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package zookeeper + +import ( + "sync" + "time" +) + +type configCacheEntry struct { + content string + exists bool + expiresAt time.Time +} + +type configCache struct { + ttl time.Duration + + stateLock sync.RWMutex + entries map[string]configCacheEntry + watches map[string]bool + generation uint64 + + pathLocks sync.Map +} Review Comment: [P1] 当前有界修复仍未关闭这个根因 这里在 auto watch 已满时仅把最后一个业务 watch 标成 `retired`,只有该路径未来再次产生事件才会删除。exact Head 探针先填满 1024 个 auto watches,再对 4096 个唯一 key 各执行一次 AddListener/RemoveListener,在没有后续事件的情况下得到 `tracked=5120、retired=4096、auto=1024`。上游 go-zookeeper v1.0.4 同样会把这些 channel 保留到事件或连接失效,并在重连时重新提交,因此本地 map、客户端和服务端 watch 仍会按历史 key 线性增长。请让最后一个 listener 退出时确定性注销并回收 watch,并补“无后续事件”的唯一 key churn 容量测试。 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
