Skip to content

Conversation

@coderzc
Copy link
Member

@coderzc coderzc commented Sep 16, 2022

Motivation

In line 302 of MetadataCacheImpl#executeWithRetry,
the result of the future is set to a null value, which will lead to getting the result of readModifyUpdate and readModifyUpdateOrCreate will get a null value.
Fortunately, we haven't used this value for the time being.

private CompletableFuture<T> executeWithRetry(Supplier<CompletableFuture<T>> op, String key) {
CompletableFuture<T> result = new CompletableFuture<>();
op.get().thenAccept(r -> result.complete(r)).exceptionally((ex) -> {
if (ex.getCause() instanceof BadVersionException) {
// if resource is updated by other than metadata-cache then metadata-cache will get bad-version
// exception. so, try to invalidate the cache and try one more time.
objCache.synchronous().invalidate(key);
op.get().thenAccept((c) -> result.complete(null)).exceptionally((ex1) -> {
result.completeExceptionally(ex1.getCause());
return null;
});
return null;
}
result.completeExceptionally(ex.getCause());
return null;
});
return result;
}
}

Modifications

Fix executeWithRetry result is null and modify the test to cover it.

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-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@coderzc coderzc force-pushed the fix_executeWithRetry branch from d803392 to de7a726 Compare September 16, 2022 09:58
@github-actions github-actions bot added the doc-not-needed Your PR changes do not impact docs label Sep 16, 2022
@coderzc
Copy link
Member Author

coderzc commented Sep 27, 2022

@rdhabalia PTAL

@codelipenghui codelipenghui merged commit 628e760 into apache:master Oct 11, 2022
congbobo184 pushed a commit that referenced this pull request Nov 9, 2022
@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Nov 9, 2022
congbobo184 pushed a commit that referenced this pull request Nov 26, 2022
liangyepianzhou pushed a commit that referenced this pull request Dec 5, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Dec 6, 2022
(cherry picked from commit 628e760)
(cherry picked from commit d9594e4)
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