Skip to content
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

号段模式,能否实现每日定时清零? #96

Open
lafangs opened this issue Apr 12, 2020 · 5 comments
Open

号段模式,能否实现每日定时清零? #96

lafangs opened this issue Apr 12, 2020 · 5 comments

Comments

@lafangs
Copy link

lafangs commented Apr 12, 2020

美团大神好,现在我们有这样一个需求场景,就是每天生成日志流水号,从1开,一直趋势递增,第二天又从1开始,如此往复。现在想问问美团Leaf有这个功能吗?好像不支持对不对,目前的思路就是定时把数据库的maxId修改未初始值,同时清空缓存中的值。但是缓存中的值如何保证一致性呢?假如集群部署,三台机器的时间如果有秒级差异,那执行定时任务的时候就有先后顺序,而且数据库也会执行三次重置操作,暂时没有很好的思路,望解答,谢谢!

@seustones
Copy link

可以做个管控作为中间人

@Yaccc
Copy link
Member

Yaccc commented Apr 12, 2020

可以用日期作为leaf的key比如20200412_key

@nogeek-cn
Copy link

你好,你看看,我实现的,

#173

这个方式怎么样?

@chenlei0615
Copy link

同问,解决了没呢

@nogeek-cn
Copy link

同问,解决了没呢

你看一下我的实现方式可不可以。

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

No branches or pull requests

5 participants