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

[Issue 5935] Support multi pulsar clusters to use the same bk cluster #5985

Merged
merged 5 commits into from
Apr 21, 2020

Conversation

murong00
Copy link
Contributor

@murong00 murong00 commented Jan 3, 2020

Motivation

Fixes #5935

Support multi pulsar clusters to use the specified bookkeeper cluster by pointing BookKeeper Client to the zookeeper connection string of bookkeeper cluster.

Modifications

  • Add a config bookkeeperServiceUri to discover bookkeeper cluster metadata store.
  • Use metadata service uri to init bookkeeper client.

@tuteng
Copy link
Member

tuteng commented Jan 8, 2020

run integration tests
run java8 tests

ServerConfiguration bkConf = new ServerConfiguration();
bkConf.setZkServers(arguments.zookeeper);
bkConf.setZkTimeout(arguments.zkSessionTimeoutMillis);
if (localZk.exists("/ledgers", false) == null // only format if /ledgers doesn't exist
Copy link
Member

Choose a reason for hiding this comment

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

why do we remove this logic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just a mistake, modified.

doc = "BookKeeper ledgers storage connection string when using a separated BookKeeper cluster."
+ " If not set it will use local zookeeper quorum of Pulsar cluster"
)
private String bookkeeperLedgersStore;
Copy link
Member

Choose a reason for hiding this comment

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

in bookkeeper we deprecated using two separate settings. we are encouraging people to use metadata service uri to connect to a zookeeper cluster. we should try to adopt it in Pulsar. Thus if we are adding the support for a separate bookkeeper cluster, let's try to use metadata service uri.

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, thanks.

@murong00
Copy link
Contributor Author

@sijie please help to review this.

@murong00
Copy link
Contributor Author

@sijie @jiazhai I have addressed sijie's comment, please help to review again, thanks.

@murong00
Copy link
Contributor Author

@sijie @jiazhai @tuteng How this issue going, can we finish it in milestone 2.5.1 or 2.6.0?

if (StringUtils.isNotBlank(conf.getBookkeeperServiceUri())) {
bkConf.setMetadataServiceUri(conf.getBookkeeperServiceUri());
} else {
PulsarService pulsar = new PulsarService(conf);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should try to construct PulsarService. because the constructor also does a lot of unrelated things.

I would suggest adding a util function to generate metadata service url from the configuration.

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.

@sijie
Copy link
Member

sijie commented Feb 24, 2020

@murong00 I thought I reviewed it already. but it turned out that I forgot to click submit button. Here is the review comment. PTAL

@murong00
Copy link
Contributor Author

murong00 commented Feb 25, 2020

@sijie Thanks for the review, PTAL.

@@ -28,19 +28,19 @@

private String zookeeperServers;
private String configurationStoreServers;
private String ledgersRootPath;
private String metadataServiceUri;
Copy link
Member

Choose a reason for hiding this comment

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

It seems ledgersRootPath is much more direct than metadataServiceUri. metadata may lead developer think of "zookeeper". How about change this back?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jiazhai In fact, metadataServiceUri here is a uri to connect to a zookeeper cluster, which is used to find bookies. I would prefer to keep it since ledgersRootPath seems more like a path and is using together with zookeeper. As sijie's comment above, we are trying to use a metadata service uri, so how about bkMetadataServiceUri?

conf/broker.conf Outdated
@@ -461,6 +461,10 @@ httpMaxRequestSize=-1

### --- BookKeeper Client --- ###

# Metadata service uri that bookkeeper is used for loading corresponding metadata driver
# and resolving its metadata service location.
bookkeeperServiceUri=
Copy link
Member

Choose a reason for hiding this comment

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

how about bkLedgerRootPath? This seems be more directly.
bookkeeperServiceUri may be easy confused with the bookie service url(e.g. "localhost:3181").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

bkMetadataServiceUri seems better?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will add an example here to make it more clear.

@jiazhai
Copy link
Member

jiazhai commented Apr 2, 2020

@murong00 Thanks for the work. left some comments related to the var names. overall lgtm. Would you please take a look, and rebase this PR with the latest master code?

@murong00
Copy link
Contributor Author

murong00 commented Apr 3, 2020

@jiazhai Thanks for the review, please help to take a look again.

@murong00
Copy link
Contributor Author

murong00 commented Apr 9, 2020

/pulsarbot run-failure-checks

@murong00
Copy link
Contributor Author

/pulsarbot run-failure-checks

Copy link
Member

@jiazhai jiazhai left a comment

Choose a reason for hiding this comment

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

+1.

@murong00
Copy link
Contributor Author

@sijie Please help to take a look about this again.

ClientConfiguration bkConf = new ClientConfiguration();
// init bookkeeper metadata service uri
String metadataServiceUri = null;
try {
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we should add this logic here. We should reply on the logic that bookkeeper already provides. You can do this by using the following code snippet.

ClientConfiguration bkConf = new ClientConfiguration();
bkConf.setZkServers(config.getZooKeeperServers());
return bkConf.getMetadataServiceUri();

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.

@@ -28,19 +28,19 @@

private String zookeeperServers;
private String configurationStoreServers;
private String ledgersRootPath;
Copy link
Member

Choose a reason for hiding this comment

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

for backward compatibility, you shouldn't change the field directly.

You can add a new field bookkeeperMetadataServiceUri and deprecate the old field ledgersRootPath .

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing this out, done.

@murong00
Copy link
Contributor Author

@sijie Thanks for the advise and review, please help to take a look.

@murong00
Copy link
Contributor Author

/pulsarbot run-failure-checks

@murong00
Copy link
Contributor Author

@sijie Could you please help to take a look when you are available? Thanks.

@sijie sijie merged commit 188d896 into apache:master Apr 21, 2020
huangdx0726 pushed a commit to huangdx0726/pulsar that referenced this pull request Aug 24, 2020
…apache#5985)

### Motivation

Fixes apache#5935

Support multi pulsar clusters to use the specified bookkeeper cluster by pointing `BookKeeper Client` to the zookeeper connection string of bookkeeper cluster.

### Modifications

- Add a config `bookkeeperServiceUri` to discover bookkeeper cluster metadata store.
- Use metadata service uri to init bookkeeper client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple pulsar clusters use the same bookkeeper cluster ?
4 participants