Skip to content

Conversation

@RobertIndie
Copy link
Member

@RobertIndie RobertIndie commented Dec 6, 2024

Motivation

The method MetadataCache#readModifyUpdateOrCreate should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, MetadataCache#readModifyUpdateOrCreate does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test MetadataCacheTest#readModifyUpdateBadVersionRetry.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

Modification

  • Correct the retry process in MetadataCache#readModifyUpdateOrCreate to ensure BadVersionException is caught during each retry.
  • Implement a retry backoff mechanism in MetadataCache#readModifyUpdateOrCreate to manage the frequency of retries effectively.
  • Add new config retryBackoff to the MetadataCacheConfig to control the MetadataCache retry backoff.
  • Respective the metadataStoreOperationTimeoutSeconds for the MetadataCache retry

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:

…teOrCreate

## Motivation

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

## Modification

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
@RobertIndie RobertIndie added type/bug The PR fixed a bug or issue reported a bug ready-to-test release/4.0.2 labels Dec 6, 2024
@RobertIndie RobertIndie added this to the 4.1.0 milestone Dec 6, 2024
@RobertIndie RobertIndie self-assigned this Dec 6, 2024
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Dec 6, 2024
@codecov-commenter
Copy link

codecov-commenter commented Dec 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.33%. Comparing base (bbc6224) to head (3219d51).
Report is 1207 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #23686      +/-   ##
============================================
+ Coverage     73.57%   74.33%   +0.76%     
- Complexity    32624    35071    +2447     
============================================
  Files          1877     1945      +68     
  Lines        139502   147505    +8003     
  Branches      15299    16280     +981     
============================================
+ Hits         102638   109649    +7011     
- Misses        28908    29375     +467     
- Partials       7956     8481     +525     
Flag Coverage Δ
inttests 27.33% <74.19%> (+2.75%) ⬆️
systests 24.33% <74.19%> (+0.01%) ⬆️
unittests 73.72% <100.00%> (+0.87%) ⬆️

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

Files with missing lines Coverage Δ
.../apache/pulsar/broker/resources/BaseResources.java 75.65% <100.00%> (+2.92%) ⬆️
...in/java/org/apache/pulsar/common/util/Backoff.java 94.11% <ø> (ø)
...pache/pulsar/metadata/api/MetadataCacheConfig.java 90.90% <100.00%> (+10.90%) ⬆️
.../pulsar/metadata/cache/impl/MetadataCacheImpl.java 86.89% <100.00%> (-2.36%) ⬇️
...he/pulsar/metadata/impl/AbstractMetadataStore.java 84.94% <100.00%> (+0.38%) ⬆️

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

Copy link
Member

@dao-jun dao-jun left a comment

Choose a reason for hiding this comment

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

LGTM

@RobertIndie RobertIndie merged commit 0ae3f9d into apache:master Dec 14, 2024
52 checks passed
@RobertIndie RobertIndie deleted the fix-readModifyAndUpdate branch December 14, 2024 06:49
RobertIndie added a commit that referenced this pull request Dec 14, 2024
…ateOrCreate` (#23686)

## Motivation

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

## Modification

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry

(cherry picked from commit 0ae3f9d)
hanmz pushed a commit to hanmz/pulsar that referenced this pull request Feb 12, 2025
…ateOrCreate` (apache#23686)

## Motivation

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

## Modification

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry
lhotari pushed a commit that referenced this pull request Feb 17, 2025
…ateOrCreate` (#23686)

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry

(cherry picked from commit 0ae3f9d)
lhotari pushed a commit that referenced this pull request Feb 17, 2025
…ateOrCreate` (#23686)

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry

(cherry picked from commit 0ae3f9d)
nikhil-ctds pushed a commit to datastax/pulsar that referenced this pull request Feb 19, 2025
…ateOrCreate` (apache#23686)

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry

(cherry picked from commit 0ae3f9d)
(cherry picked from commit b56dfc7)
srinath-ctds pushed a commit to datastax/pulsar that referenced this pull request Feb 24, 2025
…ateOrCreate` (apache#23686)

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry

(cherry picked from commit 0ae3f9d)
(cherry picked from commit b56dfc7)
nodece pushed a commit to nodece/pulsar that referenced this pull request Mar 27, 2025
…ateOrCreate` (apache#23686)

The method `MetadataCache#readModifyUpdateOrCreate` should handle the BadVersionException by retrying the modification process, as already noted in the Java documentation: "The modify function can potentially be called multiple times due to concurrent updates."

Currently, `MetadataCache#readModifyUpdateOrCreate` does not catch the BadVersionException on the second attempt, allowing the exception to be passed to the caller. This issue can be easily reproduced by increasing concurrent futures in the test `MetadataCacheTest#readModifyUpdateBadVersionRetry`.

The current retry implementation is incorrect and lacks a backoff mechanism, which could lead to too many requests to the metadata store.

- Correct the retry process in `MetadataCache#readModifyUpdateOrCreate` to ensure BadVersionException is caught during each retry.
- Implement a retry backoff mechanism in `MetadataCache#readModifyUpdateOrCreate` to manage the frequency of retries effectively.
- Add new config `retryBackoff` to the MetadataCacheConfig to control the MetadataCache retry backoff.
- Respective the `metadataStoreOperationTimeoutSeconds` for the MetadataCache retry

(cherry picked from commit 0ae3f9d)
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.

6 participants