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

Key shared subscription: hash ranges are not fully reported in stats #14073

Closed
eolivelli opened this issue Jan 31, 2022 · 7 comments
Closed

Key shared subscription: hash ranges are not fully reported in stats #14073

eolivelli opened this issue Jan 31, 2022 · 7 comments
Labels
lifecycle/stale type/bug The PR fixed a bug or issue reported a bug

Comments

@eolivelli
Copy link
Contributor

eolivelli commented Jan 31, 2022

Describe the bug
When I run pulsar-admin topics stats TOPIC-NAME and I have a KeyShared subscription with stickyHashRanges, with many ranges, the stats are not fully reporting the ranges, it looks like that for each consumer they report only the last set of ranges assigned to each Consumer and for some Consumers the list is empty even if the Consumer set the range and it is actually consuming messages.

There should be some bug here:

 public Map<Consumer, List<Range>> getConsumerKeyHashRanges() {
        Map<Consumer, List<Range>> result = new HashMap<>();
        Map.Entry<Integer, Consumer> prev = null;
        for (Map.Entry<Integer, Consumer> entry: rangeMap.entrySet()) {
            if (prev == null) {
                prev = entry;
            } else {
                if (prev.getValue().equals(entry.getValue())) {
                    result.computeIfAbsent(entry.getValue(), key -> new ArrayList<>())
                            .add(Range.of(prev.getKey(), entry.getKey()));
                }
                prev = null;
            }
        }
        return result;
    }

Additional context
Pulsar 2.8.2

@mattisonchao
Copy link
Member

Hi, @eolivelli

I can help to fix it.~

@eolivelli
Copy link
Contributor Author

@mattisonchao I know that @nicoloboschi is already working on a fix

@mattisonchao
Copy link
Member

@eolivelli Ah, sorry. I just made a PR, or I'll close it...

@eolivelli
Copy link
Contributor Author

don't need to close it
#14077

@nicoloboschi
Copy link
Contributor

After having a more detailed look with @eolivelli, we've seen the version used by Enrico is a custom fork based on Pulsar 2.8.0 and it doesn't include #12212, which is the resolution to the problem

@mattisonchao you can close the PR, the problem has been already fixed. Thanks

@codelipenghui
Copy link
Contributor

The issue had no activity for 30 days, mark with Stale label.

@eolivelli
Copy link
Contributor Author

fixed by #12212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/stale type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants