You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "gaozhangmin (via GitHub)" <gi...@apache.org> on 2025/08/11 04:31:47 UTC
[PR] fix_resolveLedgersRootPath [pulsar]
gaozhangmin opened a new pull request, #24618:
URL: https://github.com/apache/pulsar/pull/24618
### Motivation
The issue occurs when configuring
bookkeeperMetadataServiceUri=metadata-store:zk:metadata-store:2181/ledgers along with enabling:
text
-Dbookkeeper.metadata.bookie.drivers=org.apache.pulsar.metadata.bookkeeper.PulsarMetadataBookieDriver
-Dbookkeeper.metadata.client.drivers=org.apache.pulsar.metadata.bookkeeper.PulsarMetadataClientDriver
Root Cause Analysis
The problem arises in AbstractMetadataDriver when creating MetadataStoreExtended. Specifically:
The resolveLedgersRootPath() method has a bug in path parsing.
When using ZooKeeper (ZK), the connection string typically includes a double slash (//) (e.g., zk://metadata-store:2181/ledgers), which ensures URI.getPath() correctly returns /ledgers.
However, Pulsar’s metadata service connection string (metadata-store:zk:metadata-store:2181/ledgers) lacks the // prefix, causing URI.getPath() to incorrectly parse the ledger root path, defaulting to /ledgers regardless of the configured path.
```
URI metadataServiceUri = URI.create(metadataServiceUriStr);
String path = metadataServiceUri.getPath();
return path == null ? BookKeeperConstants.DEFAULT_ZK_LEDGERS_ROOT_PATH : path;
```
### Modifications
The fix should ensure proper path resolution regardless of the connection string format. Possible approaches:
Normalize the connection string before parsing (e.g., ensure // is present for consistency).
Improve resolveLedgersRootPath() to handle both formats (with or without //).
Example: Extract the path segment after the last : or / if the URI parsing fails.
Explicitly enforce a default /ledgers fallback only when path extraction fails.
### Verifying this change
### Does this pull request potentially affect one of the following parts:
- [ ] 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
- [ ] The metrics
- [ ] Anything that affects deployment
### Documentation
<!-- DO NOT REMOVE THIS SECTION. CHECK THE PROPER BOX ONLY. -->
- [ ] `doc` <!-- Your PR contains doc changes. -->
- [ ] `doc-required` <!-- Your PR changes impact docs and you will update later -->
- [ ] `doc-not-needed` <!-- Your PR changes do not impact docs -->
- [ ] `doc-complete` <!-- Docs have been already added -->
### Matching PR in forked repository
PR in forked repository: <!-- ENTER URL HERE -->
<!--
After opening this PR, the build in apache/pulsar will fail and instructions will
be provided for opening a PR in the PR author's forked repository.
apache/pulsar pull requests should be first tested in your own fork since the
apache/pulsar CI based on GitHub Actions has constrained resources and quota.
GitHub Actions provides separate quota for pull requests that are executed in
a forked repository.
The tests will be run in the forked repository until all PR review comments have
been handled, the tests pass and the PR is approved by a reviewer.
-->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][metadatastore] Support set bk client zkTimeout [pulsar]
Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin commented on PR #24618:
URL: https://github.com/apache/pulsar/pull/24618#issuecomment-3175612090
To avoid the path resolution bug in AbstractMetadataDriver, we should remove /ledgers from the bookkeeperMetadataServiceUri configuration . Since that, this pr wouldn't be needed any more.
But I found there is another problem, the default zktimeout of bk is 10s, but
We caculate tickTimeMillis = zktimeout/15.
https://github.com/apache/pulsar/blob/277835a65dd586de941b7d0ad448843b7b5589a4/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java#L63
In below future.get, always timeout.
https://github.com/apache/pulsar/blob/277835a65dd586de941b7d0ad448843b7b5589a4/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java#L108-L112
We should support set bk zktimeut by
bkConf.setZkTimeout((int) conf.getMetadataStoreSessionTimeoutMillis());
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][metadatastore]fix_resolveLedgersRootPath [pulsar]
Posted by "zhannao456 (via GitHub)" <gi...@apache.org>.
zhannao456 commented on PR #24618:
URL: https://github.com/apache/pulsar/pull/24618#issuecomment-3175543738
To avoid the path resolution bug in AbstractMetadataDriver, we should remove /ledgers from the bookkeeperMetadataServiceUri configuration . Since that, this pr wouldn't be needed any more.
But I found there is another problem, the default zktimeout of bk is 10s, but
We caculate tickTimeMillis = zktimeout/15.
https://github.com/apache/pulsar/blob/277835a65dd586de941b7d0ad448843b7b5589a4/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java#L63
In below future.get, always timeout.
https://github.com/apache/pulsar/blob/277835a65dd586de941b7d0ad448843b7b5589a4/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/ZKSessionWatcher.java#L108-L112
We should support set bk zktimeut by
bkConf.setZkTimeout((int) conf.getMetadataStoreSessionTimeoutMillis());
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [fix][broker] fix bk configuration bookkeeperMetadataServiceUri [pulsar]
Posted by "gaozhangmin (via GitHub)" <gi...@apache.org>.
gaozhangmin closed pull request #24618: [fix][broker] fix bk configuration bookkeeperMetadataServiceUri
URL: https://github.com/apache/pulsar/pull/24618
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pulsar.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org