-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Pulsar-sql]Using pulsar SQL query messages will appear `NoSuchLedger… #9910
Conversation
…` when zk root directory changed (apache#2258) Fixes apache#2258 *Motivation* When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause `BKNoSuchLedgerExistsException`. *Modifications* To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113) when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps, finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001;
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.
Could you please help add a test to cover this change?
And, I think it needs to rebase to the current master branch to get CI works.
…` when zk root directory changed (apache#2258) Fixes apache#2258 *Motivation* When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause `BKNoSuchLedgerExistsException`. *Modifications* To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113) when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps, finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001;
…` when zk root directory changed (apache#2258) Fixes apache#2258 *Motivation* When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause `BKNoSuchLedgerExistsException`. *Modifications* To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113) when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps, finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001;
@gaoran10 Would you please also help review this PR? |
@@ -145,7 +145,7 @@ private ManagedLedgerFactoryImpl(ZooKeeper zkc, ClientConfiguration bkClientConf | |||
zkc, config, NullStatsLogger.INSTANCE); | |||
} | |||
|
|||
private ManagedLedgerFactoryImpl(ClientConfiguration clientConfiguration, String zkConnection, ManagedLedgerFactoryConfig config) throws Exception { | |||
public ManagedLedgerFactoryImpl(ClientConfiguration clientConfiguration, String zkConnection, ManagedLedgerFactoryConfig config) throws Exception { |
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.
Can we add support for creating ManagerLedgerFactoryImpl with a Builder?
It is a code smell to add new public constructors.
WDYT?
Cc @codelipenghui
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.
Yes, we can create a builder for the ManagerLedgerFactoryImpl
, we can do that in a separate PR I think.
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.
@@ -112,7 +112,7 @@ private static ManagedLedgerFactory initManagedLedgerFactory(PulsarConnectorConf | |||
pulsarConnectorConfig.getManagedLedgerNumWorkerThreads()); | |||
managedLedgerFactoryConfig.setNumManagedLedgerSchedulerThreads( | |||
pulsarConnectorConfig.getManagedLedgerNumSchedulerThreads()); | |||
return new ManagedLedgerFactoryImpl(bkClientConfiguration, managedLedgerFactoryConfig); | |||
return new ManagedLedgerFactoryImpl(bkClientConfiguration, pulsarConnectorConfig.getZookeeperUri(),managedLedgerFactoryConfig); |
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.
The code .setZkServers(pulsarConnectorConfig.getZookeeperUri())
could be removed in line 97.
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.
The code
.setZkServers(pulsarConnectorConfig.getZookeeperUri())
could be removed in line 97.
please don't remove it; it 's very essentia for us to get manage-ledger info(/managed-ledger/) or get cursor info because it need zk root path(); Only when we create bookkeeper, we don't need ZK root path;ZK root path will be auto created in bookeeper by metadataServiceUri(project bookkeeper AbstractZkLedgerManager.java row 169)
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.
setZKServers is diffrent from setMetadataServiceUri,we need both
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.
The ClientConfiguration
bkClientConfiguration is used to generate the bookkeeper, the MetadataServiceUri
is enough, we don't need to set the ZkServers
and the method setZkServers
is deprecated.
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.
yes,you are right.;
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.
before i revise it,it is neccessary to create metadatastore
(ManagedLedgerFacoryImpl.java row 199);
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.
The
ClientConfiguration
bkClientConfiguration is used to generate the bookkeeper, theMetadataServiceUri
is enough, we don't need to set theZkServers
and the methodsetZkServers
is deprecated.
today,i found it's neccessay to setZkServers .when broker's zk Path is diffrent from bookies's zk Path.
/pulsarbot run-failure-checks |
@@ -145,7 +145,7 @@ private ManagedLedgerFactoryImpl(ZooKeeper zkc, ClientConfiguration bkClientConf | |||
zkc, config, NullStatsLogger.INSTANCE); | |||
} | |||
|
|||
private ManagedLedgerFactoryImpl(ClientConfiguration clientConfiguration, String zkConnection, ManagedLedgerFactoryConfig config) throws Exception { | |||
public ManagedLedgerFactoryImpl(ClientConfiguration clientConfiguration, String zkConnection, ManagedLedgerFactoryConfig config) throws Exception { |
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.
Yes, we can create a builder for the ManagerLedgerFactoryImpl
, we can do that in a separate PR I think.
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.
LGTM
#9910) * [Pulsar-sql]Using pulsar SQL query messages will appear `NoSuchLedger` when zk root directory changed (#2258) Fixes #2258 *Motivation* When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause `BKNoSuchLedgerExistsException`. *Modifications* To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113) when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps, finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001; * [Pulsar-sql]Using pulsar SQL query messages will appear `NoSuchLedger` when zk root directory changed (#2258) Fixes #2258 *Motivation* When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause `BKNoSuchLedgerExistsException`. *Modifications* To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113) when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps, finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001; * [Pulsar-sql]Using pulsar SQL query messages will appear `NoSuchLedger` when zk root directory changed (#2258) Fixes #2258 *Motivation* When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause `BKNoSuchLedgerExistsException`. *Modifications* To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113) when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps, finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001; Co-authored-by: 919364728@qq.com <1314520Ljq--> (cherry picked from commit b1ba8e5)
…` when zk root directory changed #9847
Fixes #9847
Motivation
When zookeeper ledgers root path is changed, using pulsar-sql to query messages will cause
BKNoSuchLedgerExistsException
.Modifications
To use new DefaultBkFactory(clientConfiguration),so that zk will be null in Bookeeper constructor;(Bookeeper.java row 113)
when metadataDriver will be initialized(Bookeeper.java row 167),zookeeper conection is null; we can jump to another branch.If we have done the above steps,
finally, zkServers will be localhost:2181 rather than localhost:2181/pulsar in row 168(ZKMetadataDriverBase.java); the path that we use to get ledger is localhost:2181/pulsar/ledger/00/0000/L0001 rather than localhost:2181/pulsar/pulsar/ledger/00/0000/L0001;