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

Mingliang Liu commented on HDFS-9498:
-------------------------------------

Thanks for the further discussion.

I should wrote my last comment like this:
{quote}
Suppose the NN is in manual safe mode *and there is no blocks with future GS*, 
blockManager.leaveSafeMode(force) will not be able to start the secret manager 
*by calling {{startSecretManagerIfNecessary()}}*.
{quote}
The reason is that, in {{startSecretManagerIfNecessary()}}, it will check the 
{{isInSafeMode()}} first. This will fail because the manual safe mode is not 
reset yet. So after we clear the manual and resource low safe mode, we may need 
call startSecretManagerIfNecessary again.
{code}
+      if (blockManager.leaveSafeMode(force)) { // block manager will not start 
secret manager successfully in case of manual safe mode
+        setManualAndResourceLowSafeMode(false, false);
+        startSecretManagerIfNecessary(); // call it again after we clear 
manual and resource low safe mode.
+      }
{code}

For cases when block manager fails to leave safe mode because of future blocks, 
the code is fine without calling {{startSecretManagerIfNecessary}} as it will 
fail to start secret manager anyway.

You're right the {{startSecretManagerIfNecessary}} is now protected by NS lock 
in all callers. Perhaps adding an assertion {{assert hasWriteLock()}} will be 
helpful to keep it being mi-used?

> Move code that tracks orphan blocks to BlockManagerSafeMode
> -----------------------------------------------------------
>
>                 Key: HDFS-9498
>                 URL: https://issues.apache.org/jira/browse/HDFS-9498
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>          Components: namenode
>            Reporter: Mingliang Liu
>            Assignee: Mingliang Liu
>         Attachments: HDFS-9498.000.patch, HDFS-9498.001.patch, 
> HDFS-9498.002.patch, HDFS-9498.003.patch
>
>
> [HDFS-4015] counts and reports orphaned blocks  
> {{numberOfBytesInFutureBlocks}} in safe mode. It was implemented in 
> {{BlockManager}}. Per discussion in [HDFS-9129] which introduces the 
> {{BlockManagerSafeMode}}, we can move code that maintaining orphaned blocks 
> to this class.
> Leaving safe mode checks blocks with future GS in {{FSNamesystem}}. This code 
> can also be moved to {{BlockManagerSafeMode}}.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to