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

Konstantin Shvachko commented on HDFS-15099:
--------------------------------------------

This looks great, Chen, thanks. Minor things:
# We can rename {{isWrappedStandbyException()}} to 
{{shouldFailoverOnException()}} and implement it as
{code}
  private static boolean isWrappedStandbyException(Exception e) {
    if (!(e instanceof RemoteException)) {
      return false;
    }
    Exception unwrapped = ((RemoteException)e).unwrapRemoteException(
        ObserverRetryOnActiveException.class,
        StandbyException.class);
    return unwrapped instanceof ObserverRetryOnActiveException ||
        unwrapped instanceof StandbyException;
  }
{code}
Then you don't need to duplicate code for OROAE.
# Would be good to add a direct test for redirecting to active on aTime update. 
Like this:
{code}
@@ -74,15 +76,31 @@
   private static DistributedFileSystem dfs;
 
   private final Path testPath= new Path("/TestObserverNode");
+  private final static long SMALL_ACCESSTIME_PRECISION = 200;
 
   @BeforeClass
   public static void startUpCluster() throws Exception {
     conf = new Configuration();
     conf.setBoolean(DFS_NAMENODE_STATE_CONTEXT_ENABLED_KEY, true);
+    conf.setLong(DFS_NAMENODE_ACCESSTIME_PRECISION_KEY,
+        SMALL_ACCESSTIME_PRECISION);
     qjmhaCluster = HATestUtil.setUpObserverCluster(conf, 1, 0, true);
     dfsCluster = qjmhaCluster.getDfsCluster();
   }
 
+  @Test
+  public void testAccessTimeUpdateRedirectToActive() throws Exception {
+    dfs.create(testPath, (short)1).close();
+    assertSentTo(0);
+    dfs.open(testPath).close();
+    assertSentTo(2);
+
+    // Verify that aTime update redirects on Active
+    Thread.sleep(SMALL_ACCESSTIME_PRECISION + 1);
+    dfs.open(testPath).close();
+    assertSentTo(0);
+  }
+
{code}
# Calling {{setObserverRead(true)}} in the beginning of the test is redundant, 
it is already called by {{setUp()}}.

> [SBN Read] getBlockLocations() should throw ObserverRetryOnActiveException on 
> an attempt to change aTime on ObserverNode
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: HDFS-15099
>                 URL: https://issues.apache.org/jira/browse/HDFS-15099
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: namenode
>    Affects Versions: 2.10.0
>            Reporter: Konstantin Shvachko
>            Assignee: Chen Liang
>            Priority: Major
>         Attachments: HDFS-15099-branch-2.10.001.patch
>
>
> The precision of updating an INode's aTime while executing 
> {{getBlockLocations()}} is 1 hour by default. Updates cannot be handled by 
> ObserverNode, so the call should be redirected to Active NameNode. In order 
> to redirect to active the ObserverNode should through 
> {{ObserverRetryOnActiveException}}.



--
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