Skip to content

[fix][test] Fix testMaxPendingChunkMessages - #18655

Merged
Technoboy- merged 1 commit into
apache:masterfrom
RobertIndie:iss-18570
Dec 2, 2022
Merged

Technoboy- merged 1 commit into
apache:masterfrom
RobertIndie:iss-18570

Conversation

@RobertIndie

@RobertIndie RobertIndie commented Nov 28, 2022 •

Copy link
Copy Markdown
Member

Fixes #18570

Motivation

The testMaxPendingChunkMessages is flaky. This PR use another approach to test the maxPendingChunkMessages configuration.

Root cause of this flaky test

The original test is a probability test, and it can only succeed with a certain probability. It simulates 25 producers writing to a topic with large messages, each with 5 chunks concurrently. Only if one of these chunked messages appears interleaved will it cause message loss and make the test pass. The success of the test is asserted by the loss of at least one message. The result of the test on my local machine is that only 2 out of 25 messages are lost. So the probability of failure of this test is still relatively high.

Therefore, I choose another approach to rewrite the test and make it deterministic by sending each single chunk manually.

Modifications

  • Fix testMaxPendingChunkMessages

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

If the box was checked, please highlight the changes

  • Dependencies (add or upgrade a dependency)
  • The public API
  • The schema
  • The default values of configurations
  • The threading model
  • The binary protocol
  • The REST endpoints
  • The admin CLI options
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository:

Motivation

The `testMaxPendingChunkMessages` is flaky. This PR use another approach to test the maxPendingChunkMessages configuration.

Modification

* Fix `testMaxPendingChunkMessages`

Signed-off-by: Zike Yang <[email protected]>
@RobertIndie RobertIndie added type/bug The PR fixed a bug or issue reported a bug area/test labels Nov 28, 2022
@RobertIndie RobertIndie added this to the 2.12.0 milestone Nov 28, 2022
@RobertIndie RobertIndie self-assigned this Nov 28, 2022
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Nov 28, 2022
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #18655 (bdd00d5) into master (b579bb8) will decrease coverage by 0.73%.
The diff coverage is 28.57%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18655      +/-   ##
============================================
- Coverage     47.51%   46.78%   -0.74%     
- Complexity    10520    10962     +442     
============================================
  Files           698      758      +60     
  Lines         68079    72820    +4741     
  Branches       7280     7809     +529     
============================================
+ Hits          32351    34066    +1715     
- Misses        32151    34957    +2806     
- Partials       3577     3797     +220     
Flag Coverage Δ
unittests 46.78% <28.57%> (-0.74%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ersistentStreamingDispatcherMultipleConsumers.java 0.00% <0.00%> (ø)
...istentStreamingDispatcherSingleActiveConsumer.java 0.00% <ø> (ø)
...ervice/streamingdispatch/StreamingEntryReader.java 0.00% <0.00%> (ø)
.../pulsar/broker/service/AbstractBaseDispatcher.java 59.77% <25.00%> (-1.05%) ⬇️
...rg/apache/pulsar/broker/service/AbstractTopic.java 68.20% <50.00%> (+2.93%) ⬆️
...tent/PersistentDispatcherSingleActiveConsumer.java 59.87% <75.00%> (ø)
...lsar/broker/loadbalance/impl/ThresholdShedder.java 3.27% <0.00%> (-44.44%) ⬇️
...ker/service/schema/exceptions/SchemaException.java 60.00% <0.00%> (-40.00%) ⬇️
...ar/broker/loadbalance/impl/BundleSplitterTask.java 60.00% <0.00%> (-17.78%) ⬇️
.../apache/pulsar/broker/admin/impl/PackagesBase.java 54.12% <0.00%> (-13.77%) ⬇️
... and 150 more

@codelipenghui

Copy link
Copy Markdown
Contributor

@RobertIndie Could you please add an explanation of why the old test of flaky? It will help reviewers to understand what is the test issue that we want to resolve

@RobertIndie

Copy link
Copy Markdown
Member Author

Could you please add an explanation of why the old test of flaky?

@codelipenghui Sure. I added the root cause of the flaky test in the PR description. PTAL.

@Technoboy-
Technoboy- merged commit 463f590 into apache:master Dec 2, 2022
lifepuzzlefun pushed a commit to lifepuzzlefun/pulsar that referenced this pull request Jan 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/test doc-not-needed Your PR changes do not impact docs ready-to-test 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: MessageChunkingTest.testMaxPendingChunkMessages

4 participants