Skip to content

[fix][broker] Fix can't stop phase-two of compaction even though messageId read reaches lastReadId#20988

Merged
coderzc merged 4 commits intoapache:masterfrom
coderzc:fix_compaction_stop
Aug 22, 2023
Merged

[fix][broker] Fix can't stop phase-two of compaction even though messageId read reaches lastReadId#20988
coderzc merged 4 commits intoapache:masterfrom
coderzc:fix_compaction_stop

Conversation

@coderzc
Copy link
Copy Markdown
Member

@coderzc coderzc commented Aug 14, 2023

Motivation

Currently, the compactor can't stop phase-two even though messageId read reaches lastReadId, this may lead to the next entry being dropped because it does not exist in the latestForKey.

Modifications

Stop phase two when the messageId read reaches lastReadId.

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 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
  • The metrics
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository:

promise.complete(null);
}
});
return;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What if some of the previous addToCompactedLedger aync write fail later, but the last id's addToCompactedLedger is complete first? Do we mark the promise as successful here?

Don't we need to wait for all outstanding addToCompactedLedger to be complete before making promise complete?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

You are right, but this PR is to fix phase two can't be stopped. We can open another PR to fix this issue.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@heesung-sn I opened #21067 to fix it.

@coderzc coderzc closed this Aug 15, 2023
@coderzc coderzc reopened this Aug 15, 2023
@Technoboy- Technoboy- closed this Aug 20, 2023
@Technoboy- Technoboy- reopened this Aug 20, 2023
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Aug 20, 2023

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.08%. Comparing base (ee91edc) to head (d789b98).
⚠️ Report is 1734 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #20988      +/-   ##
============================================
+ Coverage     72.67%   73.08%   +0.41%     
+ Complexity    32268    32243      -25     
============================================
  Files          1863     1875      +12     
  Lines        139397   139587     +190     
  Branches      15336    15349      +13     
============================================
+ Hits         101308   102021     +713     
+ Misses        30032    29494     -538     
- Partials       8057     8072      +15     
Flag Coverage Δ
inttests 24.17% <100.00%> (-0.07%) ⬇️
systests 25.22% <0.00%> (?)
unittests 72.36% <100.00%> (-0.08%) ⬇️

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

Files with missing lines Coverage Δ
...rg/apache/pulsar/compaction/TwoPhaseCompactor.java 73.21% <100.00%> (-1.68%) ⬇️

... and 157 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderzc coderzc force-pushed the fix_compaction_stop branch 2 times, most recently from 3de7045 to c2c09a5 Compare August 21, 2023 09:38
@coderzc coderzc force-pushed the fix_compaction_stop branch from 0be467d to 288c73f Compare August 22, 2023 01:12
@coderzc coderzc force-pushed the fix_compaction_stop branch from 288c73f to d789b98 Compare August 22, 2023 06:38
@coderzc coderzc merged commit 9e2195c into apache:master Aug 22, 2023
coderzc added a commit that referenced this pull request Aug 29, 2023
…ageId read reaches lastReadId (#20988)

(cherry picked from commit 9e2195c)
coderzc added a commit that referenced this pull request Aug 29, 2023
…ageId read reaches lastReadId (#20988)

(cherry picked from commit 9e2195c)
coderzc added a commit that referenced this pull request Aug 29, 2023
…ageId read reaches lastReadId (#20988)

(cherry picked from commit 9e2195c)
coderzc added a commit that referenced this pull request Aug 29, 2023
…ageId read reaches lastReadId (#20988)

(cherry picked from commit 9e2195c)
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.

8 participants