Skip to content
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

Validate rack name #14336

Merged
merged 3 commits into from
Feb 27, 2022
Merged

Conversation

hangc0276
Copy link
Contributor

Motivation

If the rack name set in the following case:

  • Enabled rack aware placement policy, and user set rack name which contains "/" in addition to the head and tail of the string. Such as "/r/a" or "r/a/b"
  • Enabled region aware placement policy, and user set the rack name which contains multiple "/" in addition to the head and tail of the string. Such as "/region/region/a" or "region/a/rack/b"

The broker will throw the following exception on onBookieRackChange

10:29:08.112 [BookKeeperClientScheduler-OrderedScheduler-0-0] ERROR org.apache.bookkeeper.client.TopologyAwareEnsemblePlacementPolicy - Unexpected exception while handling joining bookie test.bk3:3183
org.apache.bookkeeper.net.NetworkTopologyImpl$InvalidTopologyException: Invalid network topology. You cannot have a rack and a non-rack node at the same level of the network topology.
        at org.apache.bookkeeper.net.NetworkTopologyImpl.add(NetworkTopologyImpl.java:417) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.TopologyAwareEnsemblePlacementPolicy.handleBookiesThatJoined(TopologyAwareEnsemblePlacementPolicy.java:719) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl.handleBookiesThatJoined(RackawareEnsemblePlacementPolicyImpl.java:80) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicy.handleBookiesThatJoined(RackawareEnsemblePlacementPolicy.java:249) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.TopologyAwareEnsemblePlacementPolicy.onClusterChanged(TopologyAwareEnsemblePlacementPolicy.java:663) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicyImpl.onClusterChanged(RackawareEnsemblePlacementPolicyImpl.java:80) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.RackawareEnsemblePlacementPolicy.onClusterChanged(RackawareEnsemblePlacementPolicy.java:92) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.BookieWatcherImpl.processWritableBookiesChanged(BookieWatcherImpl.java:197) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.client.BookieWatcherImpl.lambda$initialBlockingBookieRead$1(BookieWatcherImpl.java:233) ~[org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.discover.ZKRegistrationClient$WatchTask.accept(ZKRegistrationClient.java:147) [org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at org.apache.bookkeeper.discover.ZKRegistrationClient$WatchTask.accept(ZKRegistrationClient.java:70) [org.apache.bookkeeper-bookkeeper-server-4.14.3.jar:4.14.3]
        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859) [?:?]
        at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837) [?:?]
        at java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478) [?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [io.netty-netty-common-4.1.72.Final.jar:4.1.72.Final]
        at java.lang.Thread.run(Thread.java:834) [?:?]

Modification

  1. Validate the rack name when setting the bookie rack info.
    • For rack aware placement policy, the rack name shouldn't contains "/" in addition to the head and tail of the rack name string.
    • For region aware placement policy, the rack name should only contains one "/" in addition to the head and tail of the rack name string.

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)

@Anonymitaet
Copy link
Member

Hi @momo-jun can you follow up on the docs? Thanks

@momo-jun
Copy link
Contributor

Hi @momo-jun can you follow up on the docs? Thanks

Sure. I'm on it.

Copy link
Contributor

@Jason918 Jason918 left a comment

Choose a reason for hiding this comment

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

Do we have a naming pattern or doc for rack name for users?

@hangc0276
Copy link
Contributor Author

Do we have a naming pattern or doc for rack name for users?

@Jason918 There are some notices in our website and pulsar-admin info. refer to: https://pulsar.apache.org/docs/en/next/administration-isolation/

@Anonymitaet Anonymitaet added doc-complete Your PR changes impact docs and the related docs have been already added. and removed doc-required Your PR changes impact docs and you will update later. labels Feb 21, 2022
@codelipenghui codelipenghui merged commit 25408f5 into apache:master Feb 27, 2022
codelipenghui pushed a commit that referenced this pull request Mar 1, 2022
### Motivation
If the rack name set in the following case:
-  Enabled rack aware placement policy, and user set rack name which contains "/" in addition to the head and tail of the string. Such as "/r/a" or "r/a/b"
- Enabled region aware placement policy, and user set the rack name which contains multiple "/" in addition to the head and tail of the string. Such as "/region/region/a" or "region/a/rack/b"

(cherry picked from commit 25408f5)
@codelipenghui codelipenghui modified the milestones: 2.11.0, 2.10.0 Mar 1, 2022
gaoran10 pushed a commit that referenced this pull request Mar 1, 2022
If the rack name set in the following case:
-  Enabled rack aware placement policy, and user set rack name which contains "/" in addition to the head and tail of the string. Such as "/r/a" or "r/a/b"
- Enabled region aware placement policy, and user set the rack name which contains multiple "/" in addition to the head and tail of the string. Such as "/region/region/a" or "region/a/rack/b"

(cherry picked from commit 25408f5)
@gaoran10 gaoran10 added the cherry-picked/branch-2.9 Archived: 2.9 is end of life label Mar 2, 2022
codelipenghui pushed a commit that referenced this pull request Mar 9, 2022
If the rack name set in the following case:
-  Enabled rack aware placement policy, and user set rack name which contains "/" in addition to the head and tail of the string. Such as "/r/a" or "r/a/b"
- Enabled region aware placement policy, and user set the rack name which contains multiple "/" in addition to the head and tail of the string. Such as "/region/region/a" or "region/a/rack/b"

(cherry picked from commit 25408f5)
@codelipenghui codelipenghui added the cherry-picked/branch-2.8 Archived: 2.8 is end of life label Mar 9, 2022
nicoloboschi pushed a commit to datastax/pulsar that referenced this pull request Mar 9, 2022
If the rack name set in the following case:
-  Enabled rack aware placement policy, and user set rack name which contains "/" in addition to the head and tail of the string. Such as "/r/a" or "r/a/b"
- Enabled region aware placement policy, and user set the rack name which contains multiple "/" in addition to the head and tail of the string. Such as "/region/region/a" or "region/a/rack/b"

(cherry picked from commit 25408f5)
(cherry picked from commit c7cf50a)
Nicklee007 pushed a commit to Nicklee007/pulsar that referenced this pull request Apr 20, 2022
### Motivation
If the rack name set in the following case:
-  Enabled rack aware placement policy, and user set rack name which contains "/" in addition to the head and tail of the string. Such as "/r/a" or "r/a/b"
- Enabled region aware placement policy, and user set the rack name which contains multiple "/" in addition to the head and tail of the string. Such as "/region/region/a" or "region/a/rack/b"
Jason918 added a commit to Jason918/pulsar that referenced this pull request Jul 28, 2022
@Jason918 Jason918 mentioned this pull request Jul 28, 2022
3 tasks
Jason918 added a commit to Jason918/pulsar that referenced this pull request Jul 31, 2022
Jason918 added a commit to Jason918/pulsar that referenced this pull request Jul 31, 2022
@Jason918
Copy link
Contributor

Jason918 commented Aug 1, 2022

Move release/2.7.5 label to #16850

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/broker cherry-picked/branch-2.8 Archived: 2.8 is end of life cherry-picked/branch-2.9 Archived: 2.9 is end of life doc-complete Your PR changes impact docs and the related docs have been already added. release/2.8.4 release/2.9.2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants