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

[improve][broker] Fix ServiceUnitStateCompactionStrategy to cover fast-forward cursor behavior after compaction #20110

Merged
merged 4 commits into from
Apr 18, 2023

Conversation

heesung-sn
Copy link
Contributor

@heesung-sn heesung-sn commented Apr 15, 2023

Master Issue: #16691

Motivation

Raising a PR to implement: #16691

After the compaction, the cursor can fast-forward to the compacted horizon when a large number of messages are compacted before the next read. Hence, ServiceUnitStateCompactionStrategy also needs to cover this case. Currently, the existing and slow(their states are far behind) tableviews with ServiceUnitStateCompactionStrategy could not accept those compacted messages. In the load balance extension context, this means the ownership data could be inconsistent among brokers.

Modifications

This PR

  • fixes ServiceUnitStateCompactionStrategy to accept the state data if its version is bigger than the current version +1.
  • (minor fix) does not repeatedly update the replication_clusters in the policies when creating the system namespace. This update redundantly triggers ZK watchers when restarting brokers.
  • sets closeWithoutWaitingClientDisconnect=true, upon unload(following the same setting as the modular LM's)

Verifying this change

  • Make sure that the change passes the CI checks.

This change added tests and can be verified as follows:

  • *Updated unit tests.

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

We will have separate PRs to update the Doc later.

Matching PR in forked repository

PR in forked repository: heesung-sn#46

@github-actions
Copy link

@heesung-sn Please add the following content to your PR description and select a checkbox:

- [ ] `doc` <!-- Your PR contains doc changes -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Apr 15, 2023
@RobertIndie RobertIndie added this to the 3.0.0 milestone Apr 16, 2023
@heesung-sn
Copy link
Contributor Author

/pulsarbot run-failure-checks

@codecov-commenter
Copy link

Codecov Report

Merging #20110 (db02911) into master (091ee25) will increase coverage by 35.25%.
The diff coverage is 63.15%.

Impacted file tree graph

@@              Coverage Diff              @@
##             master   #20110       +/-   ##
=============================================
+ Coverage     37.68%   72.93%   +35.25%     
- Complexity    12519    31915    +19396     
=============================================
  Files          1691     1868      +177     
  Lines        128779   138341     +9562     
  Branches      14044    15220     +1176     
=============================================
+ Hits          48529   100905    +52376     
+ Misses        73936    29418    -44518     
- Partials       6314     8018     +1704     
Flag Coverage Δ
inttests 24.22% <0.00%> (-0.04%) ⬇️
systests 24.76% <0.00%> (-0.17%) ⬇️
unittests 72.23% <63.15%> (+39.06%) ⬆️

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

Impacted Files Coverage Δ
...xtensions/channel/ServiceUnitStateChannelImpl.java 83.44% <ø> (+82.86%) ⬆️
.../org/apache/pulsar/PulsarClusterMetadataSetup.java 72.51% <33.33%> (+55.54%) ⬆️
...ns/channel/ServiceUnitStateCompactionStrategy.java 78.57% <83.33%> (+68.04%) ⬆️
.../pulsar/compaction/StrategicTwoPhaseCompactor.java 76.49% <100.00%> (+1.70%) ⬆️
...a/org/apache/pulsar/client/impl/TableViewImpl.java 86.29% <100.00%> (+34.22%) ⬆️

... and 1420 files with indirect coverage changes

@heesung-sn
Copy link
Contributor Author

/pulsarbot run-failure-checks

@Demogorgon314 Demogorgon314 merged commit 6cfa468 into apache:master Apr 18, 2023
RobertIndie pushed a commit that referenced this pull request Apr 18, 2023
…t-forward cursor behavior after compaction (#20110)

Master Issue: #16691

### Motivation

Raising a PR to implement: #16691

After the compaction, the cursor can fast-forward to the compacted horizon when a large number of messages are compacted before the next read. Hence, ServiceUnitStateCompactionStrategy also needs to cover this case. Currently, the existing and slow(their states are far behind) tableviews with ServiceUnitStateCompactionStrategy could not accept those compacted messages. In the load balance extension context, this means the ownership data could be inconsistent among brokers.

### Modifications
This PR
  - fixes ServiceUnitStateCompactionStrategy to accept the state data if its version is bigger than the current version +1.
  - (minor fix) does not repeatedly update the replication_clusters in the policies when creating the system namespace. This update redundantly triggers ZK watchers when restarting brokers.
  -  sets closeWithoutWaitingClientDisconnect=true, upon unload(following the same setting as the modular LM's)

(cherry picked from commit 6cfa468)
@heesung-sn heesung-sn deleted the pip-192-fix-tv-consistency branch April 2, 2024 17:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc-not-needed Your PR changes do not impact docs ready-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants