hadoop-hdfs-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uma Maheswara Rao G (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HDFS-1690) Name Node should not process format command while it is running.
Date Thu, 09 Jun 2011 05:28:58 GMT

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

Uma Maheswara Rao G commented on HDFS-1690:
-------------------------------------------

Thanks for your comments & sorry for the late reply.

 Lock file will be deleted for normal exiting of system ( kill <pid>)
 Lock file will not be deleted only for abrupt killing ( kill -9 <pid>)

Below is from deleteOnExit() docs
   * Deletion will be attempted only for normal termination of the 
   * virtual machine, as defined by the Java Language Specification.


Why NN format command is deleting the in_use.lock file?
Since hdfs format command will execute in separate JVM, it will add lock file into DeleteOnExitHook.

 {code}
  FileLock tryLock() throws IOException {
      File lockF = new File(root, STORAGE_FILE_LOCK);
      lockF.deleteOnExit();
      …………
 {code}

As we know, Once format command completed,that particular JVM will exit. On exit of that
JVM, this Hook will try to delete the files which are added to that DeleteOnExitHook. In Linux,
we can delete the file even if other process using that. Delete api will return true in this
case.

 I did the same Test in windows, Here we can not delete that lock file when other process
using it. Just delete api will return false in this case.

My proposal would be, 
1)	if in_use.lock not present then we can allow for formatting.
2)	If in_use.lock present, then we need to check for lock.
         If it is allowing to take lock then we can allow formatting.
         If it is not allowing to take lock then we should not allow for format.

Please let me know your opinion.

> Name Node should not process format command while it is running.
> ----------------------------------------------------------------
>
>                 Key: HDFS-1690
>                 URL: https://issues.apache.org/jira/browse/HDFS-1690
>             Project: Hadoop HDFS
>          Issue Type: Bug
>          Components: name-node
>    Affects Versions: 0.20.1, 0.20.2, 0.21.0
>            Reporter: Uma Maheswara Rao G
>            Assignee: Uma Maheswara Rao G
>         Attachments: HDFS-1690.patch
>
>
> Currently NameNode allows format command while it running. In this case the command is
executed partially (Lock file is deleted) and an exception thrown. Because of this Name Node
should be formatted after restart. This sort of cases can happen accidentally. To prevent
such cases Name Node should not execute the format command partially while it is running.
It can stright away throw exception/log saying, Name Node is running.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message