HADOOP-18805. S3A prefetch tests to work with small files#5851
HADOOP-18805. S3A prefetch tests to work with small files#5851steveloughran merged 7 commits intoapache:trunkfrom
Conversation
|
This PR build is also failing with likely jenkins env issue https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-5851/1/console |
|
jenkins build issue resolved as part of INFRA-24797 |
|
🎊 +1 overall
This message was automatically generated. |
steveloughran
left a comment
There was a problem hiding this comment.
I'd also imagined this jira would cover the original large file test, as it has similar issues. we shouldn't need to work with landsat at all.
| S3ATestUtils.removeBaseAndBucketOverrides(conf, PREFETCH_BLOCK_SIZE_KEY); | ||
| conf.setBoolean(PREFETCH_ENABLED_KEY, true); | ||
| conf.setInt(PREFETCH_MAX_BLOCKS_COUNT, Integer.parseInt(maxBlocks)); | ||
| conf.setInt(PREFETCH_BLOCK_SIZE_KEY, S_1K * 10); |
There was a problem hiding this comment.
given this is fixed, why have blocksize reread on L115?
proposed: make blocksize constant BLOCK_SIZE, use as appropriate
you mean |
|
removed dependency on landsat for prefetch tests, re-tested the whole suite against |
steveloughran
left a comment
There was a problem hiding this comment.
this is good. now we have small filesystems everywhere we can actually skip creating new filesystems in test cases, just use getFileSystem().
this will make the classes even simpler
| S3ATestUtils.removeBaseAndBucketOverrides(conf, PREFETCH_ENABLED_KEY); | ||
| S3ATestUtils.removeBaseAndBucketOverrides(conf, PREFETCH_BLOCK_SIZE_KEY); | ||
| conf.setBoolean(PREFETCH_ENABLED_KEY, true); | ||
| conf.setInt(PREFETCH_BLOCK_SIZE_KEY, BLOCK_SIZE); |
There was a problem hiding this comment.
because the size is now being set in this method, the filesystem automatically created/destroyed is already set up for the tests; we can replace openFS() entirely.
There was a problem hiding this comment.
done, makes them much simpler
| } | ||
|
|
||
| private void openFS() throws Exception { | ||
| private void openFS(String fileName) throws Exception { |
There was a problem hiding this comment.
change to using the existing fs, and using methodPath() to generate a per test case path (no test uses more than one file, does it?)
void createLargeFile() throws IOException {
Configuration conf = getConfiguration();
byte[] data = ContractTestUtils.dataset(S_1K * 72, 'x', 26);
largeFile = methodPath();
FileSystem largeFileFS = getFileSystem();
ContractTestUtils.writeDataset(largeFileFS, largeFile, data, data.length, 16, true);
FileStatus fileStatus = largeFileFS.getFileStatus(largeFile);
largeFileSize = fileStatus.getLen();
numBlocks = calculateNumBlocks(largeFileSize, BLOCK_SIZE);
}There was a problem hiding this comment.
no test uses more than one file, does it?
correct, they use only 1 file
| smallFile = path("iTestS3APrefetchingLruEviction"); | ||
| ContractTestUtils.writeDataset(getFileSystem(), smallFile, data, data.length, 16, true); | ||
| blockSize = conf.getInt(PREFETCH_BLOCK_SIZE_KEY, PREFETCH_BLOCK_DEFAULT_SIZE); | ||
| smallFileFS = new S3AFileSystem(); |
There was a problem hiding this comment.
can use use getFileSystem() here
|
🎊 +1 overall
This message was automatically generated. |
|
|
|
🎊 +1 overall
This message was automatically generated. |
steveloughran
left a comment
There was a problem hiding this comment.
really, really close, just need to move from fields to local vars
| private void createSmallFile() throws Exception { | ||
| byte[] data = ContractTestUtils.dataset(SMALL_FILE_SIZE, 'x', 26); | ||
| smallFile = path("iTestS3APrefetchingLruEviction"); | ||
| smallFile = methodPath(); |
There was a problem hiding this comment.
this should be made a local variable; class field removed as well as teardown
| private void createLargeFile() throws Exception { | ||
| byte[] data = ContractTestUtils.dataset(S_1K * 72, 'x', 26); | ||
| largeFile = path(fileName); | ||
| largeFile = methodPath(); |
There was a problem hiding this comment.
this should be made a local variable; class field removed as well as teardown
steveloughran
left a comment
There was a problem hiding this comment.
ok, sorry, my fault, i annotated the wrong line,
It's the filesystem instances largeFileFS and smallFileFS which should be replaced with local vars -they are both just getFileSystem() references, and there's no need to close them in teardown as the superclass does its work there
|
🎊 +1 overall
This message was automatically generated. |
|
💔 -1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
🎊 +1 overall
This message was automatically generated. |
|
us-west-2:
|
|
i plan to initiate few more followup sub-task Jira later: a) LRU contents unit testable with some refactor |
steveloughran
left a comment
There was a problem hiding this comment.
LGTM
+1
will merge
|
merged to trunk; now I will get to rebase my unbuffer() patch atop it. Can you do the homework of a cherrypick and retest onto branch-3? thanks |
|
sure thing, will create 3.3 backport PR and test it. Thank you for merging the PR! |
Contributed by Viraj Jasani
Contributed by Viraj Jasani
Jira: HADOOP-18805