gaozhangmin commented on pull request #14686:
URL: https://github.com/apache/pulsar/pull/14686#issuecomment-1071976491


   > Mabye these is another problem if set `MetadataServiceUri` with a prefix 
`metadata-store:`
   > 
   > ```java
   > bkConf.setMetadataServiceUri("metadata-store:" + 
metadataStoreUrlNoIdentifer);
   > ```
   > 
   > then execute `BookKeeperAdmin.format`
   > 
   > ```java
   > if 
(!localStore.exists(BookKeeperConstants.DEFAULT_ZK_LEDGERS_ROOT_PATH).get()
   >                 && !BookKeeperAdmin.format(bkConf, false /* interactive 
*/, false /* force */)) {
   >                 throw new IOException("Failed to initialize BookKeeper 
metadata");
   >             }
   > ```
   > 
   > which will get `MetadataBookieDriver` first
   > 
   > ```java
   > try (MetadataBookieDriver driver = MetadataDrivers.getBookieDriver(
   >             URI.create(conf.getMetadataServiceUri())
   >         )) 
   > ```
   > 
   > So the URI created here has a scheme `metadata-store`, then getting 
`MetadataBookieDriver` will throw an exception since bookie only has `zk` and 
`etcd` as scheme.
   
   No, `metadata-store` had been registered.  @aloyszhang 
   ```
   public class PulsarMetadataBookieDriver extends AbstractMetadataDriver 
implements MetadataBookieDriver {
   
       // register myself
       static {
           MetadataDrivers.registerBookieDriver(METADATA_STORE_SCHEME, 
PulsarMetadataBookieDriver.class);
       }
   
       @Override
       public MetadataBookieDriver initialize(ServerConfiguration 
serverConfiguration,
                                              
RegistrationManager.RegistrationListener registrationListener,
                                              StatsLogger statsLogger) throws 
MetadataException {
           super.initialize(serverConfiguration);
           return this;
       }
   
       @Override
       public RegistrationManager getRegistrationManager() {
           return registrationManager;
       }
   
       @Override
       public LedgerManagerFactory getLedgerManagerFactory() throws 
MetadataException {
           return ledgerManagerFactory;
       }
   
       @Override
       public LayoutManager getLayoutManager() {
           return layoutManager;
       }
   }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to