Skip to content

Conversation

@leizhiyuan
Copy link
Contributor

@leizhiyuan leizhiyuan commented Dec 7, 2021

Fixes #13162

Motivation

fix: remove the loadbalance/bundle-data node, when deleting namespace. it will cause zk node leak, fix #13162

Modifications

remove the bundle-data Recursively

Verifying this change

Extended integration test for recovery after broker failure

Does this pull request potentially affect one of the following parts:

If yes was chosen, please highlight the changes

  • Dependencies (does it add or upgrade a dependency): (yes / no)
  • The public API: no
  • The schema: no
  • The default values of configurations: no
  • The wire protocol: no
  • The rest endpoints: no
  • The admin cli options: no
  • Anything that affects deployment: no

Documentation

Check the box below and label this PR (if you have committer privilege).

Need to update docs?

  • doc-required

    (If you need help on updating docs, create a doc issue)

  • no-need-doc

    (Please explain why)

  • doc

    (If this PR contains doc changes)

@github-actions
Copy link

github-actions bot commented Dec 7, 2021

@leizhiyuan:Thanks for your contribution. For this PR, do we need to update docs?
(The PR template contains info about doc, which helps others know more about the changes. Can you provide doc-related info in this and future PR descriptions? Thanks)

@github-actions
Copy link

github-actions bot commented Dec 7, 2021

@leizhiyuan:Thanks for providing doc info!

@github-actions github-actions bot added doc-not-needed Your PR changes do not impact docs and removed doc-label-missing labels Dec 7, 2021
Copy link
Contributor

@315157973 315157973 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

Can you add test case for testDeleteTenant?


// clear resource of `/loadbalance/bundle-data/{tenant}/` for zk-node
public CompletableFuture<Void> deleteBundleDataTenantAsync(String tenant) {
final String namespaceBundlePath = joinPath(BUNDLE_DATA_BASE_PATH, tenant);
Copy link
Member

Choose a reason for hiding this comment

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

Maybe tenantBundlePath is good name then namespaceBundlePath

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

final String namespaceBundlePath = joinPath(BUNDLE_DATA_BASE_PATH, tenant);
CompletableFuture<Void> future = new CompletableFuture<Void>();
deleteRecursiveAsync(this, namespaceBundlePath).whenComplete((ignore, ex) -> {
if (ex != null && ex.getCause() instanceof KeeperException.NoNodeException) {
Copy link
Member

Choose a reason for hiding this comment

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

If you use ex.getCause(), you get should not be a KeeperException, but an exception of the megastore that encapsulates the zk client. So here should use ex.getCause().getCause()?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

final String namespaceBundlePath = joinPath(BUNDLE_DATA_BASE_PATH, ns.toString());
CompletableFuture<Void> future = new CompletableFuture<Void>();
deleteRecursiveAsync(this, namespaceBundlePath).whenComplete((ignore, ex) -> {
if (ex != null && ex.getCause() instanceof KeeperException.NoNodeException) {
Copy link
Member

Choose a reason for hiding this comment

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

Please use ex.getCause().getCause()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ex.getCause().getCause() will be null

@leizhiyuan
Copy link
Contributor Author

need to rerun the test case,It is not related with this pr。

final String namespaceBundlePath = joinPath(BUNDLE_DATA_BASE_PATH, ns.toString());
CompletableFuture<Void> future = new CompletableFuture<Void>();
deleteRecursiveAsync(this, namespaceBundlePath).whenComplete((ignore, ex) -> {
if (ex != null && ExceptionUtils.getRootCause(ex) instanceof KeeperException.NoNodeException) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use org.apache.pulsar.metadata.api.MetadataStoreException.NotFoundException to replace KeeperException.NoNodeException. The underlying metadata store supports multi implementations now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

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

Good Patch, LGTM

@wolfstudy wolfstudy merged commit 1220f84 into apache:master Dec 8, 2021
fxbing pushed a commit to fxbing/pulsar that referenced this pull request Dec 19, 2021
Fixes apache#13162


### Motivation


fix: remove the loadbalance/bundle-data node, when deleting namespace. it will cause zk node leak, fix apache#13162

### Modifications

remove the bundle-data Recursively
@wolfstudy wolfstudy added this to the 2.11.0 milestone May 5, 2022
@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.10.0 May 20, 2022
@mattisonchao mattisonchao added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label May 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-not-needed Your PR changes do not impact docs release/2.9.3

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bundle-data do not be deleted when delete namespace

6 participants