Issue Details (XML | Word | Printable)

Key: HADOOP-4826
Type: New Feature New Feature
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Konstantin Shvachko
Reporter: Konstantin Shvachko
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Hadoop Common

Admin command saveNamespace.

Created: 10/Dec/08 08:42 PM   Updated: 08/Jul/09 04:43 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: 0.20.0

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works saveNamespace.patch 2008-12-12 08:31 AM Konstantin Shvachko 15 kB
Text File Licensed for inclusion in ASF works saveNamespace.patch 2008-12-11 08:46 PM Konstantin Shvachko 14 kB
Text File Licensed for inclusion in ASF works saveNamespace.patch 2008-12-10 08:49 PM Konstantin Shvachko 14 kB
Issue Links:
Reference
 

Hadoop Flags: Reviewed, Incompatible change
Release Note: Introduced new dfsadmin command saveNamespace to command the name service to do an immediate save of the file system image.
Resolution Date: 12/Dec/08 10:06 PM


 Description  « Hide
It would be useful to have an admin command that saves current namespace.
This command can be used before regular (planned) cluster shutdown.
The command will save the namespace into storage directory(s) and reset the name-node journal (edits file).
It will also reduce name-node startup time, because edits do not need to be digest.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Konstantin Shvachko added a comment - 10/Dec/08 08:49 PM
saveNamespace will save the namespace image directly to disk(s), it does not need to replay the journal.
Since saving the image is much faster than digesting the edits the command can substantially reduce the overall cluster restart time.

Recommended procedure for restarting the cluster:

  1. enter safe mode
  2. save namespace
  3. shutdown the cluster
  4. start the cluster

The patch introduces a new DFSAdmin command which is called using

hadoop dfsadmin -saveNamespace

As all other DFSAdmin commands it requires superuser permissions.
In addition, the name-node must be in safe mode, because we don't want to allow changing namespace during the save.
In order to enter safe mode call

hadoop dfsadmin -safemode enter

The patch also corrects 2 warnings in TestCheckpoint, and 2 Javadoc warnings in FSNamesystem.


Suresh Srinivas added a comment - 11/Dec/08 08:27 AM
  • In DistributedFileSystem.java, not sure why DFSClient is made a public member. The code compiles without it.
  • In DFSAdmin.refreshNodes, deprecated method fs.getName() can be replaced with fs.getUri();

Suresh Srinivas added a comment - 11/Dec/08 08:28 AM
Should we have a version of stopping the namenode gracefully, which automatically does the manual steps proposed in this change?

Konstantin Shvachko added a comment - 11/Dec/08 08:46 PM
Forgot to remove public after doing some testing. Change getName() to getURI(). This makes sense since I fixed 2 warnings anyway.
I was also thinking about a real shutdown command, don't think we should introduce it now.

Lohit Vijayarenu added a comment - 11/Dec/08 09:46 PM
This looks good. One minor comment if it would help. In the testcase, it would be good to create files, save namespace, stop namenode, start namenode and validate files.

Tsz Wo (Nicholas), SZE added a comment - 12/Dec/08 12:50 AM
  • Patch cannot be applied to trunk.
  • DFSClient.saveNamespace() should not be public.
  • Update ClientProtocol version
  • In the javadoc of FSNamesystem.saveNamespace(),
    • Change "superuser permission" to "superuser privilege"
    • Change "permission status is not superuser" to "current user is not a superuser"
  • Should update forrest doc.

Tsz Wo (Nicholas), SZE added a comment - 12/Dec/08 01:01 AM
> In addition, the name-node must be in safe mode, because we don't want to allow changing namespace during the save.

Safe mode may not be required since the namespace lock is acquired before saving images. Consider that saving images may take a long time, it makes sense to set safe mode.


Konstantin Shvachko added a comment - 12/Dec/08 08:31 AM - edited
  1. Merged with current trunk.
  2. Incorporated Lohit's comments.
  3. In addition made the test to verify that the edits file is not empty after adding a new file, but is empty after saving the namespace.
  4. incorporated Nicholas's comments.
  5. Also included unwrapping of the AccessControlException in DFSClient.
  6. I'd prefer to change documentation in a follow up issue.

Tsz Wo (Nicholas), SZE added a comment - 12/Dec/08 06:44 PM
+1 patch looks good. Below are the ant test-patch results.
     [exec] +1 overall.  

     [exec]     +1 @author.  The patch does not contain any @author tags.

     [exec]     +1 tests included.  The patch appears to include 3 new or modified tests.

     [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.

     [exec]     +1 javac.  The applied patch does not increase the total number of javac compiler warnings.

     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.

     [exec]     +1 Eclipse classpath. The patch retains Eclipse classpath integrity.

Konstantin Shvachko added a comment - 12/Dec/08 10:06 PM
I just committed this.
In general we do not promote new features to earlier releases.
But if there is a need to do that with this one let me know.

Tsz Wo (Nicholas), SZE added a comment - 12/Dec/08 10:20 PM
> In general we do not promote new features to earlier releases.
> But if there is a need to do that with this one let me know.

Even there is a need, we could not promote this to earlier releases since this is a incompatible change.


Robert Chansler added a comment - 03/Mar/09 06:39 PM
Edit release note for publication.

Tsz Wo (Nicholas), SZE added a comment - 16/Mar/09 05:40 PM
> 6. I'd prefer to change documentation in a follow up issue.

Hi Konstantin, please create a follow up issue if you haven't.