hadoop-hdfs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From szets...@apache.org
Subject svn commit: r1579671 - in /hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: ./ CHANGES.txt src/main/java/ src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
Date Thu, 20 Mar 2014 15:51:29 GMT
Author: szetszwo
Date: Thu Mar 20 15:51:28 2014
New Revision: 1579671

URL: http://svn.apache.org/r1579671
Log:
svn merge -c 1579670 from trunk for HDFS-6129.  When a replica is not found for deletion,
do not throw an exception.

Modified:
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/   (props changed)
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/   (props
changed)
    hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java

Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/
------------------------------------------------------------------------------
  Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1579670

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1579671&r1=1579670&r2=1579671&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Thu Mar 20
15:51:28 2014
@@ -180,6 +180,9 @@ Release 2.4.0 - UNRELEASED
     HDFS-6123. Do not log stack trace for ReplicaAlreadyExistsException and
     SocketTimeoutException.  (szetszwo)
 
+    HDFS-6129.  When a replica is not found for deletion, do not throw an
+    exception.  (szetszwo)
+
   OPTIMIZATIONS
 
     HDFS-5790. LeaseManager.findPath is very slow when many leases need recovery

Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
------------------------------------------------------------------------------
  Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1579670

Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java?rev=1579671&r1=1579670&r2=1579671&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
(original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/fsdataset/impl/FsDatasetImpl.java
Thu Mar 20 15:51:28 2014
@@ -1152,43 +1152,39 @@ class FsDatasetImpl implements FsDataset
    */
   @Override // FsDatasetSpi
   public void invalidate(String bpid, Block invalidBlks[]) throws IOException {
-    boolean error = false;
+    final List<String> errors = new ArrayList<String>();
     for (int i = 0; i < invalidBlks.length; i++) {
       final File f;
       final FsVolumeImpl v;
       synchronized (this) {
-        f = getFile(bpid, invalidBlks[i].getBlockId());
-        ReplicaInfo info = volumeMap.get(bpid, invalidBlks[i]);
+        final ReplicaInfo info = volumeMap.get(bpid, invalidBlks[i]);
         if (info == null) {
-          LOG.warn("Failed to delete replica " + invalidBlks[i]
+          // It is okay if the block is not found -- it may be deleted earlier.
+          LOG.info("Failed to delete replica " + invalidBlks[i]
               + ": ReplicaInfo not found.");
-          error = true;
           continue;
         }
         if (info.getGenerationStamp() != invalidBlks[i].getGenerationStamp()) {
-          LOG.warn("Failed to delete replica " + invalidBlks[i]
+          errors.add("Failed to delete replica " + invalidBlks[i]
               + ": GenerationStamp not matched, info=" + info);
-          error = true;
           continue;
         }
+        f = info.getBlockFile();
         v = (FsVolumeImpl)info.getVolume();
         if (f == null) {
-          LOG.warn("Failed to delete replica " + invalidBlks[i]
+          errors.add("Failed to delete replica " + invalidBlks[i]
               +  ": File not found, volume=" + v);
-          error = true;
           continue;
         }
         if (v == null) {
-          LOG.warn("Failed to delete replica " + invalidBlks[i]
-              +  ". No volume for this replica, file=" + f + ".");
-          error = true;
+          errors.add("Failed to delete replica " + invalidBlks[i]
+              +  ". No volume for this replica, file=" + f);
           continue;
         }
         File parent = f.getParentFile();
         if (parent == null) {
-          LOG.warn("Failed to delete replica " + invalidBlks[i]
-              +  ". Parent not found for file " + f + ".");
-          error = true;
+          errors.add("Failed to delete replica " + invalidBlks[i]
+              +  ". Parent not found for file " + f);
           continue;
         }
         ReplicaState replicaState = info.getState();
@@ -1210,8 +1206,14 @@ class FsDatasetImpl implements FsDataset
           new ExtendedBlock(bpid, invalidBlks[i]),
           dataStorage.getTrashDirectoryForBlockFile(bpid, f));
     }
-    if (error) {
-      throw new IOException("Error in deleting blocks.");
+    if (!errors.isEmpty()) {
+      StringBuilder b = new StringBuilder("Failed to delete ")
+        .append(errors.size()).append(" (out of ").append(invalidBlks.length)
+        .append(") replica(s):");
+      for(int i = 0; i < errors.size(); i++) {
+        b.append("\n").append(i).append(") ").append(errors.get(i));
+      }
+      throw new IOException(b.toString());
     }
   }
 



Mime
View raw message