Skip to content

Commit

Permalink
Fix isAllPageCached
Browse files Browse the repository at this point in the history
### What changes are proposed in this pull request?

Fix a bug when file size < 1 page, alluxio considers all pages are cached no matter if it really caches it or not.

### Why are the changes needed?

Bug fixing 

### Does this PR introduce any user facing changes?

N/A
			pr-link: Alluxio#18347
			change-id: cid-da4bdce6615e4b1d9777a98ab335bf36e503d102
  • Loading branch information
elega authored and ssz1997 committed Dec 15, 2023
1 parent f4dbec7 commit 6cd0576
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,8 @@ private boolean isAllPageCached(alluxio.grpc.UfsStatus status, long offset, long
String fileId = new AlluxioURI(status.getUfsFullPath()).hash();
List<PageId> cachedPages = mCacheManager.getCachedPageIdsByFileId(fileId,
status.getUfsFileStatus().getContentLength());
int numOfPagesInBlock = (int) (length / mPageSize);
// Ceiling
int numOfPagesInBlock = (int) ((length + mPageSize - 1) / mPageSize);
for (long pageIndex = offset / mPageSize; pageIndex < numOfPagesInBlock;
pageIndex++) {
PageId pageId = new PageId(fileId, pageIndex);
Expand Down

0 comments on commit 6cd0576

Please sign in to comment.