You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2019/07/29 12:01:54 UTC
[GitHub] [pulsar] jiazhai commented on a change in pull request #4739:
offload bucket per namespace
jiazhai commented on a change in pull request #4739: offload bucket per namespace
URL: https://github.com/apache/pulsar/pull/4739#discussion_r308191531
##########
File path: pulsar-broker/src/main/java/org/apache/pulsar/broker/PulsarService.java
##########
@@ -743,6 +747,97 @@ public synchronized LedgerOffloader createManagedLedgerOffloader(ServiceConfigur
}
}
+ public synchronized LedgerOffloader createManagedLedgerOffloader(ServiceConfiguration conf, OffloadPolicies offloadPolicies)
+ throws PulsarServerException {
+ try {
+ if (StringUtils.isNotBlank(offloadPolicies.getDriver())) {
+ checkNotNull(conf.getOffloadersDirectory(),
+ "Offloader driver is configured to be '%s' but no offloaders directory is configured.",
+ conf.getManagedLedgerOffloadDriver());
+ this.offloaderManager = OffloaderUtils.searchForOffloaders(conf.getOffloadersDirectory());
+ LedgerOffloaderFactory offloaderFactory = this.offloaderManager.getOffloaderFactory(offloadPolicies.getDriver());
+ try {
+ return offloaderFactory.create(
+ conf.getProperties(),
+ offloadPolicies,
+ ImmutableMap.of(
+ LedgerOffloader.METADATA_SOFTWARE_VERSION_KEY.toLowerCase(), PulsarVersion.getVersion(),
+ LedgerOffloader.METADATA_SOFTWARE_GITSHA_KEY.toLowerCase(), PulsarVersion.getGitSha()
+ ),
+ getOffloaderScheduler(conf));
+ } catch (IOException ioe) {
+ throw new PulsarServerException(ioe.getMessage(), ioe.getCause());
+ }
+ } else {
+ LOG.info("No ledger offloader configured, using NULL instance");
+ return NullLedgerOffloader.INSTANCE;
+ }
+ } catch (Throwable t) {
+ throw new PulsarServerException(t);
+ }
+ }
+
+ public Map<NamespaceName, LedgerOffloader> createNamespacesOffloaders() {
+ try {
+ List<String> tenants = this.getZkClient().getChildren(path(POLICIES), false);
+ tenants.sort(null);
+ Map<NamespaceName, LedgerOffloader> namespacesOffloaders = Maps.newHashMap();
+ for (String tenantName: tenants) {
+ // this will return a cluster in v1 and a namespace in v2
Review comment:
support V2 is enough, since V1 is kind of deprecated
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services