New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ALLUXIO-262] Cache incomplete blocks during file seek #3089
Conversation
Merged build finished. Test FAILed. |
IntelliJ autoformating added some changes to this PR. If you feel they are misleading for code review, I can revert them. |
Merged build finished. Test FAILed. |
Test FAILed. Failed Tests: 1org.alluxio:alluxio-core-client: 1Test FAILed. |
Merged build finished. Test FAILed. |
Merged build finished. Test PASSed. |
Test PASSed. |
@@ -78,6 +78,8 @@ | |||
private boolean mClosed; | |||
/** Whether or not the current block should be cached. */ | |||
private boolean mShouldCacheCurrentBlock; | |||
/** Include incomplete blocks if Alluxio is configured to store blocks in Alluxio storage. */ | |||
private boolean mShouldCacheIncompleteBlock; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be final?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Thanks @peisun1115 for this feature! I left some comments. |
} | ||
|
||
/** | ||
* Seeks to a file position. Blocks are cached even if they are fully read. This is only called by |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If they are not fully read?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@peisun1115 is the intended behavior consistent with the ticket? It seems like using this option will not cache if a block if the read is just of a small portion of the block. Also if the user seeks to a position inside a large file, all the blocks before that position will need to be cached which is not the intention right? |
@@ -78,6 +78,8 @@ | |||
private boolean mClosed; | |||
/** Whether or not the current block should be cached. */ | |||
private boolean mShouldCacheCurrentBlock; | |||
/** Include incomplete blocks if Alluxio is configured to store blocks in Alluxio storage. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the javadoc is a bit unclear. do you mean:
Whether to store incomplete blocks in Alluxio ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
I explained this PR and compared it with the other approach (prefetch every block) in https://docs.google.com/document/d/1mR1_NPt60smz5nWMAyeUZfXNllrKKmc39CaUORb1oPg/edit I can change this PR to do prefetching if you guys prefer. I will address the comments once we agree on the approach. |
Merged build finished. Test PASSed. |
@@ -345,7 +352,7 @@ private void checkAndAdvanceBlockInStream() throws IOException { | |||
try { | |||
WorkerNetAddress address = mLocationPolicy.getWorkerForNextBlock( | |||
mContext.getAlluxioBlockStore().getWorkerInfoList(), getBlockSizeAllocation(mPos)); | |||
// Don't cache the block to somewhere that already has it. | |||
// Don't cache the block to somewhere that already has it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be changed back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@peisun1115 Thanks! I left a few comments. |
@gpang I have addressed your comments. |
Merged build finished. Test FAILed. |
Merged build finished. Test PASSed. |
Test PASSed. |
Thanks @peisun1115 , I just had one last question. |
@gpang fixed |
Merged build finished. Test PASSed. |
Test PASSed. |
if (mPos == pos) { | ||
return; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we reach here, that means seeks backwards, right?
if yes, please javadoc this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. FYI, I am refactoring this file to make it clearer. I feel FileInStream is a little hard to follow and easy to make mistakes when I make changes to it.
I left two post-LGTM comments, if fixed/answered, LGTM to me |
@apc999 Fixed. Thank you. |
Merged build finished. Test FAILed. |
Test FAILed. Failed Tests: 1org.alluxio:alluxio-tests: 1Test FAILed. |
Jerkins, test this please |
Merged build finished. Test PASSed. |
Test PASSed. |
LGTM |
1 similar comment
LGTM |
https://alluxio.atlassian.net/browse/ALLUXIO-262