Skip to content

Commit c0cea82

Browse files
authored
Release BlockReader in CRC check
### What changes are proposed in this pull request? Please outline the changes and how this PR fixes the issue. ### Why are the changes needed? Please clarify why the changes are needed. For instance, 1. If you propose a new API, clarify the use case for a new API. 2. If you fix a bug, describe the bug. ### Does this PR introduce any user facing changes? Please list the user-facing changes introduced by your change, including 1. change in user-facing APIs 2. addition or removal of property keys 3. webui pr-link: #18695 change-id: cid-fba7d00da83719d31df0d917e1419ed049adeed8
1 parent ae64e71 commit c0cea82

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

core/common/src/main/java/alluxio/Sessions.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,10 @@ public class Sessions {
3636
public static final int CACHE_UFS_SESSION_ID = -8;
3737

3838
public static final int LOAD_SESSION_ID = -9;
39+
public static final int WORKER_CHECKSUM_CHECK_SESSION_ID = -10;
3940

4041
// internal session id base should be smaller than all predefined session ids
41-
public static final long INTERNAL_SESSION_ID_BASE = -8;
42+
public static final long INTERNAL_SESSION_ID_BASE = -11;
4243

4344
/** Map from SessionId to {@link alluxio.SessionInfo} object. */
4445
private final Map<Long, SessionInfo> mSessions;

core/server/worker/src/main/java/alluxio/worker/block/DefaultBlockWorker.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,10 @@ public Map<Long, BlockChecksum> calculateBlockChecksum(List<Long> blockIds) {
637637
for (long blockId : blockIds) {
638638
Future<?> future = mChecksumCalculationThreadPool.submit(() -> {
639639
ByteBuffer bf = null;
640-
try {
640+
try (BlockReader br = mBlockStore.createBlockReader(
641+
Sessions.WORKER_CHECKSUM_CHECK_SESSION_ID,
642+
blockId, 0, false, Protocol.OpenUfsBlockOptions.getDefaultInstance())) {
641643
CRC64 crc64 = new CRC64();
642-
BlockReader br = mBlockStore.createBlockReader(
643-
-1, blockId, 0, false, Protocol.OpenUfsBlockOptions.getDefaultInstance());
644644
if (mChecksumCalculationUsingBufferPool) {
645645
bf = NioHeapBufferPool.acquire(chunkSize);
646646
} else {

0 commit comments

Comments
 (0)