Skip to content

Commit

Permalink
Convert range size to int only once
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Nov 21, 2023
1 parent eabb21e commit 6834d8b
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ private CacheEntry(T chunk) {
private final SharedBytes sharedBytes;
private final long cacheSize;
private final int regionSize;
private final ByteSizeValue rangeSize;
private final ByteSizeValue recoveryRangeSize;
private final int rangeSize;
private final int recoveryRangeSize;

private final int numRegions;
private final ConcurrentLinkedQueue<SharedBytes.IO> freeRegions = new ConcurrentLinkedQueue<>();
Expand Down Expand Up @@ -355,8 +355,8 @@ public SharedBlobCacheService(
freeRegions.add(sharedBytes.getFileChannel(i));
}

this.rangeSize = SHARED_CACHE_RANGE_SIZE_SETTING.get(settings);
this.recoveryRangeSize = SHARED_CACHE_RECOVERY_RANGE_SIZE_SETTING.get(settings);
this.rangeSize = BlobCacheUtils.toIntBytes(SHARED_CACHE_RANGE_SIZE_SETTING.get(settings).getBytes());
this.recoveryRangeSize = BlobCacheUtils.toIntBytes(SHARED_CACHE_RECOVERY_RANGE_SIZE_SETTING.get(settings).getBytes());

this.blobCacheMetrics = blobCacheMetrics;
}
Expand All @@ -368,11 +368,11 @@ public static long calculateCacheSize(Settings settings, long totalFsSize) {
}

public int getRangeSize() {
return BlobCacheUtils.toIntBytes(rangeSize.getBytes());
return rangeSize;
}

public int getRecoveryRangeSize() {
return BlobCacheUtils.toIntBytes(recoveryRangeSize.getBytes());
return recoveryRangeSize;
}

private int getRegion(long position) {
Expand Down

0 comments on commit 6834d8b

Please sign in to comment.