-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Conversation
run integration 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, thanks.
@sijie please help to review this. |
if (StringUtils.isNotBlank(conf.getBookkeeperServiceUri())) { | ||
bkConf.setMetadataServiceUri(conf.getBookkeeperServiceUri()); | ||
} else { | ||
PulsarService pulsar = new PulsarService(conf); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
@murong00 I thought I reviewed it already. but it turned out that I forgot to click submit button. Here is the review comment. PTAL |
f9acd25
to
786b310
Compare
@sijie Thanks for the review, PTAL. |
@@ -28,19 +28,19 @@ | |||
|
|||
private String zookeeperServers; | |||
private String configurationStoreServers; | |||
private String ledgersRootPath; | |||
private String metadataServiceUri; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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= |
There was a problem hiding this comment.
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").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bkMetadataServiceUri
seems better?
There was a problem hiding this comment.
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.
@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? |
@jiazhai Thanks for the review, please help to take a look again. |
/pulsarbot run-failure-checks |
Rebuild some logic Rebuild some logic Added missing changes
Fix a unit test
Fix checkstyle
/pulsarbot run-failure-checks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1.
@sijie Please help to take a look about this again. |
ClientConfiguration bkConf = new ClientConfiguration(); | ||
// init bookkeeper metadata service uri | ||
String metadataServiceUri = null; | ||
try { |
There was a problem hiding this comment.
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();
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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.
@sijie Thanks for the advise and review, please help to take a look. |
/pulsarbot run-failure-checks |
@sijie Could you please help to take a look when you are available? Thanks. |
…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.
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
bookkeeperServiceUri
to discover bookkeeper cluster metadata store.