-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HDFS-8631. WebHDFS : Support setQuota #1253
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
Conversation
*/ | ||
public void setQuota(Path src, final long namespaceQuota, | ||
final long storagespaceQuota) throws IOException { | ||
throw new UnsupportedOperationException(getClass().getCanonicalName() + |
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.
This is a pattern used in many places.
I think we should have a static method to do this.
I think the easiest way to get the function name is to get the stack trace.
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.
Agree. Better to have a static method and make the error message standardized. Not sure what you mean by getting the function name from the stack trace though. I was thinking to just pass the method name to the static helper method.
Do you want to do this cleanup in this JIRA, or address it separately in a follow-up?
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.
Let's do just the new two functions in this JIRA so we introduce the function.
Afterwards we can do a separate JIRA to replace all.
To get the method, one could do Thread.currentThread().getStackTrace()[index].getMethodName().
The index sometimes is tricky, but doable.
/** Parameter name. */ | ||
public static final String NAME = "namespacequota"; | ||
/** Default parameter value ({@link Long#MAX_VALUE}). */ | ||
// public static final String DEFAULT = String.valueOf(Long.MAX_VALUE); |
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.
Cleanup?
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.
Oops my bad.
...p-hdfs-client/src/main/java/org/apache/hadoop/hdfs/web/resources/StorageSpaceQuotaParam.java
Show resolved
Hide resolved
assertEquals(Long.valueOf(StorageSpaceQuotaParam.DEFAULT), | ||
sp.getValue()); | ||
sp = new StorageSpaceQuotaParam(100L); | ||
assertEquals(new Long(100), sp.getValue()); |
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.
Can we use "assertEquals(100L,"?
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.
webHdfs.setQuota(path, -100, 100); | ||
fail("Should have thrown exception"); | ||
} catch (IllegalArgumentException e) { | ||
assertTrue(e.getMessage().contains("Invalid values for quota")); |
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 would use LambdaTestUtils.intercept for all 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.
Thanks. I was searching for this but forgot what it is called. Will replace.
💔 -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. |
Hmm. Seems something wrong with Yetus? most of the tests failed with:
|
💔 -1 overall
This message was automatically generated. |
@@ -49,7 +51,7 @@ | |||
@Test | |||
public void testAccessTimeParam() { | |||
final AccessTimeParam p = new AccessTimeParam(AccessTimeParam.DEFAULT); | |||
Assert.assertEquals(-1L, p.getValue().longValue()); | |||
assertEquals(-1L, p.getValue().longValue()); |
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.
To avoid so much churn, let's just do the assertEquals in the new methods and leave this alone for the rest for now.
we can do a followup JIRA for that if so.
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.
Sure. Will revert the unrelated changes in this class.
💔 -1 overall
This message was automatically generated. |
- Added a helper method for unsupported methods in FileSystem - Revert unrelated changes in TestParams
💔 -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. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
No description provided.