Namespace retention policy not working as expected
See original GitHub issueDescribe the bug I`m trying to set a retention policy for namespace bin/pulsar-admin namespaces set-retention testtenant/testnamespace --size -1 --time 1m
The main purpose is to save messages on topics even if there is no subscription. But not to store them infinitely, and delete them when some time passed. When you set retention policy messages start writing to the topic without subscriptions but it seems for infinite time. I can receive messages even after 1 hour after message is published by the producer (when policy time is set for 1 minute).
To Reproduce Steps to reproduce the behavior:
- Create tenant (testtenant for example)
- Create namespace (testnamespace for example)
- Set retention for namespace bin/pulsar-admin namespaces set-retention testtenant/testnamespace --size -1 --time 1m
- Publish a message with python
import pulsar
client = pulsar.Client('pulsar://pulsar:6650')
producer = client.create_producer('persistent://testtenant/testnamespace/test')
producer.send(('Hello-pulsar').encode('utf-8'))
client.close()
- Wait time more than 1 minute and try to receive message with python
import pulsar
client = pulsar.Client('pulsar://pulsar:6650')
consumer = client.subscribe('persistent://testtenant/testnamespace/test', 'my-subscription')
msg = consumer.receive()
print("Received message '{}' id='{}'".format(msg.data(), msg.message_id()))
consumer.acknowledge(msg)
client.close()
Expected behavior Message in topic with message age more than in --time parameter deletes
Screenshots n/a
Desktop (please complete the following information):
- Ubuntu 20.04
- Pulsar deployed in Kubernetes with official pulsar helm
- Pulsar 2.7.2
Additional context n/a
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
For opened ledger, broker will roll over it every 4 hours by default. So, opened ledger will be deleted after 4 hours.
Thanks for your reply. So it seems not a bug then, but normal behavior. So I think I can close the issue.