[jira] [Comment Edited] (HDFS-13307) RBF: Fix setQuota bug

2018-03-19 Thread liuhongtong (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-13307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16405857#comment-16405857
 ] 

liuhongtong edited comment on HDFS-13307 at 3/20/18 6:14 AM:
-

[~linyiqun] Follow your advice, I have updated patch.
[~ajayydv] There is no need to add new test case, since 
TestRouterAdminCLI#testSetAndClearQuota is very appropriate.


was (Author: liuhongtong):
[~linyiqun] Follow your advice, I have update patch.
[~ajayydv] There is no need to add new test case, since 
TestRouterAdminCLI#testSetAndClearQuota is very appropriate.

> RBF: Fix setQuota bug
> -
>
> Key: HDFS-13307
> URL: https://issues.apache.org/jira/browse/HDFS-13307
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>Reporter: liuhongtong
>Assignee: liuhongtong
>Priority: Major
> Attachments: HDFS-13307.001.patch, HDFS-13307.002.patch
>
>
> If hdfs dfsrouteradmin -setQuota only set one of -nsQuota and -ssQuota, the 
> another one will be cleared.
> The following is the step:
> 1. set /test1 -nsQuota 400 -ssQuota 200
> hdfs dfsrouteradmin -setQuota /test1 -nsQuota 400 -ssQuota 200
> Successfully set quota for mount point /test1
> 2. after a moment, list /test1, everything is ok.
> hdfs dfsrouteradmin -ls /test1
> SourceDestinations  Owner 
> Group Mode  Quota/Usage  
> /test1ns1->/test1   hadp  
> hadp  rwxr-xr-x [NsQuota: 400/0, SsQuota: 
> 200 B/0 B]
> 3. only set /test1 -nsQuota 600
> hdfs dfsrouteradmin -setQuota /test1 -nsQuota 600
> Successfully set quota for mount point /test1
> 4.  after a moment, list /test1, now ssQuota has been cleared.
> hdfs dfsrouteradmin -ls /test1
> SourceDestinations  Owner 
> Group Mode  Quota/Usage  
> /test1ns1->/test1   hadp  
> hadp  rwxr-xr-x [NsQuota: 600/0, SsQuota: 
> -/-]
>  [^HDFS-13307.001.patch] 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org



[jira] [Comment Edited] (HDFS-13307) RBF: Fix setQuota bug

2018-03-20 Thread liuhongtong (JIRA)

[ 
https://issues.apache.org/jira/browse/HDFS-13307?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16406010#comment-16406010
 ] 

liuhongtong edited comment on HDFS-13307 at 3/20/18 9:35 AM:
-

[~linyiqun] 
 If setQuota() throws Exception, run() will catch it, print out the error 
message and return error return code -1. The following is just an example.
{code:java}
$ hdfs dfsrouteradmin -setQuota /test10 -nsQuota aaa --ssQuota 200
setQuota: Cannot parse nsQuota: aaa
Federation Admin Tools:
[-add[-readonly] -owner  -group 
 -mode ]
[-rm ]
[-ls ]
[-setQuota  -nsQuota  -ssQuota ]
[-clrQuota ]
[-safemode enter | leave | get]
$ echo $?
255
{code}
If as your advice, setQuota() print error message and return false, but the 
caller run() ignores false return and return 0.
 If we want to deal with all false return from every command, not only 
setQuota, we must modify all branches, while these are tedious.
{code:java}
..
if (setQuota(argv, i)) {
System.out.println(
"Successfully set quota for mount point " + argv[i]);
+ } else {
+ exitCode = -1;
}
} else if ("-clrQuota".equals(cmd)) {
if (clrQuota(argv[i])) {
System.out.println(
"Successfully clear quota for mount point " + argv[i]);
+ } else {
+ exitCode = -1;
}
} else if ("-safemode".equals(cmd)) {
manageSafeMode(argv[i]);
..
{code}

 So I think throwing Exception may be more reasonable.


was (Author: liuhongtong):
[~linyiqun] 
If setQuota() throws Exception, run() will catch it, print out the error 
message and return error return code -1. The following is just an example.
```shell
$ hdfs dfsrouteradmin -setQuota /test10 -nsQuota aaa --ssQuota 200
setQuota: Cannot parse nsQuota: aaa
Federation Admin Tools:
[-add[-readonly] -owner  
-group  -mode ]
[-rm ]
[-ls ]
[-setQuota  -nsQuota  -ssQuota ]
[-clrQuota ]
[-safemode enter | leave | get]
$ echo $?
255
```

If as your advice, setQuota() print error message and return false, but the 
caller run() ignores false return and return 0.
If we want to deal with all false return from every command, not only setQuota, 
we must modify all branches, while these are tedious.
```java
..
} else if ("-setQuota".equals(cmd)) {
if (setQuota(argv, i)) {
  System.out.println(
  "Successfully set quota for mount point " + argv[i]);
+   } else {
+ exitCode = -1;
 }

  } else if ("-clrQuota".equals(cmd)) {
if (clrQuota(argv[i])) {
  System.out.println(
  "Successfully clear quota for mount point " + argv[i]);
+   } else {
+ exitCode = -1;
}
  } else if ("-safemode".equals(cmd)) {
..
```
So I think throwing Exception may be more reasonable. 

> RBF: Fix setQuota bug
> -
>
> Key: HDFS-13307
> URL: https://issues.apache.org/jira/browse/HDFS-13307
> Project: Hadoop HDFS
>  Issue Type: Sub-task
>Reporter: liuhongtong
>Assignee: liuhongtong
>Priority: Major
> Attachments: HDFS-13307.001.patch, HDFS-13307.002.patch, 
> HDFS-13307.003.patch
>
>
> If hdfs dfsrouteradmin -setQuota only set one of -nsQuota and -ssQuota, the 
> another one will be cleared.
> The following is the step:
> 1. set /test1 -nsQuota 400 -ssQuota 200
> hdfs dfsrouteradmin -setQuota /test1 -nsQuota 400 -ssQuota 200
> Successfully set quota for mount point /test1
> 2. after a moment, list /test1, everything is ok.
> hdfs dfsrouteradmin -ls /test1
> SourceDestinations  Owner 
> Group Mode  Quota/Usage  
> /test1ns1->/test1   hadp  
> hadp  rwxr-xr-x [NsQuota: 400/0, SsQuota: 
> 200 B/0 B]
> 3. only set /test1 -nsQuota 600
> hdfs dfsrouteradmin -setQuota /test1 -nsQuota 600
> Successfully set quota for mount point /test1
> 4.  after a moment, list /test1, now ssQuota has been cleared.
> hdfs dfsrouteradmin -ls /test1
> SourceDestinations  Owner 
> Group Mode  Quota/Usage  
> /test1ns1->/test1   hadp  
> hadp  rwxr-xr-x [NsQuota: 600/0, SsQuota: 
> -/-]
>  [^HDFS-13307.001.patch] 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

-
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org