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

[improve][broker] Refactor a private method to eliminate an unnecessary parameter #23904

Closed
wants to merge 0 commits into from

Conversation

guan46
Copy link
Contributor

@guan46 guan46 commented Jan 28, 2025

Motivation

  • The canDispatchEntry method uses MutableBoolean as an argument, and then changes its value internally, but this variable is not necessary

Modifications

  • Optimize code for readability

Documentation

  • doc
  • doc-required
  • doc-not-needed
  • doc-complete

Matching PR in forked repository

PR in forked repository: guan46#1

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 28, 2025
@lhotari lhotari changed the title [improve][broker]Variable modified in read method [improve][broker] Refactor a private method to eliminate an unnecessary parameter Jan 28, 2025
Comment on lines 443 to 452
boolean canDispatchEntry = canDispatchEntry(consumer, entry, readType, stickyKeyHash);
if (!canDispatchEntry) {
if(blockedByHash != null){
blockedByHash.setTrue();
}
// decrement the permits for the consumer
permits.decrement();
// allow the entry to be dispatched
dispatchEntry = true;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This logic is not correct. Do you spot the problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain it in detail? @lhotari

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For effective contributions, it is necessary to run tests and use tests to provide feedback. Did you check my previous advice about Personal CI? When you know what tests fail, you can then locally run a single unit test in your IDE. Have you already tried this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's been executed. Please take a look @lhotari

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@guan46 Thanks.
For some reason, the "Pulsar CI" workflow didn't run for the pull request. I also noticed that your fork's master branch isn't completely in sync with apache/pulsar master. It's necessary to get a recent CI fix included when you run "Pulsar CI" workflow in your fork. However that's not the reason why the workflow didn't execute.
When you go to https://github.com/guan46/pulsar/actions/workflows/pulsar-ci.yaml , do you see whether the workflow is enabled or not?
Click "Enable workflow" if that is visible.
image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to sync your forks master branch with apache/pulsar's master, there are some instructions here: https://pulsar.apache.org/contribute/personal-ci/#stay-in-sync-with-upstream

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you explain it in detail? @lhotari

Here's Deepseek's detailed explanation based on https://github.com/apache/pulsar/pull/23904.patch
image

Copy link
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please follow instructions to first get a CI pass with "Personal CI" in your forked repository: https://pulsar.apache.org/contribute/personal-ci/ . You will be able to get automated CI feedback on your own without requiring assistance from Pulsar contributors. It's necessary to latest changes from master branch to get most recent CI fixes. We have a lot of flaky tests, so some test failures could be flaky ones. Rerun failed builds in GitHub Actions CI if this happens. In your personal CI you will have full control.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants