-
Notifications
You must be signed in to change notification settings - Fork 39
只有一个line清空line后会清空整个topic #7
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
Comments
这个是正确的,我简单解释一下: 当你的topic里只有一个line时,先set进来2条消息,这时topic和line里都有消息;然后你清空了line,如果还有别的line存在的话,topic里的消息还可能被别的line拿走,所以topic不应该清空;但是因为只有一条line,这些已经清空的(还包括被确认的)消息了,一直放在topic里的话会导致存储量无限增加,必须被垃圾回收。 所以uq里的设计思路是,如果已经被确认的消息(指的是已经没用了的消息),后台有一个定时任务在清理它们。也就是说,如果你在topic运行了一段时间之后又要新增加一条line,它只能拿到那一时刻还存在于topic中的有用消息,再往前的那些已经被别的line消费掉的消息,就拿不到了。 主要是出于存储量的考虑,欢迎探讨。 |
增加手动从topic内删除消息也许更好一点,有的会需要保存消息久点或后续新增line处理之前累积的消息。 |
搞成根据用户场景可配置也是可以的,我再考虑考虑。 |
可以借鉴zookeeper设置ephemeral节点的思想。 或者直接针对topic设定一个过期时间。 |
清空一个line后一会整个topic都清空了:
127.0.0.1:8800> add test
OK
127.0.0.1:8800> add test/a 10s
OK
127.0.0.1:8800> set test a
OK
127.0.0.1:8800> set test b
OK
127.0.0.1:8800> empty test/a
OK
127.0.0.1:8800> info test
name:test
head:0
tail:2
count:2 此时正常
name:test/a
recycle:10s
head:2
ihead:2
tail:2
count:0
127.0.0.1:8800> info test 等待一会再执行
name:test
head:2
tail:2
count:0 此时就空了
name:test/a
recycle:10s
head:2
ihead:2
tail:2
count:0
The text was updated successfully, but these errors were encountered: