Skip to content

Commit

Permalink
Release BlockReader in CRC check
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
elega authored Sep 12, 2024
1 parent ae64e71 commit c0cea82
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion core/common/src/main/java/alluxio/Sessions.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,10 @@ public class Sessions {
public static final int CACHE_UFS_SESSION_ID = -8;

public static final int LOAD_SESSION_ID = -9;
public static final int WORKER_CHECKSUM_CHECK_SESSION_ID = -10;

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

/** Map from SessionId to {@link alluxio.SessionInfo} object. */
private final Map<Long, SessionInfo> mSessions;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -637,10 +637,10 @@ public Map<Long, BlockChecksum> calculateBlockChecksum(List<Long> blockIds) {
for (long blockId : blockIds) {
Future<?> future = mChecksumCalculationThreadPool.submit(() -> {
ByteBuffer bf = null;
try {
try (BlockReader br = mBlockStore.createBlockReader(
Sessions.WORKER_CHECKSUM_CHECK_SESSION_ID,
blockId, 0, false, Protocol.OpenUfsBlockOptions.getDefaultInstance())) {
CRC64 crc64 = new CRC64();
BlockReader br = mBlockStore.createBlockReader(
-1, blockId, 0, false, Protocol.OpenUfsBlockOptions.getDefaultInstance());
if (mChecksumCalculationUsingBufferPool) {
bf = NioHeapBufferPool.acquire(chunkSize);
} else {
Expand Down

0 comments on commit c0cea82

Please sign in to comment.