Skip to content

[fix][broker] Fix uncompleted future when getting the topic policies of a deleted topic - #18824

Merged
liangyepianzhou merged 1 commit into
apache:masterfrom
liangyepianzhou:xiangying/fix/topic/fix_uncompleteFuture_of_get_topic_policy
Dec 9, 2022
Merged

liangyepianzhou merged 1 commit into
apache:masterfrom
liangyepianzhou:xiangying/fix/topic/fix_uncompleteFuture_of_get_topic_policy

Conversation

@liangyepianzhou

@liangyepianzhou liangyepianzhou commented Dec 8, 2022 •

Copy link
Copy Markdown
Contributor

Motivation

Fix the uncompleted future when getting the topic policies of a deleted topic.

reader.readNextAsync().whenComplete((msg, e) -> {
if (e != null) {
future.completeExceptionally(e);
}
if (msg.getValue() != null
&& EventType.TOPIC_POLICY.equals(msg.getValue().getEventType())) {
TopicPoliciesEvent topicPoliciesEvent = msg.getValue().getTopicPoliciesEvent();
if (topicName.equals(TopicName.get(
topicPoliciesEvent.getDomain(),
topicPoliciesEvent.getTenant(),
topicPoliciesEvent.getNamespace(),
topicPoliciesEvent.getTopic()))
) {
fetchTopicPoliciesAsyncAndCloseReader(reader, topicName,
topicPoliciesEvent.getPolicies(), future);
} else {
fetchTopicPoliciesAsyncAndCloseReader(reader, topicName, policies, future);
}
}
});
} else {
future.complete(policies);
reader.closeAsync().whenComplete((v, e) -> {

Modification

future.complete(null); when msg.getValue() == null.

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
  • Anything that affects deployment

Documentation

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

Matching PR in forked repository

PR in forked repository: liangyepianzhou#17

… deleted topic

### Motivation
Fix uncompleted future when get the topic policies of a deleted topic.
### Modification
`future.complete(null);` when `msg.getValue() != null`.
@github-actions github-actions Bot added the doc-not-needed Your PR changes do not impact docs label Dec 8, 2022
@AnonHxy

AnonHxy commented Dec 9, 2022

Copy link
Copy Markdown
Contributor

LGTM. It seems that this method will only be called from UT test case now

@codecov-commenter

codecov-commenter commented Dec 9, 2022 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 48.12%. Comparing base (cd85a67) to head (3b54a05).
⚠️ Report is 3255 commits behind head on master.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #18824      +/-   ##
============================================
+ Coverage     47.39%   48.12%   +0.72%     
- Complexity    10479    10730     +251     
============================================
  Files           698      703       +5     
  Lines         68070    68819     +749     
  Branches       7279     7376      +97     
============================================
+ Hits          32264    33118     +854     
+ Misses        32228    32003     -225     
- Partials       3578     3698     +120     
Flag Coverage Δ
unittests 48.12% <100.00%> (+0.72%) ⬆️

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

Files with missing lines Coverage Δ
.../service/SystemTopicBasedTopicPoliciesService.java 72.25% <100.00%> (+7.53%) ⬆️

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

@liangyepianzhou
liangyepianzhou merged commit b311961 into apache:master Dec 9, 2022
@congbobo184 congbobo184 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Dec 10, 2022
Demogorgon314 pushed a commit to Demogorgon314/pulsar that referenced this pull request Dec 26, 2022
Demogorgon314 pushed a commit to Demogorgon314/pulsar that referenced this pull request Dec 29, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 10, 2023
lifepuzzlefun pushed a commit to lifepuzzlefun/pulsar that referenced this pull request Jan 10, 2023
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Jan 11, 2023
@liangyepianzhou
liangyepianzhou deleted the xiangying/fix/topic/fix_uncompleteFuture_of_get_topic_policy branch February 27, 2023 03:27
@momo-jun momo-jun changed the title [fix][broker] Fix uncompleted future when get the topic policies of a deleted topic [fix][broker] Fix uncompleted future when getting the topic policies of a deleted topic Apr 28, 2023
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