-
Notifications
You must be signed in to change notification settings - Fork 42
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
ETCD/Redis supports "BatchPut" #527
Conversation
用了这个之后UpdateNodes就不能在ETCD事务层面上保证这个node存在了。 但是其实Calcium里SetNode是加了个锁的,所以不会存在“SetNode过程中这个node突然被删了”的问题,除非有人手动操作。 |
engine/factory/factory.go
Outdated
@@ -52,12 +53,15 @@ func GetEngineFromCache(ctx context.Context, config types.Config, endpoint, ca, | |||
RemoveEngineFromCache(endpoint, ca, cert, key) | |||
return nil | |||
} | |||
log.Debugf(ctx, "[GetEngineFromCache] %v success, key %v", endpoint, cacheKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
感觉这条日志会暴多 要不在创建 client 的时候打日志 这样可以反过来知道被 cache 了
return client | ||
} | ||
|
||
// RemoveEngineFromCache . | ||
func RemoveEngineFromCache(endpoint, ca, cert, key string) { | ||
engineCache.Delete(getEngineCacheKey(endpoint, ca, cert, key)) | ||
cacheKey := getEngineCacheKey(endpoint, ca, cert, key) | ||
log.Debugf(context.TODO(), "[RemoveEngineFromCache] remove %v, key %v", endpoint, cacheKey) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cache 发生变化的时候可以有日志 因为不会很多
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
那这里不打debug,打info?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不是业务日志 还是 debug 算了 反而我们都设置的 debug 级别
4cbfbf4
to
c3c6b81
Compare
c3c6b81
to
7317f92
Compare
之前store/meta/meta.go中的KV有BatchCreate / BatchUpdate,但是没有能支持upsert操作的方法,这在一些情况下可能会造成问题(要求所有key必须全部存在/不存在,否则就报错)。所以这次加了个BatchPut方法,语义就是upsert。