Skip to content

Commit

Permalink
[improve][ml] Optimize BlobStoreManagedLedgerOffloader.getOffloadPoli…
Browse files Browse the repository at this point in the history
…cies (apache#23776)
  • Loading branch information
dao-jun authored Dec 25, 2024
1 parent 9699dc2 commit 369c352
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,16 @@ public class BlobStoreManagedLedgerOffloader implements LedgerOffloader {

private final OrderedScheduler scheduler;
private final TieredStorageConfiguration config;
private final OffloadPolicies policies;
private final Location writeLocation;

// metadata to be stored as part of the offloaded ledger metadata
private final Map<String, String> userMetadata;

private final ConcurrentMap<BlobStoreLocation, BlobStore> blobStores = new ConcurrentHashMap<>();
private OffloadSegmentInfoImpl segmentInfo;
private AtomicLong bufferLength = new AtomicLong(0);
private AtomicLong segmentLength = new AtomicLong(0);
private final AtomicLong bufferLength = new AtomicLong(0);
private final AtomicLong segmentLength = new AtomicLong(0);
private final long maxBufferLength;
private final OffsetsCache entryOffsetsCache;
private final ConcurrentLinkedQueue<Entry> offloadBuffer = new ConcurrentLinkedQueue<>();
Expand Down Expand Up @@ -138,6 +139,9 @@ public static BlobStoreManagedLedgerOffloader create(TieredStorageConfiguration
this.scheduler = scheduler;
this.userMetadata = userMetadata;
this.config = config;
Properties properties = new Properties();
properties.putAll(config.getConfigProperties());
this.policies = OffloadPoliciesImpl.create(properties);
this.streamingBlockSize = config.getMinBlockSizeInBytes();
this.maxSegmentCloseTime = Duration.ofSeconds(config.getMaxSegmentTimeInSecond());
this.maxSegmentLength = config.getMaxSegmentSizeInBytes();
Expand Down Expand Up @@ -658,9 +662,7 @@ public CompletableFuture<Void> deleteOffloaded(UUID uid, Map<String, String> off

@Override
public OffloadPolicies getOffloadPolicies() {
Properties properties = new Properties();
properties.putAll(config.getConfigProperties());
return OffloadPoliciesImpl.create(properties);
return this.policies;
}

@Override
Expand Down

0 comments on commit 369c352

Please sign in to comment.