Search in sources :

Example 1 with BadVersionException

use of org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException in project pulsar by apache.

the class LoadBalancerTest method createNamespacePolicies.

private void createNamespacePolicies(PulsarService pulsar) throws Exception {
    // // prepare three policies for the namespace isolation
    NamespaceIsolationPolicies policies = new NamespaceIsolationPolicies();
    // set up policy that use this broker as primary
    Map<String, String> parameters = new HashMap<>();
    parameters.put("min_limit", "1");
    parameters.put("usage_threshold", "100");
    List<String> allBrokers = new ArrayList<>();
    for (int i = 0; i < BROKER_COUNT; i++) {
        allBrokers.add(pulsarServices[i].getAdvertisedAddress());
    }
    NamespaceIsolationData policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/primary-ns.*")).primary(allBrokers).secondary(Collections.emptyList()).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("primaryBrokerPolicy", policyData);
    List<String> allExceptFirstBroker = new ArrayList<>();
    for (int i = 1; i < BROKER_COUNT; i++) {
        allExceptFirstBroker.add(pulsarServices[i].getAdvertisedAddress());
    }
    // set up policy that use this broker as secondary
    policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/secondary-ns.*")).primary(Collections.singletonList(pulsarServices[0].getWebServiceAddress())).secondary(allExceptFirstBroker).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("secondaryBrokerPolicy", policyData);
    // set up policy that do not use this broker (neither primary nor secondary)
    policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/shared-ns.*")).primary(Collections.singletonList(pulsarServices[0].getWebServiceAddress())).secondary(allExceptFirstBroker).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("otherBrokerPolicy", policyData);
    try {
        pulsar.getPulsarResources().getNamespaceResources().getIsolationPolicies().createIsolationData("use", policies.getPolicies());
    } catch (BadVersionException e) {
        // isolation policy already exist
        pulsar.getPulsarResources().getNamespaceResources().getIsolationPolicies().setIsolationData("use", data -> policies.getPolicies());
    }
}
Also used : CreateMode(org.apache.zookeeper.CreateMode) URL(java.net.URL) ObjectMapperFactory(org.apache.pulsar.common.util.ObjectMapperFactory) LoggerFactory(org.slf4j.LoggerFactory) Test(org.testng.annotations.Test) AfterMethod(org.testng.annotations.AfterMethod) NamespaceIsolationPolicies(org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies) Future(java.util.concurrent.Future) SystemResourceUsage(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage) PulsarResourceDescription(org.apache.pulsar.broker.loadbalance.impl.PulsarResourceDescription) Map(java.util.Map) NamespaceName(org.apache.pulsar.common.naming.NamespaceName) Method(java.lang.reflect.Method) BeforeMethod(org.testng.annotations.BeforeMethod) Set(java.util.Set) Assert.assertNotNull(org.testng.Assert.assertNotNull) LoadReport(org.apache.pulsar.policies.data.loadbalancer.LoadReport) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) ZkUtils(org.apache.bookkeeper.util.ZkUtils) List(java.util.List) LocalBookkeeperEnsemble(org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble) Optional(java.util.Optional) NamespaceBundleStats(org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats) Awaitility(org.awaitility.Awaitility) Mockito.mock(org.mockito.Mockito.mock) SimpleLoadManagerImpl(org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl) Whitebox(org.powermock.reflect.Whitebox) TopicName(org.apache.pulsar.common.naming.TopicName) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Assert.assertEquals(org.testng.Assert.assertEquals) HashMap(java.util.HashMap) PulsarAdmin(org.apache.pulsar.client.admin.PulsarAdmin) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) ResourceUsage(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage) Lists(com.google.common.collect.Lists) Assert(org.testng.Assert) BundlesData(org.apache.pulsar.common.policies.data.BundlesData) ExecutorService(java.util.concurrent.ExecutorService) ResourceQuota(org.apache.pulsar.common.policies.data.ResourceQuota) Logger(org.slf4j.Logger) AutoFailoverPolicyType(org.apache.pulsar.common.policies.data.AutoFailoverPolicyType) ServiceConfiguration(org.apache.pulsar.broker.ServiceConfiguration) Mockito.times(org.mockito.Mockito.times) Field(java.lang.reflect.Field) PulsarService(org.apache.pulsar.broker.PulsarService) NamespacesImpl(org.apache.pulsar.client.admin.internal.NamespacesImpl) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Policies(org.apache.pulsar.common.policies.data.Policies) Mockito.never(org.mockito.Mockito.never) ZooDefs(org.apache.zookeeper.ZooDefs) ResourceLock(org.apache.pulsar.metadata.api.coordination.ResourceLock) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException) Assert.assertTrue(org.testng.Assert.assertTrue) Collections(java.util.Collections) AutoFailoverPolicyData(org.apache.pulsar.common.policies.data.AutoFailoverPolicyData) NamespaceIsolationData(org.apache.pulsar.common.policies.data.NamespaceIsolationData) NamespaceIsolationPolicies(org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies) HashMap(java.util.HashMap) NamespaceIsolationData(org.apache.pulsar.common.policies.data.NamespaceIsolationData) ArrayList(java.util.ArrayList) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException)

Example 2 with BadVersionException

use of org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException in project pulsar by apache.

the class SimpleLoadManagerImplTest method createNamespacePolicies.

private void createNamespacePolicies(PulsarService pulsar) throws Exception {
    Map<String, String> parameters = new HashMap<>();
    parameters.put("min_limit", "1");
    parameters.put("usage_threshold", "100");
    NamespaceIsolationPolicies policies = new NamespaceIsolationPolicies();
    // set up policy that use this broker as primary
    NamespaceIsolationData policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/primary-ns.*")).primary(Collections.singletonList(pulsar1.getAdvertisedAddress() + "*")).secondary(Collections.singletonList("prod2-broker([78]).messaging.usw.example.co.*")).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("primaryBrokerPolicy", policyData);
    try {
        pulsar.getPulsarResources().getNamespaceResources().getIsolationPolicies().createIsolationData("use", policies.getPolicies());
    } catch (BadVersionException e) {
        // isolation policy already exist
        pulsar.getPulsarResources().getNamespaceResources().getIsolationPolicies().setIsolationData("use", data -> policies.getPolicies());
    }
}
Also used : URL(java.net.URL) ObjectMapperFactory(org.apache.pulsar.common.util.ObjectMapperFactory) Test(org.testng.annotations.Test) AfterMethod(org.testng.annotations.AfterMethod) NamespaceIsolationPolicies(org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies) SystemResourceUsage(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage) PulsarResourceDescription(org.apache.pulsar.broker.loadbalance.impl.PulsarResourceDescription) Map(java.util.Map) NamespaceName(org.apache.pulsar.common.naming.NamespaceName) Assert.assertNotEquals(org.testng.Assert.assertNotEquals) Mockito.atLeastOnce(org.mockito.Mockito.atLeastOnce) BeforeMethod(org.testng.annotations.BeforeMethod) Set(java.util.Set) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) Slf4j(lombok.extern.slf4j.Slf4j) LocalBookkeeperEnsemble(org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble) Optional(java.util.Optional) NamespaceBundleStats(org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats) Mockito.mock(org.mockito.Mockito.mock) SimpleLoadManagerImpl(org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl) SimpleLoadCalculatorImpl(org.apache.pulsar.broker.loadbalance.impl.SimpleLoadCalculatorImpl) Assert.assertNull(org.testng.Assert.assertNull) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Assert.assertEquals(org.testng.Assert.assertEquals) HashMap(java.util.HashMap) PulsarAdmin(org.apache.pulsar.client.admin.PulsarAdmin) Mockito.spy(org.mockito.Mockito.spy) AtomicReference(java.util.concurrent.atomic.AtomicReference) BrokerUsage(org.apache.pulsar.policies.data.loadbalancer.BrokerUsage) HashSet(java.util.HashSet) ResourceUsage(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage) SimpleResourceUnit(org.apache.pulsar.broker.loadbalance.impl.SimpleResourceUnit) PulsarLoadReportImpl(org.apache.pulsar.broker.loadbalance.impl.PulsarLoadReportImpl) NamespaceBundle(org.apache.pulsar.common.naming.NamespaceBundle) ExecutorService(java.util.concurrent.ExecutorService) LinuxBrokerHostUsageImpl(org.apache.pulsar.broker.loadbalance.impl.LinuxBrokerHostUsageImpl) ResourceQuota(org.apache.pulsar.common.policies.data.ResourceQuota) AutoFailoverPolicyType(org.apache.pulsar.common.policies.data.AutoFailoverPolicyType) SystemUtils(org.apache.commons.lang3.SystemUtils) ServiceConfiguration(org.apache.pulsar.broker.ServiceConfiguration) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Mockito.times(org.mockito.Mockito.times) Field(java.lang.reflect.Field) PulsarService(org.apache.pulsar.broker.PulsarService) Maps(com.google.common.collect.Maps) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) JvmUsage(org.apache.pulsar.policies.data.loadbalancer.JvmUsage) BrokerTestUtil.spyWithClassAndConstructorArgs(org.apache.pulsar.broker.BrokerTestUtil.spyWithClassAndConstructorArgs) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException) ResourceUnitRanking(org.apache.pulsar.policies.data.loadbalancer.ResourceUnitRanking) Assert.assertTrue(org.testng.Assert.assertTrue) GenericBrokerHostUsageImpl(org.apache.pulsar.broker.loadbalance.impl.GenericBrokerHostUsageImpl) BrokerStats(org.apache.pulsar.client.admin.BrokerStats) Collections(java.util.Collections) ResourceAvailabilityRanker(org.apache.pulsar.broker.loadbalance.impl.ResourceAvailabilityRanker) AutoFailoverPolicyData(org.apache.pulsar.common.policies.data.AutoFailoverPolicyData) NamespaceIsolationData(org.apache.pulsar.common.policies.data.NamespaceIsolationData) NamespaceIsolationPolicies(org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies) HashMap(java.util.HashMap) NamespaceIsolationData(org.apache.pulsar.common.policies.data.NamespaceIsolationData) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException)

Example 3 with BadVersionException

use of org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException in project pulsar by apache.

the class MetadataCacheImpl method create.

@Override
public CompletableFuture<Void> create(String path, T value) {
    byte[] content;
    try {
        content = serde.serialize(path, value);
    } catch (Throwable t) {
        return FutureUtils.exception(t);
    }
    CompletableFuture<Void> future = new CompletableFuture<>();
    store.put(path, content, Optional.of(-1L)).thenAccept(stat -> {
        // Make sure we have the value cached before the operation is completed
        // In addition to caching the value, we need to add a watch on the path,
        // so when/if it changes on any other node, we are notified and we can
        // update the cache
        objCache.get(path).whenComplete((stat2, ex) -> {
            if (ex == null) {
                future.complete(null);
            } else {
                log.error("Exception while getting path {}", path, ex);
                future.completeExceptionally(ex.getCause());
            }
        });
    }).exceptionally(ex -> {
        if (ex.getCause() instanceof BadVersionException) {
            // Use already exists exception to provide more self-explanatory error message
            future.completeExceptionally(new AlreadyExistsException(ex.getCause()));
        } else {
            future.completeExceptionally(ex.getCause());
        }
        return null;
    });
    return future;
}
Also used : Getter(lombok.Getter) MetadataStore(org.apache.pulsar.metadata.api.MetadataStore) CompletableFuture(java.util.concurrent.CompletableFuture) AbstractMetadataStore(org.apache.pulsar.metadata.impl.AbstractMetadataStore) CacheGetResult(org.apache.pulsar.metadata.api.CacheGetResult) Function(java.util.function.Function) Supplier(java.util.function.Supplier) Notification(org.apache.pulsar.metadata.api.Notification) MetadataCache(org.apache.pulsar.metadata.api.MetadataCache) GetResult(org.apache.pulsar.metadata.api.GetResult) MetadataSerde(org.apache.pulsar.metadata.api.MetadataSerde) JavaType(com.fasterxml.jackson.databind.JavaType) AsyncCacheLoader(com.github.benmanes.caffeine.cache.AsyncCacheLoader) TypeReference(com.fasterxml.jackson.core.type.TypeReference) Caffeine(com.github.benmanes.caffeine.cache.Caffeine) Executor(java.util.concurrent.Executor) AlreadyExistsException(org.apache.pulsar.metadata.api.MetadataStoreException.AlreadyExistsException) IOException(java.io.IOException) FutureUtils(org.apache.bookkeeper.common.concurrent.FutureUtils) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) ContentDeserializationException(org.apache.pulsar.metadata.api.MetadataStoreException.ContentDeserializationException) AsyncLoadingCache(com.github.benmanes.caffeine.cache.AsyncLoadingCache) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) NotFoundException(org.apache.pulsar.metadata.api.MetadataStoreException.NotFoundException) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException) Optional(java.util.Optional) VisibleForTesting(com.google.common.annotations.VisibleForTesting) CompletableFuture(java.util.concurrent.CompletableFuture) AlreadyExistsException(org.apache.pulsar.metadata.api.MetadataStoreException.AlreadyExistsException) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException)

Example 4 with BadVersionException

use of org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException in project pulsar by yahoo.

the class LoadBalancerTest method createNamespacePolicies.

private void createNamespacePolicies(PulsarService pulsar) throws Exception {
    // // prepare three policies for the namespace isolation
    NamespaceIsolationPolicies policies = new NamespaceIsolationPolicies();
    // set up policy that use this broker as primary
    Map<String, String> parameters = new HashMap<>();
    parameters.put("min_limit", "1");
    parameters.put("usage_threshold", "100");
    List<String> allBrokers = new ArrayList<>();
    for (int i = 0; i < BROKER_COUNT; i++) {
        allBrokers.add(pulsarServices[i].getAdvertisedAddress());
    }
    NamespaceIsolationData policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/primary-ns.*")).primary(allBrokers).secondary(Collections.emptyList()).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("primaryBrokerPolicy", policyData);
    List<String> allExceptFirstBroker = new ArrayList<>();
    for (int i = 1; i < BROKER_COUNT; i++) {
        allExceptFirstBroker.add(pulsarServices[i].getAdvertisedAddress());
    }
    // set up policy that use this broker as secondary
    policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/secondary-ns.*")).primary(Collections.singletonList(pulsarServices[0].getWebServiceAddress())).secondary(allExceptFirstBroker).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("secondaryBrokerPolicy", policyData);
    // set up policy that do not use this broker (neither primary nor secondary)
    policyData = NamespaceIsolationData.builder().namespaces(Collections.singletonList("pulsar/use/shared-ns.*")).primary(Collections.singletonList(pulsarServices[0].getWebServiceAddress())).secondary(allExceptFirstBroker).autoFailoverPolicy(AutoFailoverPolicyData.builder().policyType(AutoFailoverPolicyType.min_available).parameters(parameters).build()).build();
    policies.setPolicy("otherBrokerPolicy", policyData);
    try {
        pulsar.getPulsarResources().getNamespaceResources().getIsolationPolicies().createIsolationData("use", policies.getPolicies());
    } catch (BadVersionException e) {
        // isolation policy already exist
        pulsar.getPulsarResources().getNamespaceResources().getIsolationPolicies().setIsolationData("use", data -> policies.getPolicies());
    }
}
Also used : CreateMode(org.apache.zookeeper.CreateMode) URL(java.net.URL) ObjectMapperFactory(org.apache.pulsar.common.util.ObjectMapperFactory) LoggerFactory(org.slf4j.LoggerFactory) Test(org.testng.annotations.Test) AfterMethod(org.testng.annotations.AfterMethod) NamespaceIsolationPolicies(org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies) Future(java.util.concurrent.Future) SystemResourceUsage(org.apache.pulsar.policies.data.loadbalancer.SystemResourceUsage) PulsarResourceDescription(org.apache.pulsar.broker.loadbalance.impl.PulsarResourceDescription) Map(java.util.Map) NamespaceName(org.apache.pulsar.common.naming.NamespaceName) Method(java.lang.reflect.Method) BeforeMethod(org.testng.annotations.BeforeMethod) Set(java.util.Set) Assert.assertNotNull(org.testng.Assert.assertNotNull) LoadReport(org.apache.pulsar.policies.data.loadbalancer.LoadReport) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) ZkUtils(org.apache.bookkeeper.util.ZkUtils) List(java.util.List) LocalBookkeeperEnsemble(org.apache.pulsar.zookeeper.LocalBookkeeperEnsemble) Optional(java.util.Optional) NamespaceBundleStats(org.apache.pulsar.policies.data.loadbalancer.NamespaceBundleStats) Awaitility(org.awaitility.Awaitility) Mockito.mock(org.mockito.Mockito.mock) SimpleLoadManagerImpl(org.apache.pulsar.broker.loadbalance.impl.SimpleLoadManagerImpl) Whitebox(org.powermock.reflect.Whitebox) TopicName(org.apache.pulsar.common.naming.TopicName) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Assert.assertEquals(org.testng.Assert.assertEquals) HashMap(java.util.HashMap) PulsarAdmin(org.apache.pulsar.client.admin.PulsarAdmin) AtomicReference(java.util.concurrent.atomic.AtomicReference) ArrayList(java.util.ArrayList) ResourceUsage(org.apache.pulsar.policies.data.loadbalancer.ResourceUsage) Lists(com.google.common.collect.Lists) Assert(org.testng.Assert) BundlesData(org.apache.pulsar.common.policies.data.BundlesData) ExecutorService(java.util.concurrent.ExecutorService) ResourceQuota(org.apache.pulsar.common.policies.data.ResourceQuota) Logger(org.slf4j.Logger) AutoFailoverPolicyType(org.apache.pulsar.common.policies.data.AutoFailoverPolicyType) ServiceConfiguration(org.apache.pulsar.broker.ServiceConfiguration) Mockito.times(org.mockito.Mockito.times) Field(java.lang.reflect.Field) PulsarService(org.apache.pulsar.broker.PulsarService) NamespacesImpl(org.apache.pulsar.client.admin.internal.NamespacesImpl) Mockito.verify(org.mockito.Mockito.verify) TimeUnit(java.util.concurrent.TimeUnit) Policies(org.apache.pulsar.common.policies.data.Policies) Mockito.never(org.mockito.Mockito.never) ZooDefs(org.apache.zookeeper.ZooDefs) ResourceLock(org.apache.pulsar.metadata.api.coordination.ResourceLock) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException) Assert.assertTrue(org.testng.Assert.assertTrue) Collections(java.util.Collections) AutoFailoverPolicyData(org.apache.pulsar.common.policies.data.AutoFailoverPolicyData) NamespaceIsolationData(org.apache.pulsar.common.policies.data.NamespaceIsolationData) NamespaceIsolationPolicies(org.apache.pulsar.common.policies.impl.NamespaceIsolationPolicies) HashMap(java.util.HashMap) NamespaceIsolationData(org.apache.pulsar.common.policies.data.NamespaceIsolationData) ArrayList(java.util.ArrayList) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException)

Example 5 with BadVersionException

use of org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException in project pulsar by yahoo.

the class NamespacesBase method updatePoliciesAsync.

private CompletableFuture<Void> updatePoliciesAsync(NamespaceName ns, Function<Policies, Policies> updateFunction) {
    CompletableFuture<Void> result = new CompletableFuture<>();
    namespaceResources().setPoliciesAsync(ns, updateFunction).thenAccept(v -> {
        log.info("[{}] Successfully updated the policies on namespace {}", clientAppId(), namespaceName);
        result.complete(null);
    }).exceptionally(ex -> {
        Throwable cause = ex.getCause();
        if (cause instanceof NotFoundException) {
            result.completeExceptionally(new RestException(Status.NOT_FOUND, "Namespace does not exist"));
        } else if (cause instanceof BadVersionException) {
            log.warn("[{}] Failed to update the replication clusters on" + " namespace {} : concurrent modification", clientAppId(), namespaceName);
            result.completeExceptionally(new RestException(Status.CONFLICT, "Concurrent modification"));
        } else {
            log.error("[{}] Failed to update namespace policies {}", clientAppId(), namespaceName, cause);
            result.completeExceptionally(new RestException(cause));
        }
        return null;
    });
    return result;
}
Also used : SortedSet(java.util.SortedSet) Topic(org.apache.pulsar.broker.service.Topic) MutableObject(org.apache.commons.lang.mutable.MutableObject) URL(java.net.URL) AdminResource(org.apache.pulsar.broker.admin.AdminResource) BundleType(org.apache.pulsar.common.policies.data.Policies.BundleType) LoggerFactory(org.slf4j.LoggerFactory) TopicHashPositions(org.apache.pulsar.common.policies.data.TopicHashPositions) LedgerOffloader(org.apache.bookkeeper.mledger.LedgerOffloader) DelayedDeliveryPolicies(org.apache.pulsar.common.policies.data.DelayedDeliveryPolicies) ClusterData(org.apache.pulsar.common.policies.data.ClusterData) StringUtils(org.apache.commons.lang3.StringUtils) NamespaceBundleSplitAlgorithm(org.apache.pulsar.common.naming.NamespaceBundleSplitAlgorithm) SubscribeRate(org.apache.pulsar.common.policies.data.SubscribeRate) NamespaceBundles(org.apache.pulsar.common.naming.NamespaceBundles) PoliciesUtil.defaultBundle(org.apache.pulsar.common.policies.data.PoliciesUtil.defaultBundle) PoliciesUtil.getBundles(org.apache.pulsar.common.policies.data.PoliciesUtil.getBundles) BacklogQuotaType(org.apache.pulsar.common.policies.data.BacklogQuota.BacklogQuotaType) AuthAction(org.apache.pulsar.common.policies.data.AuthAction) PolicyOperation(org.apache.pulsar.common.policies.data.PolicyOperation) Map(java.util.Map) RestException(org.apache.pulsar.broker.web.RestException) NamespaceOperation(org.apache.pulsar.common.policies.data.NamespaceOperation) NamedEntity(org.apache.pulsar.common.naming.NamedEntity) NamespaceName(org.apache.pulsar.common.naming.NamespaceName) DispatchRateImpl(org.apache.pulsar.common.policies.data.impl.DispatchRateImpl) UriBuilder(javax.ws.rs.core.UriBuilder) BookieAffinityGroupData(org.apache.pulsar.common.policies.data.BookieAffinityGroupData) URI(java.net.URI) InactiveTopicPolicies(org.apache.pulsar.common.policies.data.InactiveTopicPolicies) MetadataStoreException(org.apache.pulsar.metadata.api.MetadataStoreException) SchemaCompatibilityStrategy(org.apache.pulsar.common.policies.data.SchemaCompatibilityStrategy) PersistencePolicies(org.apache.pulsar.common.policies.data.PersistencePolicies) AsyncResponse(javax.ws.rs.container.AsyncResponse) OffloadPoliciesImpl(org.apache.pulsar.common.policies.data.OffloadPoliciesImpl) Set(java.util.Set) LocalPolicies(org.apache.pulsar.common.policies.data.LocalPolicies) PublishRate(org.apache.pulsar.common.policies.data.PublishRate) Collectors(java.util.stream.Collectors) Sets(com.google.common.collect.Sets) Objects(java.util.Objects) SubscriptionBusyException(org.apache.pulsar.broker.service.BrokerServiceException.SubscriptionBusyException) NamespaceBundleFactory(org.apache.pulsar.common.naming.NamespaceBundleFactory) List(java.util.List) PersistentTopic(org.apache.pulsar.broker.service.persistent.PersistentTopic) FutureUtil(org.apache.pulsar.common.util.FutureUtil) Response(javax.ws.rs.core.Response) NotFoundException(org.apache.pulsar.metadata.api.MetadataStoreException.NotFoundException) PolicyName(org.apache.pulsar.common.policies.data.PolicyName) Optional(java.util.Optional) WebApplicationException(javax.ws.rs.WebApplicationException) TenantOperation(org.apache.pulsar.common.policies.data.TenantOperation) Subscription(org.apache.pulsar.broker.service.Subscription) TopicName(org.apache.pulsar.common.naming.TopicName) BacklogQuota(org.apache.pulsar.common.policies.data.BacklogQuota) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) TreeSet(java.util.TreeSet) HashSet(java.util.HashSet) TopicType(org.apache.pulsar.common.policies.data.TopicType) Lists(com.google.common.collect.Lists) AutoTopicCreationOverride(org.apache.pulsar.common.policies.data.AutoTopicCreationOverride) AutoTopicCreationOverrideImpl(org.apache.pulsar.common.policies.data.impl.AutoTopicCreationOverrideImpl) BundlesData(org.apache.pulsar.common.policies.data.BundlesData) NamespaceBundle(org.apache.pulsar.common.naming.NamespaceBundle) TopicDomain(org.apache.pulsar.common.naming.TopicDomain) Status(javax.ws.rs.core.Response.Status) DispatchRate(org.apache.pulsar.common.policies.data.DispatchRate) RetentionPolicies(org.apache.pulsar.common.policies.data.RetentionPolicies) PersistentReplicator(org.apache.pulsar.broker.service.persistent.PersistentReplicator) Logger(org.slf4j.Logger) PulsarAdminException(org.apache.pulsar.client.admin.PulsarAdminException) AutoSubscriptionCreationOverride(org.apache.pulsar.common.policies.data.AutoSubscriptionCreationOverride) Field(java.lang.reflect.Field) SubscriptionType(org.apache.pulsar.client.api.SubscriptionType) ExecutionException(java.util.concurrent.ExecutionException) TimeUnit(java.util.concurrent.TimeUnit) Policies(org.apache.pulsar.common.policies.data.Policies) StringUtils.isBlank(org.apache.commons.lang3.StringUtils.isBlank) PulsarServerException(org.apache.pulsar.broker.PulsarServerException) SchemaAutoUpdateCompatibilityStrategy(org.apache.pulsar.common.policies.data.SchemaAutoUpdateCompatibilityStrategy) SubscriptionAuthMode(org.apache.pulsar.common.policies.data.SubscriptionAuthMode) ValidateResult(org.apache.pulsar.common.policies.data.ValidateResult) Codec(org.apache.pulsar.common.util.Codec) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException) AuthorizationService(org.apache.pulsar.broker.authorization.AuthorizationService) Collections(java.util.Collections) CompletableFuture(java.util.concurrent.CompletableFuture) RestException(org.apache.pulsar.broker.web.RestException) NotFoundException(org.apache.pulsar.metadata.api.MetadataStoreException.NotFoundException) BadVersionException(org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException)

Aggregations

BadVersionException (org.apache.pulsar.metadata.api.MetadataStoreException.BadVersionException)25 CompletableFuture (java.util.concurrent.CompletableFuture)17 Optional (java.util.Optional)15 TimeUnit (java.util.concurrent.TimeUnit)12 MetadataStoreException (org.apache.pulsar.metadata.api.MetadataStoreException)10 Field (java.lang.reflect.Field)9 URL (java.net.URL)9 Collections (java.util.Collections)9 HashMap (java.util.HashMap)9 List (java.util.List)9 Map (java.util.Map)9 Set (java.util.Set)9 AtomicReference (java.util.concurrent.atomic.AtomicReference)9 Slf4j (lombok.extern.slf4j.Slf4j)9 NamespaceName (org.apache.pulsar.common.naming.NamespaceName)9 Lists (com.google.common.collect.Lists)6 ExecutorService (java.util.concurrent.ExecutorService)6 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)6 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)6 PulsarService (org.apache.pulsar.broker.PulsarService)6