apache / apache/pulsar

[Bug] EntryFilter seems wrongly filter entry

Open
#18,178 3 comments 0 reactions 1 assignee Claimed by @leizhiyuan View on GitHub
Stale type/bug
Dominant language
Java
Stars
15.3k
Forks
3.8k
Avg merge
1d 14h
Merged PRs (30d)
160

Description

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.

### Version

master

### Minimal reproduce step

review the code

```
private void fillContext(FilterContext context, MessageMetadata msgMetadata,
Subscription subscription, Consumer consumer) {
context.reset();
context.setMsgMetadata(msgMetadata);
context.setSubscription(subscription);
context.setConsumer(consumer);
}
```

if we use

```
org.apache.pulsar.tests.integration.plugins.PatternEntryFilter#getMessagePropertyValue
```

in cocurrent scene , we may get msgMetadata ,when it is null

time | thread 1 | thread 2
-- | -- | --
1 | do reset, set context msgMetaData is null |  
2 |   | do filter,find msgmeta is null, maybe the implement will ack the entry
  |   |  

### What did you expect to see?

if entry matches, we should accept it

### What did you see instead?

if we use entry filter, sometimes we lost a little entry

### Anything else?

_No response_

### Are you willing to submit a PR?

- [X] I'm willing to submit a PR!

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.