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

[Fix][Flaky-test] Fix testConsumeTxnMessage #16981

Merged
merged 2 commits into from
Aug 9, 2022
Merged

[Fix][Flaky-test] Fix testConsumeTxnMessage #16981

merged 2 commits into from
Aug 9, 2022

Conversation

liangyepianzhou
Copy link
Contributor

@liangyepianzhou liangyepianzhou commented Aug 8, 2022

Fixes #14109

Motivation

The transaction commit is async, so the consumer can still receive message when the consumer rebuilds.

Modification

Add Awaitility.await() for check-ing whether the ongoingTxns = 0.

Verifying this change

  • Make sure that the change passes the CI checks.

(Please pick either of the following options)

This change is a trivial rework / code cleanup without any test coverage.

(or)

This change is already covered by existing tests, such as (please describe tests).

(or)

This change added tests and can be verified as follows:

(example:)

  • Added integration tests for end-to-end deployment with large payloads (10MB)
  • Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API: (yes / no)
  • The schema: (yes / no / don't know)
  • The default values of configurations: (yes / no)
  • The wire protocol: (yes / no)
  • The rest endpoints: (yes / no)
  • The admin cli options: (yes / no)
  • Anything that affects deployment: (yes / no / don't know)

Documentation

Check the box below or label this PR directly.

Need to update docs?

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

Master #14109
## Motivation
The transaction commit is async, so the consumer can still receive message when the consumer rebuilds.
## Modification
Add  Awaitility.await().
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Aug 8, 2022
@liangyepianzhou liangyepianzhou self-assigned this Aug 8, 2022
@codelipenghui
Copy link
Contributor

@liangyepianzhou Do you see consumer reconnection logs? Yes, the change may be can resolve the flaky test, but it will also hide a potential BUG of message duplication.

@codelipenghui
Copy link
Contributor

We should consider checking if the consumer is reconnected to the broker, if yes, the message duplication is expected. Otherwise, we should not receive duplicated messages.

@liangyepianzhou
Copy link
Contributor Author

The consumer will reconnect and the message duplication is not expected.
We produce 505 messages.
The PerformanceConsumer will ack the messages (0-500) with the transactions and then commit the transactions.
When the consumer reconnects, we hope only the messages (501-505) can be received.
Because the transaction commit is async, the last transaction may not have been committed.
And then the consumer will receive message (400 - 505).

@codelipenghui
Copy link
Contributor

Because the transaction commit is async, the last transaction may not have been committed.

So, we should fix the test to make sure the consumer start to consume messages after confirm the last transaction has committed?

@liangyepianzhou
Copy link
Contributor Author

Because the transaction commit is async, the last transaction may not have been committed.

So, we should fix the test to make sure the consumer start to consume messages after confirm the last transaction has committed?

Right, but we don't know when the last transaction was committed.

@codelipenghui
Copy link
Contributor

Right, but we don't know when the last transaction was committed.

Can we check through the TC stats? As I said, the change will hide the BUG that introduced the message duplication issues. If we don't have a way to check if the last transaction is committed, we should add it.

@liangyepianzhou liangyepianzhou merged commit c29503e into apache:master Aug 9, 2022
Technoboy- pushed a commit that referenced this pull request Aug 10, 2022
* [Fix][Flaky-test] Fix testConsumeTxnMessage
Master #14109
## Motivation
The transaction commit is async, so the consumer can still receive message when the consumer rebuilds.
## Modification
Add  Awaitility.await() for check-ing whether the ongoingTxns = 0.
Technoboy- pushed a commit to merlimat/pulsar that referenced this pull request Aug 16, 2022
* [Fix][Flaky-test] Fix testConsumeTxnMessage
Master apache#14109
## Motivation
The transaction commit is async, so the consumer can still receive message when the consumer rebuilds.
## Modification
Add  Awaitility.await() for check-ing whether the ongoingTxns = 0.
Jason918 pushed a commit that referenced this pull request Sep 2, 2022
* [Fix][Flaky-test] Fix testConsumeTxnMessage
Master #14109
## Motivation
The transaction commit is async, so the consumer can still receive message when the consumer rebuilds.
## Modification
Add  Awaitility.await() for check-ing whether the ongoingTxns = 0.

(cherry picked from commit c29503e)
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Sep 2, 2022
* [Fix][Flaky-test] Fix testConsumeTxnMessage
Master apache#14109
## Motivation
The transaction commit is async, so the consumer can still receive message when the consumer rebuilds.
## Modification
Add  Awaitility.await() for check-ing whether the ongoingTxns = 0.

(cherry picked from commit c29503e)
(cherry picked from commit 6db6679)
@Jason918
Copy link
Contributor

Jason918 commented Sep 5, 2022

This PR depends on #15675 which is not included in branch-2.10. so remove release/2.10.2

eolivelli added a commit to datastax/pulsar that referenced this pull request Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Flaky-test: PerformanceTransactionTest.testConsumeTxnMessage
4 participants