-
Notifications
You must be signed in to change notification settings - Fork 8.9k
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
HADOOP-18959 S3A : Use builder for prefetch CachingBlockManager #6240
Conversation
Tested against
|
💔 -1 overall
This message was automatically generated. |
@ahmarsuhail could you please review this PR? |
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
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.
looks good mostly, thanks. leaving some initial feedback, haven't reviewed test code yet.
* This class is used to provide params to {@link BlockManager}. | ||
*/ | ||
@InterfaceAudience.Private | ||
public final class BlockManagerParams { |
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.
nit: could you please rename to BlockManagerParameters
?
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
/** | ||
* Asynchronous tasks are performed in this pool. | ||
*/ | ||
private final ExecutorServiceFuturePool futurePool; |
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.
nit: could you add a new line after each of these, makes for slightly easier reading.
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
private final DurationTrackerFactory trackerFactory; | ||
|
||
@SuppressWarnings("checkstyle:parameternumber") | ||
private BlockManagerParams(ExecutorServiceFuturePool futurePool, BlockData blockData, |
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.
we're still ending up with a constructor here. Instead of this, look at S3ClientFactory.S3ClientCreationParameters to see how we get and set parameters there, we should follow the same patter here.
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
* under the License. | ||
*/ | ||
|
||
package org.apache.hadoop.fs.impl.prefetch; |
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.
could you refactor this class, similar to S3ClientFactory.S3ClientCreationParameters. That feels like a cleaner way to get and set these parameters.
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
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.
looks good, few minor refactoring comments.
return trackerFactory; | ||
} | ||
|
||
public BlockManagerParameters setFuturePool( |
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.
could you rename the setters to "withFuturePool" instead of set, keeps things uniform with other builders in the project.
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.
Also could you pelase add javadocs for the getters and setters
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
@Test | ||
public void testArgChecks() throws Exception { | ||
MockS3ARemoteObject s3File = new MockS3ARemoteObject(FILE_SIZE, false); | ||
S3ARemoteObjectReader reader = new S3ARemoteObjectReader(s3File); | ||
|
||
Configuration conf = new Configuration(); | ||
BlockManagerParameters blockManagerParamsBuilder1 = |
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.
with the builder, this test is getting really long now. How about we split it into separate tests? One test for the valid blockManager and the assertions on it that are done. And then split each of the illegal arg ones into a separate test? eg: testNullFuturePool(), etc.
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
@@ -244,9 +292,18 @@ private void testPrefetchHelper(boolean forcePrefetchFailure) | |||
throws IOException, InterruptedException { | |||
MockS3ARemoteObject s3File = new MockS3ARemoteObject(FILE_SIZE, false); | |||
S3ARemoteObjectReader reader = new S3ARemoteObjectReader(s3File); | |||
BlockManagerParameters blockManagerParamsBuilder = |
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.
looks like the code to create blockManagerParamsBuilder
is common in these three cases. Consider moving to a common method that returns the builder.
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
🎊 +1 overall
This message was automatically generated. |
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.
+1, LGTM.
…6302) Contributed by Viraj Jasani. Signed-off-by: Shilun Fan <[email protected]>
Jira: HADOOP-18959