Issue Details (XML | Word | Printable)

Key: HADOOP-4935
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Konstantin Shvachko
Reporter: Hairong Kuang
Votes: 0
Watchers: 2
Operations

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

Manual leaving of safe mode may lead to data lost

Created: 23/Dec/08 06:44 PM   Updated: 08/Jul/09 04:43 PM
Return to search
Component/s: None
Affects Version/s: 0.18.3
Fix Version/s: 0.18.3

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works misReplBlocks-0-18.patch 2008-12-24 12:21 AM Konstantin Shvachko 0.6 kB
Text File Licensed for inclusion in ASF works misReplBlocks.patch 2008-12-24 12:05 AM Konstantin Shvachko 0.7 kB

Hadoop Flags: Reviewed
Resolution Date: 31/Dec/08 01:17 AM


 Description  « Hide
Due to HADOOP-4610, NameNode calculates mis-replicated blocks when leaving safe mode manually, where it clears the pending deletion queue before it does the calculation. This works fine when NameNode just starts but introduced a bug when NameNode is running for a while. Clearing the pending deletion queue makes NameNode not able to distinguish valid replicas from invalid ones, ie, the ones that have scheduled or dispatched for deletion. Therefore, NameNode may mistakenly decide the block is over-replicated and choose all valid ones to delete.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Konstantin Shvachko added a comment - 24/Dec/08 12:00 AM
By "pending deletion queue" you mean excessReplicateMap I believe.
This happens when data-nodes are flaky or busy and name-node looses them and replicates blocks to other nodes, but the old data-nodes come back and report extra (old) replicas for blocks that have already been re-replicated.
Thus the block becomes over-replicated and therefore is placed into excessReplicateMap.
The data-nodes delete excessive replicas, but before the deletion is reported back to the name-node the latter calls processMisReplicatedBlocks() which clears excessReplicateMap in an attempt to restore it from scratch.
The error is that after clearing excessReplicateMap all replicas become valid from the name-node point of view although some of them have already been deleted by data-nodes. So if there were 6 replicas of the same block and before processMisReplicatedBlocks() first three were deleted, then after processMisReplicatedBlocks() clears excessReplicateMap the other three can be also removed and there will be no more replicas of the block.

Konstantin Shvachko added a comment - 24/Dec/08 12:05 AM
This fixes the problem.
I tried to make a unit test, but it is really hard to make it deterministic.

Konstantin Shvachko made changes - 24/Dec/08 12:05 AM
Field Original Value New Value
Attachment misReplBlocks.patch [ 12396705 ]
Konstantin Shvachko added a comment - 24/Dec/08 12:21 AM
This is the patch for 0.18 branch.
I tested it manually. I reproduced the error with current code and verified this is not happening with the patch.

Konstantin Shvachko made changes - 24/Dec/08 12:21 AM
Attachment misReplBlocks-0-18.patch [ 12396706 ]
Konstantin Shvachko made changes - 24/Dec/08 12:22 AM
Status Open [ 1 ] Patch Available [ 10002 ]
Tsz Wo (Nicholas), SZE added a comment - 30/Dec/08 08:45 PM
ant test-patch results:
     [exec] -1 overall.  
     [exec] 
     [exec]     +1 @author.  The patch does not contain any @author tags.
     [exec] 
     [exec]     -1 tests included.  The patch doesn't appear to include any new or modified tests.
     [exec]                         Please justify why no tests are needed for this patch.
     [exec] 
     [exec]     +1 javadoc.  The javadoc tool did not generate any warning messages.
     [exec] 
     [exec]     +1 javac.  The applied patch does not increase the total number of javac compiler warnings.
     [exec] 
     [exec]     +1 findbugs.  The patch does not introduce any new Findbugs warnings.
     [exec] 
     [exec]     +1 Eclipse classpath. The patch retains Eclipse classpath integrity.

Suresh Srinivas added a comment - 30/Dec/08 09:40 PM
+1 patch looks good

Konstantin Shvachko added a comment - 31/Dec/08 12:33 AM
All tests except TestMapReduceLocal passed.

Repository Revision Date User Message
ASF #730277 Wed Dec 31 00:37:10 UTC 2008 shv HADOOP-4935. processMisReplicatedBlocks() should not clear excessReplicateMap. Contributed by Konstantin Shvachko.
Files Changed
MODIFY /hadoop/core/trunk/CHANGES.txt
MODIFY /hadoop/core/trunk/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Repository Revision Date User Message
ASF #730278 Wed Dec 31 00:46:00 UTC 2008 shv HADOOP-4935. Merge -r 730276:730277 from trunk to branch 0.20.
Files Changed
MODIFY /hadoop/core/branches/branch-0.20/CHANGES.txt
MODIFY /hadoop/core/branches/branch-0.20/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java

Repository Revision Date User Message
ASF #730288 Wed Dec 31 01:06:15 UTC 2008 shv HADOOP-4935. Merge -r 730276:730277 from trunk to branch 0.19.
Files Changed
MODIFY /hadoop/core/branches/branch-0.19/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSNamesystem.java
MODIFY /hadoop/core/branches/branch-0.19/CHANGES.txt

Repository Revision Date User Message
ASF #730289 Wed Dec 31 01:15:19 UTC 2008 shv HADOOP-4935. Merge -r 730276:730277 from trunk to branch 0.18.
Files Changed
MODIFY /hadoop/core/branches/branch-0.18/src/hdfs/org/apache/hadoop/dfs/FSNamesystem.java
MODIFY /hadoop/core/branches/branch-0.18/CHANGES.txt

Konstantin Shvachko added a comment - 31/Dec/08 01:17 AM
I just committed this.

Konstantin Shvachko made changes - 31/Dec/08 01:17 AM
Resolution Fixed [ 1 ]
Hadoop Flags [Reviewed]
Status Patch Available [ 10002 ] Resolved [ 5 ]
Nigel Daley made changes - 30/Jan/09 08:14 PM
Status Resolved [ 5 ] Closed [ 6 ]
Owen O'Malley made changes - 08/Jul/09 04:43 PM
Component/s dfs [ 12310710 ]