use of io.pravega.controller.store.stream.OperationContext in project pravega by pravega.
the class StreamCutBucketService method performRetention.
private CompletableFuture<Void> performRetention(StreamImpl stream) {
log.debug("Periodic background processing for retention called for stream {}/{}", stream.getScope(), stream.getStreamName());
OperationContext context = streamMetadataStore.createContext(stream.getScope(), stream.getStreamName());
return RetryHelper.withRetriesAsync(() -> streamMetadataStore.getConfiguration(stream.getScope(), stream.getStreamName(), context, executor).thenCompose(config -> streamMetadataTasks.retention(stream.getScope(), stream.getStreamName(), config.getRetentionPolicy(), System.currentTimeMillis(), context, this.streamMetadataTasks.retrieveDelegationToken())).exceptionally(e -> {
log.warn("Exception thrown while performing auto retention for stream {} ", stream, e);
throw new CompletionException(e);
}), RetryHelper.UNCONDITIONAL_PREDICATE, 5, executor).exceptionally(e -> {
log.warn("Unable to perform retention for stream {}. Ignoring, retention will be attempted in next cycle.", stream, e);
return null;
});
}
Aggregations