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

[pulsar-client] Fix the wrong multi-topic has message available behavior #13634

Conversation

Demogorgon314
Copy link
Member

Fixes #13605

Motivation

Currently, the multiTopicReader hasMessageAvailable might get the wrong result, we must check numMessagesInQueue() > 0 again after finish all consumer hasMessageAvaliableAsync future, bacause some message might already in MultiTopicsConsumerImpl#incomingMessages.

Modifications

  • Fix the wrong multi-topic has message available behavior.
  • Use reader.readNextAsync() instead of block method reader.readNext().
  • Reduce the units test running time by changing MultiTopicsReaderTest to use @BeforeClass, @AfterClass.

Documentation

Need to update docs?

  • no-need-doc

This is a bug fix, no need doc.

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Jan 6, 2022
@Demogorgon314
Copy link
Member Author

/pulsarbot rerun-failure-checks

@Demogorgon314 Demogorgon314 force-pushed the fix/multi-topic-reader-has-message-available-behavior branch from 4d42722 to df2ec0e Compare January 6, 2022 06:39
@Demogorgon314
Copy link
Member Author

/pulsarbot rerun-failure-checks

2 similar comments
@Demogorgon314
Copy link
Member Author

/pulsarbot rerun-failure-checks

@Demogorgon314
Copy link
Member Author

/pulsarbot rerun-failure-checks

@Demogorgon314
Copy link
Member Author

Look like the flaky test is not relevant to this PR. If I understand correctly.
@codelipenghui Can you help me look at the CI?

@Demogorgon314
Copy link
Member Author

/pulsarbot rerun-failure-checks

Copy link
Contributor

@eolivelli eolivelli left a comment

Choose a reason for hiding this comment

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

Lgtm

@eolivelli
Copy link
Contributor

Copy link
Contributor

@gaoran10 gaoran10 left a comment

Choose a reason for hiding this comment

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

LGTM

@codelipenghui codelipenghui merged commit e57dc8f into apache:master Jan 12, 2022
@Demogorgon314 Demogorgon314 deleted the fix/multi-topic-reader-has-message-available-behavior branch January 13, 2022 01:55
codelipenghui pushed a commit that referenced this pull request Jan 18, 2022
Fixes #13605

### Motivation

Currently, the multiTopicReader `hasMessageAvailable` might get the wrong result, we must check `numMessagesInQueue() > 0` again after finish all consumer `hasMessageAvaliableAsync` future, bacause some message might already in `MultiTopicsConsumerImpl#incomingMessages`.

### Modifications

* Fix the wrong multi-topic has message available behavior.
* Use `reader.readNextAsync()` instead of block method `reader.readNext()`.
* Reduce the units test running time by changing `MultiTopicsReaderTest` to use `@BeforeClass`, `@AfterClass`.

(cherry picked from commit e57dc8f)
@codelipenghui codelipenghui added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Jan 18, 2022
codelipenghui pushed a commit that referenced this pull request Jan 18, 2022
Fixes #13605

### Motivation

Currently, the multiTopicReader `hasMessageAvailable` might get the wrong result, we must check `numMessagesInQueue() > 0` again after finish all consumer `hasMessageAvaliableAsync` future, bacause some message might already in `MultiTopicsConsumerImpl#incomingMessages`.

### Modifications

* Fix the wrong multi-topic has message available behavior.
* Use `reader.readNextAsync()` instead of block method `reader.readNext()`.
* Reduce the units test running time by changing `MultiTopicsReaderTest` to use `@BeforeClass`, `@AfterClass`.

(cherry picked from commit e57dc8f)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/client cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.8.3 release/2.9.2 type/bug The PR fixed a bug or issue reported a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky-test: MultiTopicsReaderTest.testHasMessageAvailableAsync
5 participants