pulsarctl icon indicating copy to clipboard operation
pulsarctl copied to clipboard

Expire command affect only one message

Open worekleszczy opened this issue 2 years ago • 6 comments

Hi,

I'm not sure if this is a bug, but it's definitely confusing me.

Some time age I wanted to manually expire messages for a subscription - I don't have ttl set up for a topic and a service I was manually expiring messages for keep nack messages due to invalid format, so to prevent this from happen infinitely I run a command:

pulsarctl subscriptions expire my-tenant/my-namespace/some-topic service-subscription-name -t 100

Prior to that I had 40 unacked messages, but after running this I remained with 39. I ended up running this in a loop, but I expected this command to expire all messages that are past expire time argument. Is this the correct behavior? For a while I thought that -a it for such use case as mine, but according to #707 it's for something else.

worekleszczy avatar Jun 07 '22 13:06 worekleszczy

This command should be can expires all messages older than given 100 seconds for service-subscription-name of my-tenant/my-namespace/some-topic topic.

Right now I checked the Pulsarctl codebase, and it seems right to me.

Could you try pulsar-admin topics expire-messages my-tenant/my-namespace/some-topic -t 100 -s service-subscription-name?

If this command can meet your needs, we will fix the Pulsarctl.

nodece avatar Jun 11 '22 15:06 nodece

@nodece the command you suggested didn't meet my need - behaviour is exactly the same 🤔

At this point I'm utterly confused - you say that is should expire all messages that are beyond -t param, but both seem to expire only one message - I checked stats of my topic and had msgBacklog:12 before running it, after I had done it I had msgBacklog: 11 😵 running the command second time has similar effect.

Do you think this might have different outcome depending on type of subscription / TTL settings? I use to to expire messages for a shared subscription.

worekleszczy avatar Jun 15 '22 09:06 worekleszczy

@zymap Could you take a look this issue?

nodece avatar Jun 15 '22 10:06 nodece

@worekleszczy Could you provide which you are using the Pulsar version? You can also make an issue in Pulsar.

nodece avatar Jun 15 '22 10:06 nodece

@nodece

pulsarctl --version
Release Version: 2.9.2.3
Git Commit Hash: 264c91255ad1eb621c14404799c17a9256c9f6d5
Git Branch: HEAD
UTC Build Time: 2022-02-15 18:14:32
Go Version: go version go1.16.13 linux/amd64

worekleszczy avatar Jun 15 '22 12:06 worekleszczy

Which is the Pulsar version?

nodece avatar Jun 15 '22 14:06 nodece