Search in sources :

Example 1 with TRUNCATED_SIZE

use of io.pravega.shared.MetricsNames.TRUNCATED_SIZE in project pravega by pravega.

the class TruncateStreamTask method processTruncate.

private CompletableFuture<Void> processTruncate(String scope, String stream, VersionedMetadata<StreamTruncationRecord> versionedTruncationRecord, VersionedMetadata<State> versionedState, OperationContext context, long requestId) {
    String delegationToken = this.streamMetadataTasks.retrieveDelegationToken();
    StreamTruncationRecord truncationRecord = versionedTruncationRecord.getObject();
    log.info(requestId, "Truncating stream {}/{} at stream cut: {}", scope, stream, truncationRecord.getStreamCut());
    return Futures.toVoid(streamMetadataStore.updateVersionedState(scope, stream, State.TRUNCATING, versionedState, context, executor).thenCompose(update -> notifyTruncateSegments(scope, stream, truncationRecord.getStreamCut(), delegationToken, requestId).thenCompose(x -> notifyDeleteSegments(scope, stream, truncationRecord.getToDelete(), delegationToken, requestId)).thenAccept(x -> DYNAMIC_LOGGER.reportGaugeValue(TRUNCATED_SIZE, versionedTruncationRecord.getObject().getSizeTill(), streamTags(scope, stream))).thenCompose(deleted -> streamMetadataStore.completeTruncation(scope, stream, versionedTruncationRecord, context, executor)).thenCompose(x -> streamMetadataStore.updateVersionedState(scope, stream, State.ACTIVE, update, context, executor))));
}
Also used : OperationContext(io.pravega.controller.store.stream.OperationContext) NameUtils(io.pravega.shared.NameUtils) StreamTruncationRecord(io.pravega.controller.store.stream.records.StreamTruncationRecord) TruncateStreamEvent(io.pravega.shared.controller.event.TruncateStreamEvent) LoggerFactory(org.slf4j.LoggerFactory) Set(java.util.Set) CompletableFuture(java.util.concurrent.CompletableFuture) Collectors(java.util.stream.Collectors) MetricsTags.streamTags(io.pravega.shared.MetricsTags.streamTags) MetricsProvider(io.pravega.shared.metrics.MetricsProvider) TagLogger(io.pravega.common.tracing.TagLogger) VersionedMetadata(io.pravega.controller.store.VersionedMetadata) DynamicLogger(io.pravega.shared.metrics.DynamicLogger) TRUNCATED_SIZE(io.pravega.shared.MetricsNames.TRUNCATED_SIZE) Map(java.util.Map) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) StreamMetadataTasks(io.pravega.controller.task.Stream.StreamMetadataTasks) Preconditions(com.google.common.base.Preconditions) State(io.pravega.controller.store.stream.State) StreamMetadataStore(io.pravega.controller.store.stream.StreamMetadataStore) Futures(io.pravega.common.concurrent.Futures) StreamTruncationRecord(io.pravega.controller.store.stream.records.StreamTruncationRecord)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 Futures (io.pravega.common.concurrent.Futures)1 TagLogger (io.pravega.common.tracing.TagLogger)1 VersionedMetadata (io.pravega.controller.store.VersionedMetadata)1 OperationContext (io.pravega.controller.store.stream.OperationContext)1 State (io.pravega.controller.store.stream.State)1 StreamMetadataStore (io.pravega.controller.store.stream.StreamMetadataStore)1 StreamTruncationRecord (io.pravega.controller.store.stream.records.StreamTruncationRecord)1 StreamMetadataTasks (io.pravega.controller.task.Stream.StreamMetadataTasks)1 TRUNCATED_SIZE (io.pravega.shared.MetricsNames.TRUNCATED_SIZE)1 MetricsTags.streamTags (io.pravega.shared.MetricsTags.streamTags)1 NameUtils (io.pravega.shared.NameUtils)1 TruncateStreamEvent (io.pravega.shared.controller.event.TruncateStreamEvent)1 DynamicLogger (io.pravega.shared.metrics.DynamicLogger)1 MetricsProvider (io.pravega.shared.metrics.MetricsProvider)1 Map (java.util.Map)1 Set (java.util.Set)1 CompletableFuture (java.util.concurrent.CompletableFuture)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 Collectors (java.util.stream.Collectors)1