Skip to content

[fix][broker] Fixes Inconsistent ServiceUnitStateData View (ExtensibleLoadManagerImpl only) #24186

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

Merged
merged 5 commits into from
Apr 18, 2025

Conversation

heesung-sn
Copy link
Contributor

@heesung-sn heesung-sn commented Apr 17, 2025

Motivation

Although we do CAS updates on ServiceUnitStateMetadataStoreTableViewImpl.put, ServiceUnitStateData.versionId can still conflict if cache.readModifyUpdateOrCreate retries multiple times with the updated value's GetResult.Stats.version.

We should fail-fast if the readModifyUpdateOrCreate fails once(e.g. upon first BadVersionException) not to cause inconsistent ServiceUnitStateData views from different brokers.

Also, to fix the worst case, any inconsistent ServiceUnitStateData views, ServiceUnitStateMetadataStoreTableViewImpl should update the latest value(not only compare the versionId but also all fields) from the MetadataStore by its cache refresh cycles.

Modifications

  • Added No backoff config in MetadataCacheConfig and use it from ServiceUnitStateMetadataStoreTableViewImpl.
  • Update ServiceUnitStateData.equals to compare all fields.

Verifying this change

  • Make sure that the change passes the CI checks.

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:

@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Apr 17, 2025
@heesung-sn heesung-sn force-pushed the fix-version-id branch 2 times, most recently from b25febb to 7e9e4c5 Compare April 18, 2025 01:56
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes an inconsistent view of ServiceUnitStateData by introducing a no-retry backoff configuration and updating the equality comparison to cover all fields.

  • Implements a no-retry backoff configuration in MetadataCacheConfig and applies it in MetadataStoreTableViewImpl.
  • Adds tests verifying the new no backoff behavior and enhanced equality checks for ServiceUnitStateData.
  • Adjusts Backoff and MetadataCacheImpl behavior to support the no-retry logic.

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pulsar-metadata/src/test/java/org/apache/pulsar/metadata/MetadataCacheTest.java Added tests for no backoff configuration in MetadataCacheConfig.
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/tableview/impl/MetadataStoreTableViewImpl.java Applied no-retry backoff and adjusted exception handling during put operations.
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/cache/impl/MetadataCacheImpl.java Modified exception propagation based on no backoff configuration.
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/api/MetadataCacheConfig.java Introduced a static no-retry backoff configuration constant.
pulsar-common/src/main/java/org/apache/pulsar/common/util/Backoff.java Updated constructor and reset logic to correctly handle no backoff conditions.
pulsar-broker/src/test/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateDataTest.java Added tests to validate the updated equality behavior of ServiceUnitStateData.
pulsar-broker/src/main/java/org/apache/pulsar/broker/loadbalance/extensions/channel/ServiceUnitStateData.java Removed the custom equals override to leverage the default record equality comparing all fields.

@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2025

Codecov Report

Attention: Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.

Project coverage is 74.21%. Comparing base (bbc6224) to head (d39081e).
Report is 1029 commits behind head on master.

Files with missing lines Patch % Lines
...in/java/org/apache/pulsar/common/util/Backoff.java 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #24186      +/-   ##
============================================
+ Coverage     73.57%   74.21%   +0.64%     
+ Complexity    32624     2315   -30309     
============================================
  Files          1877     1865      -12     
  Lines        139502   144653    +5151     
  Branches      15299    16523    +1224     
============================================
+ Hits         102638   107354    +4716     
+ Misses        28908    28797     -111     
- Partials       7956     8502     +546     
Flag Coverage Δ
inttests 26.75% <28.57%> (+2.17%) ⬆️
systests 23.23% <28.57%> (-1.10%) ⬇️
unittests 73.70% <95.23%> (+0.85%) ⬆️

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

Files with missing lines Coverage Δ
...lance/extensions/channel/ServiceUnitStateData.java 100.00% <ø> (ø)
...pache/pulsar/metadata/api/MetadataCacheConfig.java 100.00% <100.00%> (+20.00%) ⬆️
.../pulsar/metadata/cache/impl/MetadataCacheImpl.java 86.98% <100.00%> (-2.27%) ⬇️
...ata/tableview/impl/MetadataStoreTableViewImpl.java 77.07% <100.00%> (ø)
...in/java/org/apache/pulsar/common/util/Backoff.java 97.95% <83.33%> (ø)

... and 1069 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.

@heesung-sn heesung-sn merged commit c6be44c into apache:master Apr 18, 2025
61 checks passed
heesung-sn added a commit that referenced this pull request Apr 18, 2025
…eLoadManagerImpl only) (#24186)

(cherry picked from commit c6be44c)
@heesung-sn heesung-sn deleted the fix-version-id branch April 18, 2025 18:01
@Technoboy- Technoboy- added this to the 4.1.0 milestone Apr 23, 2025
manas-ctds pushed a commit to datastax/pulsar that referenced this pull request May 2, 2025
…eLoadManagerImpl only) (apache#24186)

(cherry picked from commit c6be44c)
(cherry picked from commit 28f7e94)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request May 6, 2025
…eLoadManagerImpl only) (apache#24186)

(cherry picked from commit c6be44c)
(cherry picked from commit 28f7e94)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/branch-4.0 doc-not-needed Your PR changes do not impact docs ready-to-test release/4.0.5 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.

4 participants