Skip to content

Commit

Permalink
Fix listeners in SharedBlobCacheService.readMultiRegions
Browse files Browse the repository at this point in the history
  • Loading branch information
tlrx committed Nov 2, 2023
1 parent 995b4d3 commit 58aa1cf
Showing 1 changed file with 15 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -845,16 +845,21 @@ private int readMultiRegions(
// nothing to read, skip
continue;
}
final CacheFileRegion fileRegion = get(cacheKey, length, region);
final long regionStart = getRegionStart(region);
fileRegion.populateAndRead(
mapSubRangeToRegion(rangeToWrite, region),
subRangeToRead,
readerWithOffset(reader, fileRegion, Math.toIntExact(rangeToRead.start() - regionStart)),
writerWithOffset(writer, fileRegion, Math.toIntExact(rangeToWrite.start() - regionStart)),
ioExecutor,
listeners.acquire(i -> bytesRead.updateAndGet(j -> Math.addExact(i, j)))
);
ActionListener<Integer> listener = listeners.acquire(i -> bytesRead.updateAndGet(j -> Math.addExact(i, j)));
try {
final CacheFileRegion fileRegion = get(cacheKey, length, region);
final long regionStart = getRegionStart(region);
fileRegion.populateAndRead(
mapSubRangeToRegion(rangeToWrite, region),
subRangeToRead,
readerWithOffset(reader, fileRegion, Math.toIntExact(rangeToRead.start() - regionStart)),
writerWithOffset(writer, fileRegion, Math.toIntExact(rangeToWrite.start() - regionStart)),
ioExecutor,
listener
);
} catch (Exception e) {
listener.onFailure(e);
}
}
}
readsComplete.get();
Expand Down

0 comments on commit 58aa1cf

Please sign in to comment.