hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject hadoop git commit: HDFS-12076. Ozone: Review all cases where we are returning FAILED_INTERNAL_ERROR. Contributed by Chen Liang.
Date Thu, 06 Jul 2017 05:30:41 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 2959102b1 -> 4d3993bb9


HDFS-12076. Ozone: Review all cases where we are returning FAILED_INTERNAL_ERROR. Contributed
by Chen Liang.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4d3993bb
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4d3993bb
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4d3993bb

Branch: refs/heads/HDFS-7240
Commit: 4d3993bb9b402022166ee495197987e914c8c766
Parents: 2959102
Author: Anu Engineer <aengineer@apache.org>
Authored: Wed Jul 5 22:26:20 2017 -0700
Committer: Anu Engineer <aengineer@apache.org>
Committed: Wed Jul 5 22:26:20 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java  | 10 +++++-----
 .../org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java  |  4 ++--
 .../apache/hadoop/ozone/ksm/exceptions/KSMException.java  |  3 +++
 3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d3993bb/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java
index aa7ea5a..d12bef1 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/KeyManagerImpl.java
@@ -108,11 +108,11 @@ public class KeyManagerImpl implements KeyManager {
       LOG.debug("Key {} allocated in volume {} bucket {}",
           keyName, volumeName, bucketName);
       return keyBlock;
-    } catch (Exception ex) {
+    } catch (IOException ex) {
       LOG.error("Key allocation failed for volume:{} bucket:{} key:{}",
           volumeName, bucketName, keyName, ex);
       throw new KSMException(ex.getMessage(),
-          KSMException.ResultCodes.FAILED_INTERNAL_ERROR);
+          KSMException.ResultCodes.FAILED_KEY_ALLOCATION);
     } finally {
       metadataManager.writeLock().unlock();
     }
@@ -160,7 +160,7 @@ public class KeyManagerImpl implements KeyManager {
               Collections.singleton(keyInfo.getBlockID()));
       if (resultList.size() != 1) {
         throw new KSMException("Delete result size from SCM is wrong",
-            ResultCodes.FAILED_INTERNAL_ERROR);
+            ResultCodes.FAILED_KEY_DELETION);
       }
 
       if (resultList.get(0).getResult() == Result.success) {
@@ -169,13 +169,13 @@ public class KeyManagerImpl implements KeyManager {
         metadataManager.deleteKey(objectKey);
       } else {
         throw new KSMException("Cannot delete key from SCM",
-                ResultCodes.FAILED_INTERNAL_ERROR);
+                ResultCodes.FAILED_KEY_DELETION);
       }
     } catch (DBException ex) {
       LOG.error(String.format("Delete key failed for volume:%s "
           + "bucket:%s key:%s", volumeName, bucketName, keyName), ex);
       throw new KSMException(ex.getMessage(), ex,
-          ResultCodes.FAILED_INTERNAL_ERROR);
+          ResultCodes.FAILED_KEY_DELETION);
     } finally {
       metadataManager.writeLock().unlock();
     }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d3993bb/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java
index b676c2d..d998de4 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/MetadataManagerImpl.java
@@ -391,7 +391,7 @@ public class MetadataManagerImpl implements  MetadataManager {
           // this probably means ksm db is corrupted or some entries are
           // accidentally removed.
           throw new KSMException("Volume info not found for " + volumeName,
-              ResultCodes.FAILED_INTERNAL_ERROR);
+              ResultCodes.FAILED_VOLUME_NOT_FOUND);
         }
         VolumeInfo info = VolumeInfo.parseFrom(volumeInfo);
         KsmVolumeArgs volumeArgs = KsmVolumeArgs.getFromProtobuf(info);
@@ -421,7 +421,7 @@ public class MetadataManagerImpl implements  MetadataManager {
     } catch (InvalidProtocolBufferException e) {
       throw new KSMException("Unable to get volumes info by the given user, "
           + "metadata might be corrupted",
-          e, ResultCodes.FAILED_INTERNAL_ERROR);
+          e, ResultCodes.FAILED_METADATA_ERROR);
     }
     return volumes;
   }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/4d3993bb/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/exceptions/KSMException.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/exceptions/KSMException.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/exceptions/KSMException.java
index 2f67d99..c27104b 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/exceptions/KSMException.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/exceptions/KSMException.java
@@ -106,6 +106,9 @@ public class KSMException extends IOException {
     FAILED_BUCKET_NOT_EMPTY,
     FAILED_KEY_ALREADY_EXISTS,
     FAILED_KEY_NOT_FOUND,
+    FAILED_KEY_ALLOCATION,
+    FAILED_KEY_DELETION,
+    FAILED_METADATA_ERROR,
     FAILED_INTERNAL_ERROR
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message