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

Yiqun Lin commented on HDFS-13528:
----------------------------------

Thanks for attach the patch, [~dibyendu_hadoop]!
 The patch almost looks great, some comments for the UT:

*TestRouterQuota#testQuotaRefreshAfterQuotaExceed*
{code:java}
    boolean isNsQuotaViolated = false;
    try {
      // create new directory to trigger NSQuotaExceededException
      routerFs.mkdirs(new Path("/testdir11/" + UUID.randomUUID()));
    } catch (NSQuotaExceededException e) {
      isNsQuotaViolated = true;
    }
    assertTrue(isNsQuotaViolated);
{code}
This lines can be simplified as following:
{code:java}
    try {
      // create new directory to trigger NSQuotaExceededException
      routerFs.mkdirs(new Path("/testdir11/" + UUID.randomUUID()));
      fail("Mkdir should be failed under dir testdir11.")
    } catch (NSQuotaExceededException ignored) {
    }
{code}
*TestRouterQuota#testQuotaRefreshWhenDestinationNotPresent*
 1. Looks like we don't need to create three mount tables, two is enough. One 
is used for deleting dir, and verify if other one is updated as expected.
 2. Following getting logic looks a little tricky.
{code:java}
 // Get quota details in mount table
    List<MountTable> results = getMountTable("/");
    MountTable updatedMountTable = !results.isEmpty() ? results.get(0) : null;
    RouterQuotaUsage mountQuota1 = updatedMountTable.getQuota();
    updatedMountTable = (!results.isEmpty() && results.size() >= 2) ?
        results.get(1) : null;
    RouterQuotaUsage mountQuota2 = updatedMountTable.getQuota();
    updatedMountTable = (!results.isEmpty() && results.size() >= 3) ?
        results.get(2) : null;
    RouterQuotaUsage mountQuota3 = updatedMountTable.getQuota();
{code}
I suggest we can do the minor change for {{getMountTable}} to let it returns 
first mount entry.
{code:java}
  private MountTable getMountTable(String path) throws IOException {
    ...
    List<MountTable> results = response.getEntries();
    return !results.isEmpty() ? results.get(0) : null;
  }
{code}
Then we pass explicit path to get corresponding mount table.

Please also fix these three whitespaces:
{noformat}
./hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java:484:
    // Create directory to make directory count equals to nsQuota  
./hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java:594:
 
./hadoop-hdfs-project/hadoop-hdfs-rbf/src/test/java/org/apache/hadoop/hdfs/server/federation/router/TestRouterQuota.java:665:
    // If destination is not present the quota usage should be reset to 0 
{noformat}

> RBF: If a directory exceeds quota limit then quota usage is not refreshed for 
> other mount entries 
> --------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-13528
>                 URL: https://issues.apache.org/jira/browse/HDFS-13528
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Dibyendu Karmakar
>            Assignee: Dibyendu Karmakar
>            Priority: Major
>         Attachments: HDFS-13528-000.patch
>
>
> If quota limit is exceeded, RouterQuotaUpdateService#periodicInvoke is 
> getting QuotaExceededException and it is not updating the quota usage for 
> rest of the mount table entries.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to