Search in sources :

Example 1 with ReaderGroupNotFoundException

use of io.pravega.client.stream.ReaderGroupNotFoundException in project pravega by pravega.

the class ControllerImpl method getReaderGroupConfig.

@Override
public CompletableFuture<ReaderGroupConfig> getReaderGroupConfig(final String scope, final String rgName) {
    Exceptions.checkNotClosed(closed.get(), this);
    Exceptions.checkNotNullOrEmpty(scope, "scope");
    final String emptyUUID = "";
    final long requestId = requestIdGenerator.get();
    long traceId = LoggerHelpers.traceEnter(log, "getReaderGroupConfig", scope, rgName, requestId);
    final String scopedRGName = NameUtils.getScopedReaderGroupName(scope, rgName);
    final CompletableFuture<ReaderGroupConfigResponse> result = this.retryConfig.runAsync(() -> {
        RPCAsyncCallback<ReaderGroupConfigResponse> callback = new RPCAsyncCallback<>(requestId, "getReaderGroupConfig", scope, rgName);
        new ControllerClientTagger(client, timeoutMillis).withTag(requestId, GET_READER_GROUP_CONFIG, scope, rgName).getReaderGroupConfig(ModelHelper.createReaderGroupInfo(scope, rgName, emptyUUID, 0L), callback);
        return callback.getFuture();
    }, this.executor);
    return result.thenApplyAsync(x -> {
        switch(x.getStatus()) {
            case FAILURE:
                log.warn(requestId, "Failed to get config for reader group: {}", scopedRGName);
                throw new ControllerFailureException("Failed to get config for reader group: " + scopedRGName);
            case RG_NOT_FOUND:
                log.warn(requestId, "ReaderGroup not found: {}", scopedRGName);
                throw new ReaderGroupNotFoundException(scopedRGName);
            case SUCCESS:
                log.info(requestId, "Successfully got config for Reader Group: {}", scopedRGName);
                return encode(x.getConfig());
            case UNRECOGNIZED:
            default:
                throw new ControllerFailureException("Unknown return status getting config for ReaderGroup " + scopedRGName + " " + x.getStatus());
        }
    }, this.executor).whenComplete((x, e) -> {
        if (e != null) {
            log.warn(requestId, "getReaderGroupConfig failed for Reader Group: {}", scopedRGName, e);
        }
        LoggerHelpers.traceLeave(log, "getReaderGroupConfig", traceId, scope, rgName, requestId);
    });
}
Also used : StreamCut(io.pravega.client.stream.StreamCut) StreamConfig(io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig) NegotiationType(io.grpc.netty.shaded.io.grpc.netty.NegotiationType) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) PingTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest) DELETE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_STREAM) SegmentRanges(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRanges) StreamSegments(io.pravega.client.stream.impl.StreamSegments) NoSuchScopeException(io.pravega.client.stream.NoSuchScopeException) TRUNCATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.TRUNCATE_STREAM) AccessOperation(io.pravega.shared.security.auth.AccessOperation) Map(java.util.Map) SubscriberStreamCut(io.pravega.controller.stream.api.grpc.v1.Controller.SubscriberStreamCut) LIST_SCOPES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SCOPES) UPDATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_READER_GROUP) UPDATE_TRUNCATION_STREAM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_TRUNCATION_STREAM_CUT) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) DeleteScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteScopeStatus) GET_SEGMENTS_IMMEDIATELY_FOLLOWING(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_IMMEDIATELY_FOLLOWING) ReaderGroupInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupInfo) REMOVE_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.REMOVE_WRITER) GET_SEGMENTS_BETWEEN_STREAM_CUTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_BETWEEN_STREAM_CUTS) LIST_STREAMS_IN_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE) SslContextBuilder(io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder) RequestTracker(io.pravega.common.tracing.RequestTracker) ScopesResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesResponse) SSLException(javax.net.ssl.SSLException) KVTablesInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeRequest) GET_STREAM_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_STREAM_CONFIGURATION) Futures(io.pravega.common.concurrent.Futures) KeyValueTableSegments(io.pravega.client.tables.impl.KeyValueTableSegments) SegmentId(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentId) StreamCutRangeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamCutRangeResponse) CreateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateReaderGroupResponse) LIST_KEY_VALUE_TABLES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_KEY_VALUE_TABLES) KeyValueTableConfig(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfig) GrpcSslContexts(io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts) Exceptions(io.pravega.common.Exceptions) ScopeInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ScopeInfo) StreamsInScopeWithTagRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeWithTagRequest) ModelHelper.encode(io.pravega.client.control.impl.ModelHelper.encode) GET_KEY_VALUE_TABLE_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_KEY_VALUE_TABLE_CONFIGURATION) Supplier(java.util.function.Supplier) UpdateSubscriberStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateSubscriberStatus) PingFailedException(io.pravega.client.stream.PingFailedException) Strings(com.google.common.base.Strings) Code(io.grpc.Status.Code) NodeUri(io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri) ReaderGroupConfiguration(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfiguration) StreamInfo(io.pravega.controller.stream.api.grpc.v1.Controller.StreamInfo) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) GET_SUCCESSORS_FROM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SUCCESSORS_FROM_CUT) ControllerServiceGrpc(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc) START_SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.START_SCALE_STREAM) StreamSegmentsWithPredecessors(io.pravega.client.stream.impl.StreamSegmentsWithPredecessors) ExistsResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ExistsResponse) RemoveWriterResponse(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterResponse) Callbacks(io.pravega.common.function.Callbacks) AsyncIterator(io.pravega.common.util.AsyncIterator) SegmentRange(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRange) WriterPosition(io.pravega.client.stream.impl.WriterPosition) File(java.io.File) StatusRuntimeException(io.grpc.StatusRuntimeException) CREATE_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_TRANSACTION) RPCTracingHelpers(io.pravega.shared.controller.tracing.RPCTracingHelpers) LIST_STREAMS_IN_SCOPE_FOR_TAG(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE_FOR_TAG) TreeMap(java.util.TreeMap) TxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.TxnStatus) Preconditions(com.google.common.base.Preconditions) DeleteReaderGroupStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteReaderGroupStatus) SegmentsAtTime(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentsAtTime) TxnFailedException(io.pravega.client.stream.TxnFailedException) CreateKeyValueTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateKeyValueTableStatus) GET_CURRENT_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS) CHECK_TRANSACTION_STATE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_TRANSACTION_STATE) CREATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_STREAM) ManagedChannel(io.grpc.ManagedChannel) Retry(io.pravega.common.util.Retry) LoggerFactory(org.slf4j.LoggerFactory) KeyValueTableConfiguration(io.pravega.client.tables.KeyValueTableConfiguration) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) StreamsInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeResponse) ContinuationToken(io.pravega.controller.stream.api.grpc.v1.Controller.ContinuationToken) GetSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetSegmentsRequest) StreamObserver(io.grpc.stub.StreamObserver) TagLogger(io.pravega.common.tracing.TagLogger) ControllerServiceStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceStub) CREATE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_KEY_VALUE_TABLE) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) Stream(io.pravega.client.stream.Stream) KVTablesInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeResponse) PravegaNodeUri(io.pravega.shared.protocol.netty.PravegaNodeUri) SubscribersResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SubscribersResponse) Transaction(io.pravega.client.stream.Transaction) DELETE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_KEY_VALUE_TABLE) TxnSegments(io.pravega.client.stream.impl.TxnSegments) RetryAndThrowConditionally(io.pravega.common.util.Retry.RetryAndThrowConditionally) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CHECK_SCOPE_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCOPE_EXISTS) LIST_SUBSCRIBERS(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SUBSCRIBERS) CHECK_STREAM_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_STREAM_EXISTS) CREATE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_SCOPE) Collection(java.util.Collection) DelegationToken(io.pravega.controller.stream.api.grpc.v1.Controller.DelegationToken) CompletionException(java.util.concurrent.CompletionException) UUID(java.util.UUID) COMMIT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.COMMIT_TRANSACTION) NavigableMap(java.util.NavigableMap) Collectors(java.util.stream.Collectors) GET_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS) GET_EPOCH_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_EPOCH_SEGMENTS) SEAL_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SEAL_STREAM) SegmentWithRange(io.pravega.client.stream.impl.SegmentWithRange) List(java.util.List) ABORT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.ABORT_TRANSACTION) CreateTxnResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse) GET_URI(io.pravega.shared.controller.tracing.RPCTracingTags.GET_URI) GetEpochSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetEpochSegmentsRequest) DELETE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_READER_GROUP) TimestampFromWriter(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampFromWriter) DELETE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE) PING_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.PING_TRANSACTION) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) DELETE_SCOPE_RECURSIVE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE_RECURSIVE) Segment(io.pravega.client.segment.impl.Segment) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamImpl(io.pravega.client.stream.impl.StreamImpl) ScaleStatusRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusRequest) KeyValueTableConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfigResponse) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IS_SEGMENT_OPEN(io.pravega.shared.controller.tracing.RPCTracingTags.IS_SEGMENT_OPEN) ScaleStatusResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusResponse) TxnState(io.pravega.controller.stream.api.grpc.v1.Controller.TxnState) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) SuccessorResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse) GET_OR_REFRESH_DELEGATION_TOKEN_FOR(io.pravega.shared.controller.tracing.RPCTracingTags.GET_OR_REFRESH_DELEGATION_TOKEN_FOR) ScaleRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest) DeleteKVTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteKVTableStatus) CreateTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnRequest) GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE) ScopesRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesRequest) DeleteStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteStreamStatus) NOTE_TIMESTAMP_FROM_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.NOTE_TIMESTAMP_FROM_WRITER) CHECK_SCALE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCALE) NettyChannelBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder) UPDATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_STREAM) CREATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_READER_GROUP) ScaleResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse) SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SCALE_STREAM) LoggerHelpers(io.pravega.common.LoggerHelpers) UpdateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateReaderGroupResponse) NameUtils(io.pravega.shared.NameUtils) TimestampResponse(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampResponse) StreamsInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeRequest) RemoveWriterRequest(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterRequest) GET_READER_GROUP_CONFIG(io.pravega.shared.controller.tracing.RPCTracingTags.GET_READER_GROUP_CONFIG) StreamSegmentSuccessors(io.pravega.client.stream.impl.StreamSegmentSuccessors) TimeUnit(java.util.concurrent.TimeUnit) ManagedChannelBuilder(io.grpc.ManagedChannelBuilder) AbstractMap(java.util.AbstractMap) UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) ContinuationTokenAsyncIterator(io.pravega.common.util.ContinuationTokenAsyncIterator) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) Credentials(io.pravega.shared.security.auth.Credentials) VisibleForTesting(com.google.common.annotations.VisibleForTesting) RandomFactory(io.pravega.common.hash.RandomFactory) TxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest) ReaderGroupConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfigResponse) SegmentValidityResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentValidityResponse) Collections(java.util.Collections) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) ReaderGroupConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfigResponse)

Example 2 with ReaderGroupNotFoundException

use of io.pravega.client.stream.ReaderGroupNotFoundException in project pravega by pravega.

the class StreamManagerImpl method deleteScope.

/**
 * A new API is created hence this is going to be deprecated.
 *
 * @deprecated As of Pravega release 0.11.0, replaced by {@link #deleteScopeRecursive(String)}.
 */
@Override
@Deprecated
public boolean deleteScope(String scopeName, boolean forceDelete) throws DeleteScopeFailedException {
    NameUtils.validateUserScopeName(scopeName);
    if (forceDelete) {
        log.info("Deleting scope recursively: {}", scopeName);
        List<String> readerGroupList = new ArrayList<>();
        Iterator<Stream> iterator = listStreams(scopeName);
        while (iterator.hasNext()) {
            Stream stream = iterator.next();
            if (stream.getStreamName().startsWith(READER_GROUP_STREAM_PREFIX)) {
                readerGroupList.add(stream.getStreamName().substring(READER_GROUP_STREAM_PREFIX.length()));
            }
            try {
                Futures.getThrowingException(Futures.exceptionallyExpecting(controller.sealStream(stream.getScope(), stream.getStreamName()), e -> {
                    Throwable unwrap = Exceptions.unwrap(e);
                    // ignore failures if the stream doesn't exist or we are unable to seal it.
                    return unwrap instanceof InvalidStreamException || unwrap instanceof ControllerFailureException;
                }, false).thenCompose(sealed -> controller.deleteStream(stream.getScope(), stream.getStreamName())));
            } catch (Exception e) {
                String message = String.format("Failed to seal and delete stream %s", stream.getStreamName());
                throw new DeleteScopeFailedException(message, e);
            }
        }
        Iterator<KeyValueTableInfo> kvtIterator = controller.listKeyValueTables(scopeName).asIterator();
        while (kvtIterator.hasNext()) {
            KeyValueTableInfo kvt = kvtIterator.next();
            try {
                Futures.getThrowingException(controller.deleteKeyValueTable(scopeName, kvt.getKeyValueTableName()));
            } catch (Exception e) {
                String message = String.format("Failed to delete key-value table %s", kvt.getKeyValueTableName());
                throw new DeleteScopeFailedException(message, e);
            }
        }
        for (String groupName : readerGroupList) {
            try {
                Futures.getThrowingException(controller.getReaderGroupConfig(scopeName, groupName).thenCompose(conf -> controller.deleteReaderGroup(scopeName, groupName, conf.getReaderGroupId())));
            } catch (Exception e) {
                if (Exceptions.unwrap(e) instanceof ReaderGroupNotFoundException) {
                    continue;
                }
                String message = String.format("Failed to delete reader group %s", groupName);
                throw new DeleteScopeFailedException(message, e);
            }
        }
    }
    return Futures.getThrowingException(controller.deleteScope(scopeName));
}
Also used : StreamCut(io.pravega.client.stream.StreamCut) Getter(lombok.Getter) StreamManager(io.pravega.client.admin.StreamManager) Exceptions(io.pravega.common.Exceptions) DeleteScopeFailedException(io.pravega.client.stream.DeleteScopeFailedException) CompletableFuture(java.util.concurrent.CompletableFuture) ConnectionPoolImpl(io.pravega.client.connection.impl.ConnectionPoolImpl) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) ArrayList(java.util.ArrayList) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) AccessLevel(lombok.AccessLevel) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) Stream(io.pravega.client.stream.Stream) StreamCutImpl(io.pravega.client.stream.impl.StreamCutImpl) ControllerFailureException(io.pravega.client.control.impl.ControllerFailureException) SocketConnectionFactoryImpl(io.pravega.client.connection.impl.SocketConnectionFactoryImpl) NameUtils(io.pravega.shared.NameUtils) Callbacks(io.pravega.common.function.Callbacks) Iterator(java.util.Iterator) ConnectionPool(io.pravega.client.connection.impl.ConnectionPool) Collection(java.util.Collection) AsyncIterator(io.pravega.common.util.AsyncIterator) StreamInfo(io.pravega.client.admin.StreamInfo) READER_GROUP_STREAM_PREFIX(io.pravega.shared.NameUtils.READER_GROUP_STREAM_PREFIX) ControllerImplConfig(io.pravega.client.control.impl.ControllerImplConfig) Slf4j(lombok.extern.slf4j.Slf4j) List(java.util.List) ControllerImpl(io.pravega.client.control.impl.ControllerImpl) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) Preconditions(com.google.common.base.Preconditions) VisibleForTesting(com.google.common.annotations.VisibleForTesting) Controller(io.pravega.client.control.impl.Controller) Futures(io.pravega.common.concurrent.Futures) ClientConfig(io.pravega.client.ClientConfig) ArrayList(java.util.ArrayList) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) DeleteScopeFailedException(io.pravega.client.stream.DeleteScopeFailedException) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) ControllerFailureException(io.pravega.client.control.impl.ControllerFailureException) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) ControllerFailureException(io.pravega.client.control.impl.ControllerFailureException) Stream(io.pravega.client.stream.Stream) DeleteScopeFailedException(io.pravega.client.stream.DeleteScopeFailedException)

Example 3 with ReaderGroupNotFoundException

use of io.pravega.client.stream.ReaderGroupNotFoundException in project pravega by pravega.

the class ReaderGroupManagerImplTest method testDeleteRGMigrationNoConfigOnController.

@Test
@SuppressWarnings("unchecked")
public void testDeleteRGMigrationNoConfigOnController() {
    ReaderGroupConfig config = ReaderGroupConfig.builder().startFromStreamCuts(ImmutableMap.<Stream, StreamCut>builder().put(createStream("s1"), createStreamCut("s1", 2)).put(createStream("s2"), createStreamCut("s2", 3)).build()).retentionType(ReaderGroupConfig.StreamDataRetention.MANUAL_RELEASE_AT_USER_STREAMCUT).build();
    when(clientFactory.createStateSynchronizer(anyString(), any(Serializer.class), any(Serializer.class), any(SynchronizerConfig.class))).thenReturn(synchronizer);
    when(synchronizer.getState()).thenReturn(state);
    when(state.getConfig()).thenReturn(config);
    ReaderGroupConfig expectedConfig = ReaderGroupConfig.cloneConfig(config, UUID.randomUUID(), 0L);
    when(controller.getReaderGroupConfig(SCOPE, GROUP_NAME)).thenThrow(new ReaderGroupNotFoundException(NameUtils.getScopedReaderGroupName(SCOPE, GROUP_NAME)));
    when(controller.sealStream(SCOPE, NameUtils.getStreamForReaderGroup(GROUP_NAME))).thenReturn(CompletableFuture.completedFuture(true));
    when(controller.deleteStream(SCOPE, NameUtils.getStreamForReaderGroup(GROUP_NAME))).thenReturn(CompletableFuture.completedFuture(true));
    // Delete ReaderGroup
    readerGroupManager.deleteReaderGroup(GROUP_NAME);
    verify(controller, times(1)).getReaderGroupConfig(SCOPE, GROUP_NAME);
    verify(controller, times(1)).deleteStream(SCOPE, NameUtils.getStreamForReaderGroup(GROUP_NAME));
    verify(controller, times(0)).deleteReaderGroup(SCOPE, GROUP_NAME, expectedConfig.getReaderGroupId());
}
Also used : ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) StreamCut(io.pravega.client.stream.StreamCut) IntStream(java.util.stream.IntStream) Stream(io.pravega.client.stream.Stream) SynchronizerConfig(io.pravega.client.state.SynchronizerConfig) Serializer(io.pravega.client.stream.Serializer) Test(org.junit.Test)

Example 4 with ReaderGroupNotFoundException

use of io.pravega.client.stream.ReaderGroupNotFoundException in project pravega by pravega.

the class ControllerImpl method deleteReaderGroup.

@Override
public CompletableFuture<Boolean> deleteReaderGroup(final String scope, final String rgName, final UUID readerGroupId) {
    Exceptions.checkNotClosed(closed.get(), this);
    Exceptions.checkNotNullOrEmpty(scope, "scope");
    Exceptions.checkNotNullOrEmpty(rgName, "rgName");
    Preconditions.checkNotNull(readerGroupId, "rgId");
    final long requestId = requestIdGenerator.get();
    long traceId = LoggerHelpers.traceEnter(log, "deleteReaderGroup", scope, rgName, requestId);
    final String scopedRGName = NameUtils.getScopedReaderGroupName(scope, rgName);
    final CompletableFuture<DeleteReaderGroupStatus> result = this.retryConfig.runAsync(() -> {
        RPCAsyncCallback<DeleteReaderGroupStatus> callback = new RPCAsyncCallback<>(requestId, "deleteReaderGroup", scope, rgName);
        new ControllerClientTagger(client, timeoutMillis).withTag(requestId, DELETE_READER_GROUP, scope, rgName).deleteReaderGroup(ModelHelper.createReaderGroupInfo(scope, rgName, readerGroupId.toString(), 0L), callback);
        return callback.getFuture();
    }, this.executor);
    return result.thenApplyAsync(x -> {
        switch(x.getStatus()) {
            case FAILURE:
                log.warn(requestId, "Failed to delete reader group: {}", scopedRGName);
                throw new ControllerFailureException("Failed to delete reader group: " + scopedRGName);
            case RG_NOT_FOUND:
                log.warn(requestId, "ReaderGroup not found: {}", scopedRGName);
                throw new ReaderGroupNotFoundException(scopedRGName);
            case SUCCESS:
                log.info(requestId, "Successfully deleted Reader Group: {}", scopedRGName);
                return true;
            case UNRECOGNIZED:
            default:
                throw new ControllerFailureException("Unknown return status getting config for ReaderGroup " + scopedRGName + " " + x.getStatus());
        }
    }, this.executor).whenComplete((x, e) -> {
        if (e != null) {
            log.warn(requestId, "deleteReaderGroup failed for Reader Group: {}", scopedRGName, e);
        }
        LoggerHelpers.traceLeave(log, "deleteReaderGroup", traceId, scope, rgName, requestId);
    });
}
Also used : StreamCut(io.pravega.client.stream.StreamCut) StreamConfig(io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig) NegotiationType(io.grpc.netty.shaded.io.grpc.netty.NegotiationType) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) PingTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest) DELETE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_STREAM) SegmentRanges(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRanges) StreamSegments(io.pravega.client.stream.impl.StreamSegments) NoSuchScopeException(io.pravega.client.stream.NoSuchScopeException) TRUNCATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.TRUNCATE_STREAM) AccessOperation(io.pravega.shared.security.auth.AccessOperation) Map(java.util.Map) SubscriberStreamCut(io.pravega.controller.stream.api.grpc.v1.Controller.SubscriberStreamCut) LIST_SCOPES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SCOPES) UPDATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_READER_GROUP) UPDATE_TRUNCATION_STREAM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_TRUNCATION_STREAM_CUT) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) DeleteScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteScopeStatus) GET_SEGMENTS_IMMEDIATELY_FOLLOWING(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_IMMEDIATELY_FOLLOWING) ReaderGroupInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupInfo) REMOVE_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.REMOVE_WRITER) GET_SEGMENTS_BETWEEN_STREAM_CUTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_BETWEEN_STREAM_CUTS) LIST_STREAMS_IN_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE) SslContextBuilder(io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder) RequestTracker(io.pravega.common.tracing.RequestTracker) ScopesResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesResponse) SSLException(javax.net.ssl.SSLException) KVTablesInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeRequest) GET_STREAM_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_STREAM_CONFIGURATION) Futures(io.pravega.common.concurrent.Futures) KeyValueTableSegments(io.pravega.client.tables.impl.KeyValueTableSegments) SegmentId(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentId) StreamCutRangeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamCutRangeResponse) CreateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateReaderGroupResponse) LIST_KEY_VALUE_TABLES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_KEY_VALUE_TABLES) KeyValueTableConfig(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfig) GrpcSslContexts(io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts) Exceptions(io.pravega.common.Exceptions) ScopeInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ScopeInfo) StreamsInScopeWithTagRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeWithTagRequest) ModelHelper.encode(io.pravega.client.control.impl.ModelHelper.encode) GET_KEY_VALUE_TABLE_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_KEY_VALUE_TABLE_CONFIGURATION) Supplier(java.util.function.Supplier) UpdateSubscriberStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateSubscriberStatus) PingFailedException(io.pravega.client.stream.PingFailedException) Strings(com.google.common.base.Strings) Code(io.grpc.Status.Code) NodeUri(io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri) ReaderGroupConfiguration(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfiguration) StreamInfo(io.pravega.controller.stream.api.grpc.v1.Controller.StreamInfo) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) GET_SUCCESSORS_FROM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SUCCESSORS_FROM_CUT) ControllerServiceGrpc(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc) START_SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.START_SCALE_STREAM) StreamSegmentsWithPredecessors(io.pravega.client.stream.impl.StreamSegmentsWithPredecessors) ExistsResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ExistsResponse) RemoveWriterResponse(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterResponse) Callbacks(io.pravega.common.function.Callbacks) AsyncIterator(io.pravega.common.util.AsyncIterator) SegmentRange(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRange) WriterPosition(io.pravega.client.stream.impl.WriterPosition) File(java.io.File) StatusRuntimeException(io.grpc.StatusRuntimeException) CREATE_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_TRANSACTION) RPCTracingHelpers(io.pravega.shared.controller.tracing.RPCTracingHelpers) LIST_STREAMS_IN_SCOPE_FOR_TAG(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE_FOR_TAG) TreeMap(java.util.TreeMap) TxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.TxnStatus) Preconditions(com.google.common.base.Preconditions) DeleteReaderGroupStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteReaderGroupStatus) SegmentsAtTime(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentsAtTime) TxnFailedException(io.pravega.client.stream.TxnFailedException) CreateKeyValueTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateKeyValueTableStatus) GET_CURRENT_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS) CHECK_TRANSACTION_STATE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_TRANSACTION_STATE) CREATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_STREAM) ManagedChannel(io.grpc.ManagedChannel) Retry(io.pravega.common.util.Retry) LoggerFactory(org.slf4j.LoggerFactory) KeyValueTableConfiguration(io.pravega.client.tables.KeyValueTableConfiguration) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) StreamsInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeResponse) ContinuationToken(io.pravega.controller.stream.api.grpc.v1.Controller.ContinuationToken) GetSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetSegmentsRequest) StreamObserver(io.grpc.stub.StreamObserver) TagLogger(io.pravega.common.tracing.TagLogger) ControllerServiceStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceStub) CREATE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_KEY_VALUE_TABLE) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) Stream(io.pravega.client.stream.Stream) KVTablesInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeResponse) PravegaNodeUri(io.pravega.shared.protocol.netty.PravegaNodeUri) SubscribersResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SubscribersResponse) Transaction(io.pravega.client.stream.Transaction) DELETE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_KEY_VALUE_TABLE) TxnSegments(io.pravega.client.stream.impl.TxnSegments) RetryAndThrowConditionally(io.pravega.common.util.Retry.RetryAndThrowConditionally) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CHECK_SCOPE_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCOPE_EXISTS) LIST_SUBSCRIBERS(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SUBSCRIBERS) CHECK_STREAM_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_STREAM_EXISTS) CREATE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_SCOPE) Collection(java.util.Collection) DelegationToken(io.pravega.controller.stream.api.grpc.v1.Controller.DelegationToken) CompletionException(java.util.concurrent.CompletionException) UUID(java.util.UUID) COMMIT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.COMMIT_TRANSACTION) NavigableMap(java.util.NavigableMap) Collectors(java.util.stream.Collectors) GET_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS) GET_EPOCH_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_EPOCH_SEGMENTS) SEAL_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SEAL_STREAM) SegmentWithRange(io.pravega.client.stream.impl.SegmentWithRange) List(java.util.List) ABORT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.ABORT_TRANSACTION) CreateTxnResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse) GET_URI(io.pravega.shared.controller.tracing.RPCTracingTags.GET_URI) GetEpochSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetEpochSegmentsRequest) DELETE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_READER_GROUP) TimestampFromWriter(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampFromWriter) DELETE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE) PING_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.PING_TRANSACTION) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) DELETE_SCOPE_RECURSIVE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE_RECURSIVE) Segment(io.pravega.client.segment.impl.Segment) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamImpl(io.pravega.client.stream.impl.StreamImpl) ScaleStatusRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusRequest) KeyValueTableConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfigResponse) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IS_SEGMENT_OPEN(io.pravega.shared.controller.tracing.RPCTracingTags.IS_SEGMENT_OPEN) ScaleStatusResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusResponse) TxnState(io.pravega.controller.stream.api.grpc.v1.Controller.TxnState) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) SuccessorResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse) GET_OR_REFRESH_DELEGATION_TOKEN_FOR(io.pravega.shared.controller.tracing.RPCTracingTags.GET_OR_REFRESH_DELEGATION_TOKEN_FOR) ScaleRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest) DeleteKVTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteKVTableStatus) CreateTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnRequest) GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE) ScopesRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesRequest) DeleteStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteStreamStatus) NOTE_TIMESTAMP_FROM_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.NOTE_TIMESTAMP_FROM_WRITER) CHECK_SCALE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCALE) NettyChannelBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder) UPDATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_STREAM) CREATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_READER_GROUP) ScaleResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse) SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SCALE_STREAM) LoggerHelpers(io.pravega.common.LoggerHelpers) UpdateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateReaderGroupResponse) NameUtils(io.pravega.shared.NameUtils) TimestampResponse(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampResponse) StreamsInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeRequest) RemoveWriterRequest(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterRequest) GET_READER_GROUP_CONFIG(io.pravega.shared.controller.tracing.RPCTracingTags.GET_READER_GROUP_CONFIG) StreamSegmentSuccessors(io.pravega.client.stream.impl.StreamSegmentSuccessors) TimeUnit(java.util.concurrent.TimeUnit) ManagedChannelBuilder(io.grpc.ManagedChannelBuilder) AbstractMap(java.util.AbstractMap) UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) ContinuationTokenAsyncIterator(io.pravega.common.util.ContinuationTokenAsyncIterator) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) Credentials(io.pravega.shared.security.auth.Credentials) VisibleForTesting(com.google.common.annotations.VisibleForTesting) RandomFactory(io.pravega.common.hash.RandomFactory) TxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest) ReaderGroupConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfigResponse) SegmentValidityResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentValidityResponse) Collections(java.util.Collections) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) DeleteReaderGroupStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteReaderGroupStatus)

Example 5 with ReaderGroupNotFoundException

use of io.pravega.client.stream.ReaderGroupNotFoundException in project pravega by pravega.

the class ControllerImpl method updateReaderGroup.

@Override
public CompletableFuture<Long> updateReaderGroup(String scope, String rgName, final ReaderGroupConfig rgConfig) {
    Exceptions.checkNotClosed(closed.get(), this);
    Exceptions.checkNotNullOrEmpty(scope, "scope");
    Exceptions.checkNotNullOrEmpty(rgName, "rgName");
    Preconditions.checkNotNull(rgConfig, "rgConfig");
    final long requestId = requestIdGenerator.get();
    long traceId = LoggerHelpers.traceEnter(log, "updateReaderGroup", rgConfig, requestId);
    final CompletableFuture<UpdateReaderGroupResponse> result = this.retryConfig.runAsync(() -> {
        RPCAsyncCallback<UpdateReaderGroupResponse> callback = new RPCAsyncCallback<>(requestId, "updateReaderGroup", scope, rgName, rgConfig);
        new ControllerClientTagger(client, timeoutMillis).withTag(requestId, UPDATE_READER_GROUP, scope, rgName).updateReaderGroup(ModelHelper.decode(scope, rgName, rgConfig), callback);
        return callback.getFuture();
    }, this.executor);
    return result.thenApplyAsync(x -> {
        final String rgScopedName = NameUtils.getScopedReaderGroupName(scope, rgName);
        switch(x.getStatus()) {
            case FAILURE:
                log.warn(requestId, "Failed to update Reader Group: {}", rgScopedName);
                throw new ControllerFailureException("Failed to update Reader Group: " + rgScopedName);
            case INVALID_CONFIG:
                log.warn(requestId, "Failed to update Reader Group {} as Config was invalid: {}", rgScopedName, rgConfig);
                throw new ReaderGroupConfigRejectedException("Invalid Reader Group Config: " + rgConfig.toString());
            case RG_NOT_FOUND:
                log.warn(requestId, "Failed to update Reader Group {} as Reader Group was not found.", rgScopedName);
                throw new ReaderGroupNotFoundException(rgScopedName);
            case SUCCESS:
                log.info(requestId, "Reader Group updated successfully: {}", rgScopedName);
                return x.getGeneration();
            case UNRECOGNIZED:
            default:
                throw new ControllerFailureException("Unknown return status updating reader group " + rgScopedName + " " + x.getStatus());
        }
    }, this.executor).whenComplete((x, e) -> {
        if (e != null) {
            log.warn(requestId, "updateReaderGroup {}/{} failed: ", scope, rgName, e);
        }
        LoggerHelpers.traceLeave(log, "updateReaderGroup", traceId, rgConfig, requestId);
    });
}
Also used : StreamCut(io.pravega.client.stream.StreamCut) StreamConfig(io.pravega.controller.stream.api.grpc.v1.Controller.StreamConfig) NegotiationType(io.grpc.netty.shaded.io.grpc.netty.NegotiationType) MoreCallCredentials(io.grpc.auth.MoreCallCredentials) StreamConfiguration(io.pravega.client.stream.StreamConfiguration) PingTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnRequest) DELETE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_STREAM) SegmentRanges(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRanges) StreamSegments(io.pravega.client.stream.impl.StreamSegments) NoSuchScopeException(io.pravega.client.stream.NoSuchScopeException) TRUNCATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.TRUNCATE_STREAM) AccessOperation(io.pravega.shared.security.auth.AccessOperation) Map(java.util.Map) SubscriberStreamCut(io.pravega.controller.stream.api.grpc.v1.Controller.SubscriberStreamCut) LIST_SCOPES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SCOPES) UPDATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_READER_GROUP) UPDATE_TRUNCATION_STREAM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_TRUNCATION_STREAM_CUT) ReaderGroupConfig(io.pravega.client.stream.ReaderGroupConfig) DeleteScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteScopeStatus) GET_SEGMENTS_IMMEDIATELY_FOLLOWING(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_IMMEDIATELY_FOLLOWING) ReaderGroupInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupInfo) REMOVE_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.REMOVE_WRITER) GET_SEGMENTS_BETWEEN_STREAM_CUTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS_BETWEEN_STREAM_CUTS) LIST_STREAMS_IN_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE) SslContextBuilder(io.grpc.netty.shaded.io.netty.handler.ssl.SslContextBuilder) RequestTracker(io.pravega.common.tracing.RequestTracker) ScopesResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesResponse) SSLException(javax.net.ssl.SSLException) KVTablesInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeRequest) GET_STREAM_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_STREAM_CONFIGURATION) Futures(io.pravega.common.concurrent.Futures) KeyValueTableSegments(io.pravega.client.tables.impl.KeyValueTableSegments) SegmentId(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentId) StreamCutRangeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamCutRangeResponse) CreateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateReaderGroupResponse) LIST_KEY_VALUE_TABLES(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_KEY_VALUE_TABLES) KeyValueTableConfig(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfig) GrpcSslContexts(io.grpc.netty.shaded.io.grpc.netty.GrpcSslContexts) Exceptions(io.pravega.common.Exceptions) ScopeInfo(io.pravega.controller.stream.api.grpc.v1.Controller.ScopeInfo) StreamsInScopeWithTagRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeWithTagRequest) ModelHelper.encode(io.pravega.client.control.impl.ModelHelper.encode) GET_KEY_VALUE_TABLE_CONFIGURATION(io.pravega.shared.controller.tracing.RPCTracingTags.GET_KEY_VALUE_TABLE_CONFIGURATION) Supplier(java.util.function.Supplier) UpdateSubscriberStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateSubscriberStatus) PingFailedException(io.pravega.client.stream.PingFailedException) Strings(com.google.common.base.Strings) Code(io.grpc.Status.Code) NodeUri(io.pravega.controller.stream.api.grpc.v1.Controller.NodeUri) ReaderGroupConfiguration(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfiguration) StreamInfo(io.pravega.controller.stream.api.grpc.v1.Controller.StreamInfo) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) GET_SUCCESSORS_FROM_CUT(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SUCCESSORS_FROM_CUT) ControllerServiceGrpc(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc) START_SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.START_SCALE_STREAM) StreamSegmentsWithPredecessors(io.pravega.client.stream.impl.StreamSegmentsWithPredecessors) ExistsResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ExistsResponse) RemoveWriterResponse(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterResponse) Callbacks(io.pravega.common.function.Callbacks) AsyncIterator(io.pravega.common.util.AsyncIterator) SegmentRange(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentRange) WriterPosition(io.pravega.client.stream.impl.WriterPosition) File(java.io.File) StatusRuntimeException(io.grpc.StatusRuntimeException) CREATE_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_TRANSACTION) RPCTracingHelpers(io.pravega.shared.controller.tracing.RPCTracingHelpers) LIST_STREAMS_IN_SCOPE_FOR_TAG(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_STREAMS_IN_SCOPE_FOR_TAG) TreeMap(java.util.TreeMap) TxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.TxnStatus) Preconditions(com.google.common.base.Preconditions) DeleteReaderGroupStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteReaderGroupStatus) SegmentsAtTime(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentsAtTime) TxnFailedException(io.pravega.client.stream.TxnFailedException) CreateKeyValueTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateKeyValueTableStatus) GET_CURRENT_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS) CHECK_TRANSACTION_STATE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_TRANSACTION_STATE) CREATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_STREAM) ManagedChannel(io.grpc.ManagedChannel) Retry(io.pravega.common.util.Retry) LoggerFactory(org.slf4j.LoggerFactory) KeyValueTableConfiguration(io.pravega.client.tables.KeyValueTableConfiguration) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) StreamsInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeResponse) ContinuationToken(io.pravega.controller.stream.api.grpc.v1.Controller.ContinuationToken) GetSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetSegmentsRequest) StreamObserver(io.grpc.stub.StreamObserver) TagLogger(io.pravega.common.tracing.TagLogger) ControllerServiceStub(io.pravega.controller.stream.api.grpc.v1.ControllerServiceGrpc.ControllerServiceStub) CREATE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_KEY_VALUE_TABLE) KeyValueTableInfo(io.pravega.client.admin.KeyValueTableInfo) Stream(io.pravega.client.stream.Stream) KVTablesInScopeResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KVTablesInScopeResponse) PravegaNodeUri(io.pravega.shared.protocol.netty.PravegaNodeUri) SubscribersResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SubscribersResponse) Transaction(io.pravega.client.stream.Transaction) DELETE_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_KEY_VALUE_TABLE) TxnSegments(io.pravega.client.stream.impl.TxnSegments) RetryAndThrowConditionally(io.pravega.common.util.Retry.RetryAndThrowConditionally) CreateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateStreamStatus) CHECK_SCOPE_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCOPE_EXISTS) LIST_SUBSCRIBERS(io.pravega.shared.controller.tracing.RPCTracingTags.LIST_SUBSCRIBERS) CHECK_STREAM_EXISTS(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_STREAM_EXISTS) CREATE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_SCOPE) Collection(java.util.Collection) DelegationToken(io.pravega.controller.stream.api.grpc.v1.Controller.DelegationToken) CompletionException(java.util.concurrent.CompletionException) UUID(java.util.UUID) COMMIT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.COMMIT_TRANSACTION) NavigableMap(java.util.NavigableMap) Collectors(java.util.stream.Collectors) GET_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_SEGMENTS) GET_EPOCH_SEGMENTS(io.pravega.shared.controller.tracing.RPCTracingTags.GET_EPOCH_SEGMENTS) SEAL_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SEAL_STREAM) SegmentWithRange(io.pravega.client.stream.impl.SegmentWithRange) List(java.util.List) ABORT_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.ABORT_TRANSACTION) CreateTxnResponse(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnResponse) GET_URI(io.pravega.shared.controller.tracing.RPCTracingTags.GET_URI) GetEpochSegmentsRequest(io.pravega.controller.stream.api.grpc.v1.Controller.GetEpochSegmentsRequest) DELETE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_READER_GROUP) TimestampFromWriter(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampFromWriter) DELETE_SCOPE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE) PING_TRANSACTION(io.pravega.shared.controller.tracing.RPCTracingTags.PING_TRANSACTION) PingTxnStatus(io.pravega.controller.stream.api.grpc.v1.Controller.PingTxnStatus) DELETE_SCOPE_RECURSIVE(io.pravega.shared.controller.tracing.RPCTracingTags.DELETE_SCOPE_RECURSIVE) Segment(io.pravega.client.segment.impl.Segment) CreateScopeStatus(io.pravega.controller.stream.api.grpc.v1.Controller.CreateScopeStatus) StreamImpl(io.pravega.client.stream.impl.StreamImpl) ScaleStatusRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusRequest) KeyValueTableConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.KeyValueTableConfigResponse) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) IS_SEGMENT_OPEN(io.pravega.shared.controller.tracing.RPCTracingTags.IS_SEGMENT_OPEN) ScaleStatusResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleStatusResponse) TxnState(io.pravega.controller.stream.api.grpc.v1.Controller.TxnState) HashMap(java.util.HashMap) CompletableFuture(java.util.concurrent.CompletableFuture) Function(java.util.function.Function) SuccessorResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SuccessorResponse) GET_OR_REFRESH_DELEGATION_TOKEN_FOR(io.pravega.shared.controller.tracing.RPCTracingTags.GET_OR_REFRESH_DELEGATION_TOKEN_FOR) ScaleRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleRequest) DeleteKVTableStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteKVTableStatus) CreateTxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.CreateTxnRequest) GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE(io.pravega.shared.controller.tracing.RPCTracingTags.GET_CURRENT_SEGMENTS_KEY_VALUE_TABLE) ScopesRequest(io.pravega.controller.stream.api.grpc.v1.Controller.ScopesRequest) DeleteStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.DeleteStreamStatus) NOTE_TIMESTAMP_FROM_WRITER(io.pravega.shared.controller.tracing.RPCTracingTags.NOTE_TIMESTAMP_FROM_WRITER) CHECK_SCALE(io.pravega.shared.controller.tracing.RPCTracingTags.CHECK_SCALE) NettyChannelBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyChannelBuilder) UPDATE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.UPDATE_STREAM) CREATE_READER_GROUP(io.pravega.shared.controller.tracing.RPCTracingTags.CREATE_READER_GROUP) ScaleResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ScaleResponse) SCALE_STREAM(io.pravega.shared.controller.tracing.RPCTracingTags.SCALE_STREAM) LoggerHelpers(io.pravega.common.LoggerHelpers) UpdateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateReaderGroupResponse) NameUtils(io.pravega.shared.NameUtils) TimestampResponse(io.pravega.controller.stream.api.grpc.v1.Controller.TimestampResponse) StreamsInScopeRequest(io.pravega.controller.stream.api.grpc.v1.Controller.StreamsInScopeRequest) RemoveWriterRequest(io.pravega.controller.stream.api.grpc.v1.Controller.RemoveWriterRequest) GET_READER_GROUP_CONFIG(io.pravega.shared.controller.tracing.RPCTracingTags.GET_READER_GROUP_CONFIG) StreamSegmentSuccessors(io.pravega.client.stream.impl.StreamSegmentSuccessors) TimeUnit(java.util.concurrent.TimeUnit) ManagedChannelBuilder(io.grpc.ManagedChannelBuilder) AbstractMap(java.util.AbstractMap) UpdateStreamStatus(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateStreamStatus) ContinuationTokenAsyncIterator(io.pravega.common.util.ContinuationTokenAsyncIterator) InvalidStreamException(io.pravega.client.stream.InvalidStreamException) Credentials(io.pravega.shared.security.auth.Credentials) VisibleForTesting(com.google.common.annotations.VisibleForTesting) RandomFactory(io.pravega.common.hash.RandomFactory) TxnRequest(io.pravega.controller.stream.api.grpc.v1.Controller.TxnRequest) ReaderGroupConfigResponse(io.pravega.controller.stream.api.grpc.v1.Controller.ReaderGroupConfigResponse) SegmentValidityResponse(io.pravega.controller.stream.api.grpc.v1.Controller.SegmentValidityResponse) Collections(java.util.Collections) ReaderGroupNotFoundException(io.pravega.client.stream.ReaderGroupNotFoundException) UpdateReaderGroupResponse(io.pravega.controller.stream.api.grpc.v1.Controller.UpdateReaderGroupResponse)

Aggregations

ReaderGroupNotFoundException (io.pravega.client.stream.ReaderGroupNotFoundException)8 Stream (io.pravega.client.stream.Stream)7 NameUtils (io.pravega.shared.NameUtils)7 InvalidStreamException (io.pravega.client.stream.InvalidStreamException)6 ReaderGroupConfig (io.pravega.client.stream.ReaderGroupConfig)6 StreamConfiguration (io.pravega.client.stream.StreamConfiguration)6 Exceptions (io.pravega.common.Exceptions)6 Futures (io.pravega.common.concurrent.Futures)6 CompletableFuture (java.util.concurrent.CompletableFuture)6 VisibleForTesting (com.google.common.annotations.VisibleForTesting)5 KeyValueTableInfo (io.pravega.client.admin.KeyValueTableInfo)5 AsyncIterator (io.pravega.common.util.AsyncIterator)5 List (java.util.List)5 Preconditions (com.google.common.base.Preconditions)4 ClientConfig (io.pravega.client.ClientConfig)4 Strings (com.google.common.base.Strings)3 ManagedChannel (io.grpc.ManagedChannel)3 ManagedChannelBuilder (io.grpc.ManagedChannelBuilder)3 Code (io.grpc.Status.Code)3 StatusRuntimeException (io.grpc.StatusRuntimeException)3