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

Yiqun Lin commented on HDFS-13811:
----------------------------------

[~LiJinglun], following change of the unit test can also rollback. Would you 
mind rollbacking this? Others looks good to me.

{noformat}
 
+  /**
+   * Test {@link RouterQuotaUpdateService#periodicInvoke()} updates quota usage
+   * in RouterQuotaManager.
+   */
   @Test
   public void testQuotaUpdating() throws Exception {
     long nsQuota = 30;
@@ -498,15 +504,14 @@ public void testQuotaUpdating() throws Exception {
         .spaceQuota(ssQuota).build());
     addMountTable(mountTable);
 
-    // Call periodicInvoke to ensure quota  updated in quota manager
-    // and state store.
-    RouterQuotaUpdateService updateService = routerContext.getRouter()
-        .getQuotaCacheUpdateService();
+    // Call periodicInvoke to ensure quota  updated in quota manager.
+    Router router = routerContext.getRouter();
+    RouterQuotaUpdateService updateService =
+        router.getQuotaCacheUpdateService();
     updateService.periodicInvoke();
 
     // verify initial quota value
-    MountTable updatedMountTable = getMountTable(path);
-    RouterQuotaUsage quota = updatedMountTable.getQuota();
+    RouterQuotaUsage quota = router.getQuotaManager().getQuotaUsage(path);
     assertEquals(nsQuota, quota.getQuota());
     assertEquals(ssQuota, quota.getSpaceQuota());
     assertEquals(1, quota.getFileAndDirectoryCount());
@@ -520,17 +525,16 @@ public void testQuotaUpdating() throws Exception {
     appendData(path + "/file", routerClient, BLOCK_SIZE);
 
     updateService.periodicInvoke();
-    updatedMountTable = getMountTable(path);
-    quota = updatedMountTable.getQuota();
+    quota = router.getQuotaManager().getQuotaUsage(path);
 
-    // verify if quota has been updated in state store
+    // verify if quota usage has been updated in RouterQuotaManager.
     assertEquals(nsQuota, quota.getQuota());
     assertEquals(ssQuota, quota.getSpaceQuota());
     assertEquals(3, quota.getFileAndDirectoryCount());
     assertEquals(BLOCK_SIZE, quota.getSpaceConsumed());
 
     // verify quota sync on adding new destination to mount entry.
-    updatedMountTable = getMountTable(path);
+    MountTable updatedMountTable = getMountTable(path);
{noformat}
 

> RBF: Race condition between router admin quota update and periodic quota 
> update service
> ---------------------------------------------------------------------------------------
>
>                 Key: HDFS-13811
>                 URL: https://issues.apache.org/jira/browse/HDFS-13811
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Dibyendu Karmakar
>            Assignee: Jinglun
>            Priority: Major
>         Attachments: HDFS-13811-000.patch, HDFS-13811-HDFS-13891-000.patch, 
> HDFS-13811.001.patch, HDFS-13811.002.patch, HDFS-13811.003.patch, 
> HDFS-13811.004.patch, HDFS-13811.005.patch, HDFS-13811.006.patch
>
>
> If we try to update quota of an existing mount entry and at the same time 
> periodic quota update service is running on the same mount entry, it is 
> leading the mount table to _inconsistent state._
> Here transactions are:
> A - Quota update service is fetching mount table entries.
> B - Quota update service is updating the mount table with current usage.
> A' - User is trying to update quota using admin cmd.
> and the transaction sequence is [ A A' B ]
> quota update service is updating the mount table with old quota value.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to