hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From na...@apache.org
Subject hadoop git commit: HDFS-11897. Ozone: KSM: Changing log level for client calls in KSM. Contributed by Shashikant Banerjee.
Date Fri, 22 Sep 2017 15:04:31 GMT
Repository: hadoop
Updated Branches:
  refs/heads/HDFS-7240 90f3fb618 -> 0880d5e98


HDFS-11897. Ozone: KSM: Changing log level for client calls in KSM. Contributed by Shashikant
Banerjee.


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

Branch: refs/heads/HDFS-7240
Commit: 0880d5e9857ff39a1ce0be513d2010aa44b37a7d
Parents: 90f3fb6
Author: Nandakumar <nanda@apache.org>
Authored: Fri Sep 22 20:33:17 2017 +0530
Committer: Nandakumar <nanda@apache.org>
Committed: Fri Sep 22 20:33:17 2017 +0530

----------------------------------------------------------------------
 .../hadoop/ozone/ksm/BucketManagerImpl.java     | 68 +++++++++++---------
 .../apache/hadoop/ozone/ksm/KeyManagerImpl.java | 25 +++----
 .../hadoop/ozone/ksm/VolumeManagerImpl.java     | 58 +++++++++++------
 3 files changed, 90 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/0880d5e9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java
index d0e8149..0aedf28 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/BucketManagerImpl.java
@@ -85,14 +85,14 @@ public class BucketManagerImpl implements BucketManager {
       byte[] bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
 
       //Check if the volume exists
-      if(metadataManager.get(volumeKey) == null) {
-        LOG.error("volume: {} not found ", volumeName);
+      if (metadataManager.get(volumeKey) == null) {
+        LOG.debug("volume: {} not found ", volumeName);
         throw new KSMException("Volume doesn't exist",
             KSMException.ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
       //Check if bucket already exists
-      if(metadataManager.get(bucketKey) != null) {
-        LOG.error("bucket: {} already exists ", bucketName);
+      if (metadataManager.get(bucketKey) != null) {
+        LOG.debug("bucket: {} already exists ", bucketName);
         throw new KSMException("Bucket already exist",
             KSMException.ResultCodes.FAILED_BUCKET_ALREADY_EXISTS);
       }
@@ -100,8 +100,10 @@ public class BucketManagerImpl implements BucketManager {
 
       LOG.debug("created bucket: {} in volume: {}", bucketName, volumeName);
     } catch (IOException | DBException ex) {
-      LOG.error("Bucket creation failed for bucket:{} in volume:{}",
-          bucketName, volumeName, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Bucket creation failed for bucket:{} in volume:{}",
+            bucketName, volumeName, ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();
@@ -123,16 +125,18 @@ public class BucketManagerImpl implements BucketManager {
     try {
       byte[] bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
       byte[] value = metadataManager.get(bucketKey);
-      if(value == null) {
-        LOG.error("bucket: {} not found in volume: {}.",
-            bucketName, volumeName);
+      if (value == null) {
+        LOG.debug("bucket: {} not found in volume: {}.", bucketName,
+            volumeName);
         throw new KSMException("Bucket not found",
             KSMException.ResultCodes.FAILED_BUCKET_NOT_FOUND);
       }
       return KsmBucketInfo.getFromProtobuf(BucketInfo.parseFrom(value));
     } catch (IOException | DBException ex) {
-      LOG.error("Exception while getting bucket info for bucket: {}",
-          bucketName, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Exception while getting bucket info for bucket: {}",
+            bucketName, ex);
+      }
       throw ex;
     } finally {
       metadataManager.readLock().unlock();
@@ -155,14 +159,14 @@ public class BucketManagerImpl implements BucketManager {
       //Check if volume exists
       if(metadataManager.get(metadataManager.getVolumeKey(volumeName)) ==
           null) {
-        LOG.error("volume: {} not found ", volumeName);
+        LOG.debug("volume: {} not found ", volumeName);
         throw new KSMException("Volume doesn't exist",
             KSMException.ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
       byte[] value = metadataManager.get(bucketKey);
       //Check if bucket exist
       if(value == null) {
-        LOG.error("bucket: {} not found ", bucketName);
+        LOG.debug("bucket: {} not found ", bucketName);
         throw new KSMException("Bucket doesn't exist",
             KSMException.ResultCodes.FAILED_BUCKET_NOT_FOUND);
       }
@@ -184,7 +188,7 @@ public class BucketManagerImpl implements BucketManager {
 
       //Check StorageType to update
       StorageType storageType = args.getStorageType();
-      if(storageType != null) {
+      if (storageType != null) {
         bucketInfoBuilder.setStorageType(storageType);
         LOG.debug("Updating bucket storage type for bucket: {} in volume: {}",
             bucketName, volumeName);
@@ -194,21 +198,23 @@ public class BucketManagerImpl implements BucketManager {
 
       //Check Versioning to update
       Boolean versioning = args.getIsVersionEnabled();
-      if(versioning != null) {
+      if (versioning != null) {
         bucketInfoBuilder.setIsVersionEnabled(versioning);
         LOG.debug("Updating bucket versioning for bucket: {} in volume: {}",
             bucketName, volumeName);
       } else {
-        bucketInfoBuilder.setIsVersionEnabled(
-            oldBucketInfo.getIsVersionEnabled());
+        bucketInfoBuilder
+            .setIsVersionEnabled(oldBucketInfo.getIsVersionEnabled());
       }
       bucketInfoBuilder.setCreationTime(oldBucketInfo.getCreationTime());
 
-      metadataManager.put(bucketKey, bucketInfoBuilder.build()
-          .getProtobuf().toByteArray());
+      metadataManager.put(bucketKey,
+          bucketInfoBuilder.build().getProtobuf().toByteArray());
     } catch (IOException | DBException ex) {
-      LOG.error("Setting bucket property failed for bucket:{} in volume:{}",
-          bucketName, volumeName, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Setting bucket property failed for bucket:{} in volume:{}",
+            bucketName, volumeName, ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();
@@ -250,28 +256,30 @@ public class BucketManagerImpl implements BucketManager {
     try {
       byte[] bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
       //Check if volume exists
-      if(metadataManager.get(metadataManager.getVolumeKey(volumeName)) ==
-          null) {
-        LOG.error("volume: {} not found ", volumeName);
+      if (metadataManager.get(metadataManager.getVolumeKey(volumeName))
+          == null) {
+        LOG.debug("volume: {} not found ", volumeName);
         throw new KSMException("Volume doesn't exist",
             KSMException.ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
       //Check if bucket exist
-      if(metadataManager.get(bucketKey) == null) {
-        LOG.error("bucket: {} not found ", bucketName);
+      if (metadataManager.get(bucketKey) == null) {
+        LOG.debug("bucket: {} not found ", bucketName);
         throw new KSMException("Bucket doesn't exist",
             KSMException.ResultCodes.FAILED_BUCKET_NOT_FOUND);
       }
       //Check if bucket is empty
-      if(!metadataManager.isBucketEmpty(volumeName, bucketName)) {
-        LOG.error("bucket: {} is not empty ", bucketName);
+      if (!metadataManager.isBucketEmpty(volumeName, bucketName)) {
+        LOG.debug("bucket: {} is not empty ", bucketName);
         throw new KSMException("Bucket is not empty",
             KSMException.ResultCodes.FAILED_BUCKET_NOT_EMPTY);
       }
       metadataManager.delete(bucketKey);
     } catch (IOException ex) {
-      LOG.error("Delete bucket failed for bucket:{} in volume:{}",
-          bucketName, volumeName, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Delete bucket failed for bucket:{} in volume:{}", bucketName,
+            volumeName, ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0880d5e9/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 2bf9a33..e1ef754 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
@@ -99,18 +99,18 @@ public class KeyManagerImpl implements KeyManager {
     try {
       byte[] volumeKey = metadataManager.getVolumeKey(volumeName);
       byte[] bucketKey = metadataManager.getBucketKey(volumeName, bucketName);
-      byte[] keyKey = metadataManager.getDBKeyForKey(
-          volumeName, bucketName, keyName);
+      byte[] keyKey =
+          metadataManager.getDBKeyForKey(volumeName, bucketName, keyName);
 
       //Check if the volume exists
-      if(metadataManager.get(volumeKey) == null) {
-        LOG.error("volume not found: {}", volumeName);
+      if (metadataManager.get(volumeKey) == null) {
+        LOG.debug("volume not found: {}", volumeName);
         throw new KSMException("Volume not found",
             KSMException.ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
       //Check if bucket already exists
-      if(metadataManager.get(bucketKey) == null) {
-        LOG.error("bucket not found: {}/{} ", volumeName, bucketName);
+      if (metadataManager.get(bucketKey) == null) {
+        LOG.debug("bucket not found: {}/{} ", volumeName, bucketName);
         throw new KSMException("Bucket not found",
             KSMException.ResultCodes.FAILED_BUCKET_NOT_FOUND);
       }
@@ -123,7 +123,6 @@ public class KeyManagerImpl implements KeyManager {
       // clean up those blocks when it can. Right now making this change
       // allows us to pass tests that expect ozone can overwrite a key.
 
-
       // When we talk to SCM make sure that we ask for at least a byte in the
       // block. This way even if the call is for a zero length key, we back it
       // with a actual SCM block.
@@ -164,14 +163,16 @@ public class KeyManagerImpl implements KeyManager {
           .setModificationTime(currentTime)
           .build();
       metadataManager.put(keyKey, keyBlock.getProtobuf().toByteArray());
-      LOG.debug("Key {} allocated in volume {} bucket {}",
-          keyName, volumeName, bucketName);
+      LOG.debug("Key {} allocated in volume {} bucket {}", keyName, volumeName,
+          bucketName);
       return keyBlock;
     } catch (KSMException e) {
       throw e;
     } catch (IOException ex) {
-      LOG.error("Key allocation failed for volume:{} bucket:{} key:{}",
-          volumeName, bucketName, keyName, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Key allocation failed for volume:{} bucket:{} key:{}",
+            volumeName, bucketName, keyName, ex);
+      }
       throw new KSMException(ex.getMessage(),
           KSMException.ResultCodes.FAILED_KEY_ALLOCATION);
     } finally {
@@ -191,7 +192,7 @@ public class KeyManagerImpl implements KeyManager {
           volumeName, bucketName, keyName);
       byte[] value = metadataManager.get(keyKey);
       if (value == null) {
-        LOG.error("Key: {} not found", keyKey);
+        LOG.debug("Key: {} not found", keyKey);
         throw new KSMException("Key not found",
             KSMException.ResultCodes.FAILED_KEY_NOT_FOUND);
       }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/0880d5e9/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java
b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java
index 8ab5d68..bb6c365 100644
--- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java
+++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/ozone/ksm/VolumeManagerImpl.java
@@ -75,7 +75,7 @@ public class VolumeManagerImpl implements VolumeManager {
 
     // Check the volume count
     if (prevVolList.size() >= maxUserVolumeCount) {
-      LOG.error("Too many volumes for user:{}", owner);
+      LOG.debug("Too many volumes for user:{}", owner);
       throw new KSMException(ResultCodes.FAILED_TOO_MANY_USER_VOLUMES);
     }
 
@@ -97,6 +97,7 @@ public class VolumeManagerImpl implements VolumeManager {
       VolumeList vlist = VolumeList.parseFrom(volumeList);
       prevVolList.addAll(vlist.getVolumeNamesList());
     } else {
+      LOG.debug("volume:{} not found for user:{}");
       throw new KSMException(ResultCodes.FAILED_USER_NOT_FOUND);
     }
 
@@ -125,7 +126,7 @@ public class VolumeManagerImpl implements VolumeManager {
 
       // Check of the volume already exists
       if (volumeInfo != null) {
-        LOG.error("volume:{} already exists", args.getVolume());
+        LOG.debug("volume:{} already exists", args.getVolume());
         throw new KSMException(ResultCodes.FAILED_VOLUME_ALREADY_EXISTS);
       }
 
@@ -137,11 +138,13 @@ public class VolumeManagerImpl implements VolumeManager {
       // Add volume to user list
       addVolumeToOwnerList(args.getVolume(), args.getOwnerName(), batch);
       metadataManager.writeBatch(batch);
-      LOG.info("created volume:{} user:{}",
-                                  args.getVolume(), args.getOwnerName());
+      LOG.debug("created volume:{} user:{}", args.getVolume(),
+          args.getOwnerName());
     } catch (IOException ex) {
-      LOG.error("Volume creation failed for user:{} volname:{}",
-                                args.getOwnerName(), args.getVolume(), ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Volume creation failed for user:{} volume:{}",
+            args.getOwnerName(), args.getVolume(), ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();
@@ -164,6 +167,8 @@ public class VolumeManagerImpl implements VolumeManager {
       byte[] dbVolumeKey = metadataManager.getVolumeKey(volume);
       byte[] volInfo = metadataManager.get(dbVolumeKey);
       if (volInfo == null) {
+        LOG.debug("Changing volume ownership failed for user:{} volume:{}",
+            owner, volume);
         throw  new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
 
@@ -188,8 +193,10 @@ public class VolumeManagerImpl implements VolumeManager {
 
       metadataManager.writeBatch(batch);
     } catch (IOException ex) {
-      LOG.error("Changing volume ownership failed for user:{} volume:{}",
-          owner, volume, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Changing volume ownership failed for user:{} volume:{}",
+            owner, volume, ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();
@@ -210,7 +217,8 @@ public class VolumeManagerImpl implements VolumeManager {
       byte[] dbVolumeKey = metadataManager.getVolumeKey(volume);
       byte[] volInfo = metadataManager.get(dbVolumeKey);
       if (volInfo == null) {
-        throw  new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
+        LOG.debug("volume:{} does not exist", volume);
+        throw new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
 
       VolumeInfo volumeInfo = VolumeInfo.parseFrom(volInfo);
@@ -218,18 +226,20 @@ public class VolumeManagerImpl implements VolumeManager {
       Preconditions.checkState(volume.equals(volumeInfo.getVolume()));
 
       KsmVolumeArgs newVolumeArgs =
-          KsmVolumeArgs.newBuilder().setVolume(volumeArgs.getVolume())
+          KsmVolumeArgs.newBuilder()
+              .setVolume(volumeArgs.getVolume())
               .setAdminName(volumeArgs.getAdminName())
               .setOwnerName(volumeArgs.getOwnerName())
               .setQuotaInBytes(quota)
-              .setCreationTime(volumeArgs.getCreationTime())
-              .build();
+              .setCreationTime(volumeArgs.getCreationTime()).build();
 
       VolumeInfo newVolumeInfo = newVolumeArgs.getProtobuf();
       metadataManager.put(dbVolumeKey, newVolumeInfo.toByteArray());
     } catch (IOException ex) {
-      LOG.error("Changing volume quota failed for volume:{} quota:{}",
-          volume, quota, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Changing volume quota failed for volume:{} quota:{}", volume,
+            quota, ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();
@@ -249,7 +259,8 @@ public class VolumeManagerImpl implements VolumeManager {
       byte[] dbVolumeKey = metadataManager.getVolumeKey(volume);
       byte[] volInfo = metadataManager.get(dbVolumeKey);
       if (volInfo == null) {
-        throw  new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
+        LOG.debug("volume:{} does not exist", volume);
+        throw new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
 
       VolumeInfo volumeInfo = VolumeInfo.parseFrom(volInfo);
@@ -257,7 +268,9 @@ public class VolumeManagerImpl implements VolumeManager {
       Preconditions.checkState(volume.equals(volumeInfo.getVolume()));
       return volumeArgs;
     } catch (IOException ex) {
-      LOG.error("Info volume failed for volume:{}", volume, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.warn("Info volume failed for volume:{}", volume, ex);
+      }
       throw ex;
     } finally {
       metadataManager.readLock().unlock();
@@ -279,10 +292,12 @@ public class VolumeManagerImpl implements VolumeManager {
       byte[] dbVolumeKey = metadataManager.getVolumeKey(volume);
       byte[] volInfo = metadataManager.get(dbVolumeKey);
       if (volInfo == null) {
+        LOG.debug("volume:{} does not exist", volume);
         throw new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
 
       if (!metadataManager.isVolumeEmpty(volume)) {
+        LOG.debug("volume:{} is not empty", volume);
         throw new KSMException(ResultCodes.FAILED_VOLUME_NOT_EMPTY);
       }
 
@@ -294,7 +309,9 @@ public class VolumeManagerImpl implements VolumeManager {
       batch.delete(dbVolumeKey);
       metadataManager.writeBatch(batch);
     } catch (IOException ex) {
-      LOG.error("Delete volume failed for volume:{}", volume, ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Delete volume failed for volume:{}", volume, ex);
+      }
       throw ex;
     } finally {
       metadataManager.writeLock().unlock();
@@ -318,6 +335,7 @@ public class VolumeManagerImpl implements VolumeManager {
       byte[] dbVolumeKey = metadataManager.getVolumeKey(volume);
       byte[] volInfo = metadataManager.get(dbVolumeKey);
       if (volInfo == null) {
+        LOG.debug("volume:{} does not exist", volume);
         throw  new KSMException(ResultCodes.FAILED_VOLUME_NOT_FOUND);
       }
 
@@ -326,8 +344,10 @@ public class VolumeManagerImpl implements VolumeManager {
       Preconditions.checkState(volume.equals(volumeInfo.getVolume()));
       return volumeArgs.getAclMap().hasAccess(userAcl);
     } catch (IOException ex) {
-      LOG.error("Check volume access failed for volume:{} user:{} rights:{}",
-          volume, userAcl.getName(), userAcl.getRights(), ex);
+      if (!(ex instanceof KSMException)) {
+        LOG.error("Check volume access failed for volume:{} user:{} rights:{}",
+            volume, userAcl.getName(), userAcl.getRights(), ex);
+      }
       throw ex;
     } finally {
       metadataManager.readLock().unlock();


---------------------------------------------------------------------
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