hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject svn commit: r823737 - in /hadoop/hdfs/branches/branch-0.21: ./ src/java/org/apache/hadoop/hdfs/server/datanode/ src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/
Date Fri, 09 Oct 2009 23:16:48 GMT
Author: shv
Date: Fri Oct  9 23:16:47 2009
New Revision: 823737

URL: http://svn.apache.org/viewvc?rev=823737&view=rev
Log:
HDFS-676. Merge -r 823731:823732 from trunk to branch-0.21.

Modified:
    hadoop/hdfs/branches/branch-0.21/CHANGES.txt
    hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
    hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
    hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java

Modified: hadoop/hdfs/branches/branch-0.21/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/CHANGES.txt?rev=823737&r1=823736&r2=823737&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/hdfs/branches/branch-0.21/CHANGES.txt Fri Oct  9 23:16:47 2009
@@ -370,6 +370,8 @@
 
     HDFS-665. TestFileAppend2 sometimes hangs. (hairong)
 
+    HDFS-676. Fix NPE in FSDataset.updateReplicaUnderRecovery() (shv)
+
 Release 0.20.1 - 2009-09-01
 
   IMPROVEMENTS

Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java?rev=823737&r1=823736&r2=823737&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDataset.java
Fri Oct  9 23:16:47 2009
@@ -1982,19 +1982,21 @@
     return rur.createInfo();
   }
 
-  /** Update a replica of a block. */
-  synchronized void updateReplica(final Block block, final long recoveryId,
-      final long newlength) throws IOException {
+  @Override // FSDatasetInterface
+  public synchronized ReplicaInfo updateReplicaUnderRecovery(
+                                    final Block oldBlock,
+                                    final long recoveryId,
+                                    final long newlength) throws IOException {
     //get replica
-    final ReplicaInfo replica = volumeMap.get(block.getBlockId());
-    DataNode.LOG.info("updateReplica: block=" + block
+    final ReplicaInfo replica = volumeMap.get(oldBlock.getBlockId());
+    DataNode.LOG.info("updateReplica: block=" + oldBlock
         + ", recoveryId=" + recoveryId
         + ", length=" + newlength
         + ", replica=" + replica);
 
     //check replica
     if (replica == null) {
-      throw new ReplicaNotFoundException(block);
+      throw new ReplicaNotFoundException(oldBlock);
     }
 
     //check replica state
@@ -2007,26 +2009,18 @@
     checkReplicaFiles(replica);
 
     //update replica
-    final ReplicaInfo finalized = (ReplicaInfo)updateReplicaUnderRecovery(
-                                    replica, recoveryId, newlength);
+    final FinalizedReplica finalized = updateReplicaUnderRecovery(
+        (ReplicaUnderRecovery)replica, recoveryId, newlength);
 
     //check replica files after update
     checkReplicaFiles(finalized);
+    return finalized;
   }
 
-  @Override // FSDatasetInterface
-  public synchronized FinalizedReplica updateReplicaUnderRecovery(
-                                          Block oldBlock,
+  private FinalizedReplica updateReplicaUnderRecovery(
+                                          ReplicaUnderRecovery rur,
                                           long recoveryId,
                                           long newlength) throws IOException {
-    Replica r = getReplica(oldBlock.getBlockId());
-    if(r.getState() != ReplicaState.RUR)
-      throw new IOException("Replica " + r + " must be under recovery.");
-    ReplicaUnderRecovery rur = (ReplicaUnderRecovery)r;
-    DataNode.LOG.info("updateReplicaUnderRecovery: recoveryId=" + recoveryId
-        + ", newlength=" + newlength
-        + ", rur=" + rur);
-
     //check recovery id
     if (rur.getRecoveryID() != recoveryId) {
       throw new IOException("rur.getRecoveryID() != recoveryId = " + recoveryId

Modified: hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java?rev=823737&r1=823736&r2=823737&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/java/org/apache/hadoop/hdfs/server/datanode/FSDatasetInterface.java
Fri Oct  9 23:16:47 2009
@@ -350,7 +350,8 @@
   /**
    * Update replica's generation stamp and length and finalize it.
    */
-  public FinalizedReplica updateReplicaUnderRecovery(Block oldBlock,
+  public ReplicaInfo updateReplicaUnderRecovery(
+                                          Block oldBlock,
                                           long recoveryId,
                                           long newLength) throws IOException;
 }

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java?rev=823737&r1=823736&r2=823737&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/SimulatedFSDataset.java
Fri Oct  9 23:16:47 2009
@@ -804,10 +804,10 @@
     return new ReplicaRecoveryInfo(rBlock.getBlock(), ReplicaState.FINALIZED);
   }
 
-  @Override
+  @Override // FSDatasetInterface
   public FinalizedReplica updateReplicaUnderRecovery(Block oldBlock,
-                                          long recoveryId,
-                                          long newlength) throws IOException {
+                                        long recoveryId,
+                                        long newlength) throws IOException {
     return new FinalizedReplica(
         oldBlock.getBlockId(), newlength, recoveryId, null, null);
   }

Modified: hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java?rev=823737&r1=823736&r2=823737&view=diff
==============================================================================
--- hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java
(original)
+++ hadoop/hdfs/branches/branch-0.21/src/test/hdfs/org/apache/hadoop/hdfs/server/datanode/TestInterDatanodeProtocol.java
Fri Oct  9 23:16:47 2009
@@ -234,9 +234,8 @@
       FSDataset.checkReplicaFiles(rur);
 
       //update
-      final ReplicaInfo finalized = 
-        (ReplicaInfo)fsdataset.updateReplicaUnderRecovery(
-            rur, recoveryid, newlength);
+      final ReplicaInfo finalized = fsdataset.updateReplicaUnderRecovery(
+                                                rur, recoveryid, newlength);
 
       //check meta data after update
       FSDataset.checkReplicaFiles(finalized);



Mime
View raw message