Skip to content

[improve][broker][PIP-318] Support not retaining null-key message during topic compaction#21578

Merged
coderzc merged 3 commits into
apache:masterfrom
coderzc:compaction_not_retain_nullkey
Nov 20, 2023
Merged

[improve][broker][PIP-318] Support not retaining null-key message during topic compaction#21578
coderzc merged 3 commits into
apache:masterfrom
coderzc:compaction_not_retain_nullkey

Conversation

@coderzc

@coderzc coderzc commented Nov 14, 2023

Copy link
Copy Markdown
Member

PIP: #21541

Motivation

Implement #21541

Modifications

  • Add config topicCompactionRetainNullKey in the broker.conf, the default value is false.
  • If not retaining null-key message, add an empty single message placeholder to result when rebatching the message.
  • If the message with null-key, then add a null-key value to the result list of extractIdsAndKeysAndSize and record the delete event.

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

Documentation

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

Matching PR in forked repository

PR in forked repository:

@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Nov 14, 2023
@coderzc coderzc force-pushed the compaction_not_retain_nullkey branch from 7fbe7b5 to cb1b764 Compare November 14, 2023 08:58
@coderzc coderzc changed the title [improve][broker] Support not retaining null-key message during topic compaction [improve][broker][PIP-318] Support not retaining null-key message during topic compaction Nov 15, 2023
@coderzc coderzc added this to the 3.2.0 milestone Nov 15, 2023
Comment thread pulsar-broker/src/main/java/org/apache/pulsar/client/impl/RawBatchConverter.java Outdated
@coderzc coderzc force-pushed the compaction_not_retain_nullkey branch from ad93df2 to 4ff06cf Compare November 16, 2023 02:47
@coderzc coderzc closed this Nov 16, 2023
@coderzc coderzc reopened this Nov 16, 2023
@coderzc coderzc force-pushed the compaction_not_retain_nullkey branch from a1ae5f1 to 1ca9ce5 Compare November 17, 2023 06:06
@codecov-commenter

codecov-commenter commented Nov 17, 2023

Copy link
Copy Markdown

Codecov Report

Attention: Patch coverage is 87.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.29%. Comparing base (44abba9) to head (1ca9ce5).
Report is 1376 commits behind head on master.

Files with missing lines Patch % Lines
...rg/apache/pulsar/compaction/TwoPhaseCompactor.java 85.71% 1 Missing and 1 partial ⚠️
...g/apache/pulsar/client/impl/RawBatchConverter.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #21578      +/-   ##
============================================
+ Coverage     73.27%   73.29%   +0.02%     
- Complexity    32676    32705      +29     
============================================
  Files          1892     1892              
  Lines        140632   140721      +89     
  Branches      15467    15489      +22     
============================================
+ Hits         103044   103146     +102     
+ Misses        29497    29470      -27     
- Partials       8091     8105      +14     
Flag Coverage Δ
inttests 24.11% <12.50%> (-0.24%) ⬇️
systests 24.68% <12.50%> (-0.29%) ⬇️
unittests 72.57% <87.50%> (+0.02%) ⬆️

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

Files with missing lines Coverage Δ
...org/apache/pulsar/broker/ServiceConfiguration.java 99.38% <100.00%> (+<0.01%) ⬆️
...g/apache/pulsar/client/impl/RawBatchConverter.java 93.75% <87.50%> (+0.24%) ⬆️
...rg/apache/pulsar/compaction/TwoPhaseCompactor.java 73.83% <85.71%> (-4.24%) ⬇️

... and 99 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 merged commit e1318b2 into apache:master Nov 20, 2023
coderzc added a commit to coderzc/pulsar that referenced this pull request Nov 21, 2023
@coderzc coderzc added type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages type/bug The PR fixed a bug or issue reported a bug and removed type/bug The PR fixed a bug or issue reported a bug labels Nov 21, 2023
Comment thread conf/broker.conf
brokerServiceCompactionPhaseOneLoopTimeInSeconds=30

# Whether retain null-key message during topic compaction
topicCompactionRemainNullKey=false

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.

Suggested change
topicCompactionRemainNullKey=false
topicCompactionRetainNullKey=false

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.

@coderzc I just saw this typo in the config key :)

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.

Sorry, I open a new PR to fix it. #21690

Technoboy- pushed a commit that referenced this pull request Dec 14, 2023
… compaction (#21578) (#21665)

Co-authored-by: fengyubiao <9947090@qq.com>
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 20, 2023
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Dec 20, 2023
coderzc added a commit that referenced this pull request Jan 4, 2024
nodece pushed a commit to nodece/pulsar that referenced this pull request Feb 23, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 1, 2024
mukesh-ctds pushed a commit to datastax/pulsar that referenced this pull request Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/broker area/compaction cherry-picked/branch-2.10 cherry-picked/branch-2.11 cherry-picked/branch-3.0 cherry-picked/branch-3.1 doc-not-needed Your PR changes do not impact docs release/2.10.6 release/2.11.3 release/3.0.3 release/3.1.2 type/bug The PR fixed a bug or issue reported a bug type/enhancement The enhancements for the existing features or docs. e.g. reduce memory usage of the delayed messages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants