hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From syuanji...@apache.org
Subject [24/50] [abbrv] hbase git commit: HBASE-15608 Remove PB references from SnapShot related Exceptions (ram)
Date Wed, 11 May 2016 04:57:56 GMT
HBASE-15608 Remove PB references from SnapShot related Exceptions (ram)


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

Branch: refs/heads/hbase-12439
Commit: bec81b1977ab3862c424cc0e0768c5d18bda7dee
Parents: 0d25291
Author: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Authored: Fri May 6 17:06:25 2016 +0530
Committer: Ramkrishna <ramkrishna.s.vasudevan@intel.com>
Committed: Fri May 6 17:06:25 2016 +0530

----------------------------------------------------------------------
 .../apache/hadoop/hbase/client/HBaseAdmin.java  |  2 +-
 .../hbase/client/SnapshotDescription.java       |  8 ++++
 .../hadoop/hbase/protobuf/ProtobufUtil.java     | 14 +++++++
 .../snapshot/CorruptedSnapshotException.java    |  2 +-
 .../hbase/snapshot/HBaseSnapshotException.java  |  2 +-
 .../snapshot/RestoreSnapshotException.java      |  2 +-
 .../snapshot/SnapshotCreationException.java     |  2 +-
 .../snapshot/SnapshotDoesNotExistException.java |  2 +-
 .../hbase/snapshot/SnapshotExistsException.java |  2 +-
 .../procedure/CloneSnapshotProcedure.java       |  3 +-
 .../master/snapshot/MasterSnapshotVerifier.java | 16 +++++---
 .../hbase/master/snapshot/SnapshotManager.java  | 41 ++++++++++++--------
 .../snapshot/SnapshotDescriptionUtils.java      |  6 ++-
 .../hadoop/hbase/snapshot/SnapshotManifest.java |  6 ++-
 .../hbase/snapshot/SnapshotReferenceUtil.java   | 15 ++++---
 15 files changed, 84 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
index 7371f03..4b0609d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/HBaseAdmin.java
@@ -2333,7 +2333,7 @@ public class HBaseAdmin implements Admin {
     }
     if (!done.getDone()) {
       throw new SnapshotCreationException("Snapshot '" + snapshot.getName()
-          + "' wasn't completed in expectedTime:" + max + " ms", snapshot);
+          + "' wasn't completed in expectedTime:" + max + " ms", snapshotDesc);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
index a455937..f737825 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/SnapshotDescription.java
@@ -81,4 +81,12 @@ public class SnapshotDescription {
   public int getVersion() {
     return this.version;
   }
+
+  @Override
+  public String toString() {
+    return "SnapshotDescription: name = " + ((name != null) ? name : null) + "/table = "
+        + ((table != null) ? table : null) + " /owner = " + ((owner != null) ? owner : null)
+        + (creationTime != -1 ? ("/creationtime = " + creationTime) : "")
+        + (version != -1 ? ("/version = " + version) : "");
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
index 9978c77..50a4920 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/protobuf/ProtobufUtil.java
@@ -3472,4 +3472,18 @@ public final class ProtobufUtil {
     HBaseProtos.SnapshotDescription snapshot = builder.build();
     return snapshot;
   }
+
+  /**
+   * Convert from
+   * {@link org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription} to
+   * {@link SnapshotDescription}
+   * @param snapshotDesc the protobuf SnapshotDescription
+   * @return the POJO SnapshotDescription
+   */
+  public static SnapshotDescription
+      createSnapshotDesc(HBaseProtos.SnapshotDescription snapshotDesc) {
+    return new SnapshotDescription(snapshotDesc.getName(), snapshotDesc.getTable(),
+        createSnapshotType(snapshotDesc.getType()), snapshotDesc.getOwner(),
+        snapshotDesc.getCreationTime(), snapshotDesc.getVersion());
+  }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
index 2c6cc35..d0ef28d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/CorruptedSnapshotException.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.snapshot;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
index 5d03eab..2fe58ed 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/HBaseSnapshotException.java
@@ -20,7 +20,7 @@ package org.apache.hadoop.hbase.snapshot;
 import org.apache.hadoop.hbase.DoNotRetryIOException;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 
 /**
  * General exception base class for when a snapshot fails

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
index c36d482..70e8d3b 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/RestoreSnapshotException.java
@@ -20,7 +20,7 @@ package org.apache.hadoop.hbase.snapshot;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 
 /**
  * Thrown when a snapshot could not be restored due to a server-side error when restoring
it.

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
index 2f7d2be..2738b3d 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotCreationException.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.snapshot;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 
 /**
  * Thrown when a snapshot could not be created due to a server-side error when

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
index d9ecd14..e088408 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDoesNotExistException.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.snapshot;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 
 
 /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
----------------------------------------------------------------------
diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
index 172c89e..425f93a 100644
--- a/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
+++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotExistsException.java
@@ -19,7 +19,7 @@ package org.apache.hadoop.hbase.snapshot;
 
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.classification.InterfaceStability;
-import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
+import org.apache.hadoop.hbase.client.SnapshotDescription;
 
 /**
  * Thrown when a snapshot exists but should not

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java
index c008b36..e91bd29 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/CloneSnapshotProcedure.java
@@ -455,7 +455,8 @@ public class CloneSnapshotProcedure
           String msg = "clone snapshot=" + ClientSnapshotDescriptionUtils.toString(snapshot)
+
             " failed because " + e.getMessage();
           LOG.error(msg, e);
-          IOException rse = new RestoreSnapshotException(msg, e, snapshot);
+          IOException rse = new RestoreSnapshotException(msg, e,
+              ProtobufUtil.createSnapshotDesc(snapshot));
 
           // these handlers aren't futures so we need to register the error here.
           monitorException.receive(new ForeignException("Master CloneSnapshotProcedure",
rse));

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/MasterSnapshotVerifier.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/MasterSnapshotVerifier.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/MasterSnapshotVerifier.java
index a28e111..40f5845 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/MasterSnapshotVerifier.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/MasterSnapshotVerifier.java
@@ -35,6 +35,7 @@ import org.apache.hadoop.hbase.client.RegionReplicaUtil;
 import org.apache.hadoop.hbase.MetaTableAccessor;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.mob.MobUtils;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotRegionManifest;
 import org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils;
@@ -125,8 +126,9 @@ public final class MasterSnapshotVerifier {
   private void verifySnapshotDescription(Path snapshotDir) throws CorruptedSnapshotException
{
     SnapshotDescription found = SnapshotDescriptionUtils.readSnapshotInfo(fs, snapshotDir);
     if (!this.snapshot.equals(found)) {
-      throw new CorruptedSnapshotException("Snapshot read (" + found
-          + ") doesn't equal snapshot we ran (" + snapshot + ").", snapshot);
+      throw new CorruptedSnapshotException(
+          "Snapshot read (" + found + ") doesn't equal snapshot we ran (" + snapshot + ").",
+          ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 
@@ -137,12 +139,14 @@ public final class MasterSnapshotVerifier {
   private void verifyTableInfo(final SnapshotManifest manifest) throws IOException {
     HTableDescriptor htd = manifest.getTableDescriptor();
     if (htd == null) {
-      throw new CorruptedSnapshotException("Missing Table Descriptor", snapshot);
+      throw new CorruptedSnapshotException("Missing Table Descriptor",
+        ProtobufUtil.createSnapshotDesc(snapshot));
     }
 
     if (!htd.getNameAsString().equals(snapshot.getTable())) {
-      throw new CorruptedSnapshotException("Invalid Table Descriptor. Expected "
-        + snapshot.getTable() + " name, got " + htd.getNameAsString(), snapshot);
+      throw new CorruptedSnapshotException(
+          "Invalid Table Descriptor. Expected " + snapshot.getTable() + " name, got "
+              + htd.getNameAsString(), ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 
@@ -216,7 +220,7 @@ public final class MasterSnapshotVerifier {
     if (!region.equals(manifestRegionInfo)) {
       String msg = "Manifest region info " + manifestRegionInfo +
                    "doesn't match expected region:" + region;
-      throw new CorruptedSnapshotException(msg, snapshot);
+      throw new CorruptedSnapshotException(msg, ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 }

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
index 50a1832..8ef63fb 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/SnapshotManager.java
@@ -65,6 +65,7 @@ import org.apache.hadoop.hbase.procedure.ProcedureCoordinator;
 import org.apache.hadoop.hbase.procedure.ProcedureCoordinatorRpcs;
 import org.apache.hadoop.hbase.procedure.ZKProcedureCoordinatorRpcs;
 import org.apache.hadoop.hbase.procedure2.ProcedureExecutor;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.NameStringPair;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.ProcedureDescription;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
@@ -275,7 +276,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
   public void deleteSnapshot(SnapshotDescription snapshot) throws SnapshotDoesNotExistException,
IOException {
     // check to see if it is completed
     if (!isSnapshotCompleted(snapshot)) {
-      throw new SnapshotDoesNotExistException(snapshot);
+      throw new SnapshotDoesNotExistException(ProtobufUtil.createSnapshotDesc(snapshot));
     }
 
     String snapshotName = snapshot.getName();
@@ -357,7 +358,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
         status = expected.getName() + " not found in proclist " + coordinator.getProcedureNames();
       }
       throw new HBaseSnapshotException("Snapshot " + ssString +  " had an error.  " + status,
e,
-          expected);
+        ProtobufUtil.createSnapshotDesc(expected));
     }
 
     // check to see if we are done
@@ -426,7 +427,7 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
           + " because we are already running another snapshot "
           + (handler != null ? ("on the same table " +
               ClientSnapshotDescriptionUtils.toString(handler.getSnapshot()))
-              : "with the same name"), snapshot);
+              : "with the same name"), ProtobufUtil.createSnapshotDesc(snapshot));
     }
 
     // make sure we aren't running a restore on the same table
@@ -443,14 +444,16 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
 
       // recreate the working directory for the snapshot
       if (!fs.mkdirs(workingDir)) {
-        throw new SnapshotCreationException("Couldn't create working directory (" + workingDir
-            + ") for snapshot" , snapshot);
+        throw new SnapshotCreationException(
+            "Couldn't create working directory (" + workingDir + ") for snapshot",
+            ProtobufUtil.createSnapshotDesc(snapshot));
       }
     } catch (HBaseSnapshotException e) {
       throw e;
     } catch (IOException e) {
       throw new SnapshotCreationException(
-          "Exception while checking to see if snapshot could be started.", e, snapshot);
+          "Exception while checking to see if snapshot could be started.", e,
+          ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 
@@ -516,7 +519,8 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
             ClientSnapshotDescriptionUtils.toString(snapshot));
       }
       // fail the snapshot
-      throw new SnapshotCreationException("Could not build snapshot handler", e, snapshot);
+      throw new SnapshotCreationException("Could not build snapshot handler", e,
+        ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 
@@ -530,8 +534,9 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
   public void takeSnapshot(SnapshotDescription snapshot) throws IOException {
     // check to see if we already completed the snapshot
     if (isSnapshotCompleted(snapshot)) {
-      throw new SnapshotExistsException("Snapshot '" + snapshot.getName()
-          + "' already stored on the filesystem.", snapshot);
+      throw new SnapshotExistsException(
+          "Snapshot '" + snapshot.getName() + "' already stored on the filesystem.",
+          ProtobufUtil.createSnapshotDesc(snapshot));
     }
 
     LOG.debug("No existing snapshot, attempting snapshot...");
@@ -547,14 +552,16 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     } catch (FileNotFoundException e) {
       String msg = "Table:" + snapshot.getTable() + " info doesn't exist!";
       LOG.error(msg);
-      throw new SnapshotCreationException(msg, e, snapshot);
+      throw new SnapshotCreationException(msg, e, ProtobufUtil.createSnapshotDesc(snapshot));
     } catch (IOException e) {
-      throw new SnapshotCreationException("Error while geting table description for table
"
-          + snapshot.getTable(), e, snapshot);
+      throw new SnapshotCreationException(
+          "Error while geting table description for table " + snapshot.getTable(), e,
+          ProtobufUtil.createSnapshotDesc(snapshot));
     }
     if (desc == null) {
-      throw new SnapshotCreationException("Table '" + snapshot.getTable()
-          + "' doesn't exist, can't take snapshot.", snapshot);
+      throw new SnapshotCreationException(
+          "Table '" + snapshot.getTable() + "' doesn't exist, can't take snapshot.",
+          ProtobufUtil.createSnapshotDesc(snapshot));
     }
     SnapshotDescription.Builder builder = snapshot.toBuilder();
     // if not specified, set the snapshot format
@@ -593,7 +600,8 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
           + "', isn't open or closed, we don't know what to do!");
       TablePartiallyOpenException tpoe = new TablePartiallyOpenException(snapshot.getTable()
           + " isn't fully open.");
-      throw new SnapshotCreationException("Table is not entirely open or closed", tpoe, snapshot);
+      throw new SnapshotCreationException("Table is not entirely open or closed", tpoe,
+        ProtobufUtil.createSnapshotDesc(snapshot));
     }
 
     // call post coproc hook
@@ -750,7 +758,8 @@ public class SnapshotManager extends MasterProcedureManager implements
Stoppable
     // check if the snapshot exists
     if (!fs.exists(snapshotDir)) {
       LOG.error("A Snapshot named '" + reqSnapshot.getName() + "' does not exist.");
-      throw new SnapshotDoesNotExistException(reqSnapshot);
+      throw new SnapshotDoesNotExistException(
+        ProtobufUtil.createSnapshotDesc(reqSnapshot));
     }
 
     // Get snapshot info from file system. The reqSnapshot is a "fake" snapshotInfo with

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
index b6b608c..560a42b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotDescriptionUtils.java
@@ -29,6 +29,7 @@ import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.fs.permission.FsPermission;
 import org.apache.hadoop.hbase.HConstants;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.security.User;
@@ -333,8 +334,9 @@ public final class SnapshotDescriptionUtils {
     LOG.debug("Snapshot is done, just moving the snapshot from " + workingDir + " to "
         + finishedDir);
     if (!fs.rename(workingDir, finishedDir)) {
-      throw new SnapshotCreationException("Failed to move working directory(" + workingDir
-          + ") to completed directory(" + finishedDir + ").", snapshot);
+      throw new SnapshotCreationException(
+          "Failed to move working directory(" + workingDir + ") to completed directory("
+              + finishedDir + ").", ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotManifest.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotManifest.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotManifest.java
index df0c348..9d7af50 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotManifest.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotManifest.java
@@ -158,7 +158,8 @@ public final class SnapshotManifest {
       case SnapshotManifestV2.DESCRIPTOR_VERSION:
         return new SnapshotManifestV2.ManifestBuilder(conf, fs, workingDir);
       default:
-        throw new CorruptedSnapshotException("Invalid Snapshot version: "+ desc.getVersion(),
desc);
+      throw new CorruptedSnapshotException("Invalid Snapshot version: " + desc.getVersion(),
+        ProtobufUtil.createSnapshotDesc(desc));
     }
   }
 
@@ -391,7 +392,8 @@ public final class SnapshotManifest {
         break;
       }
       default:
-        throw new CorruptedSnapshotException("Invalid Snapshot version: "+ desc.getVersion(),
desc);
+      throw new CorruptedSnapshotException("Invalid Snapshot version: " + desc.getVersion(),
+        ProtobufUtil.createSnapshotDesc(desc));
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/bec81b19/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotReferenceUtil.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotReferenceUtil.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotReferenceUtil.java
index 0532ba7..ba8087b 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotReferenceUtil.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/snapshot/SnapshotReferenceUtil.java
@@ -40,6 +40,7 @@ import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.io.HFileLink;
 import org.apache.hadoop.hbase.mob.MobUtils;
+import org.apache.hadoop.hbase.protobuf.ProtobufUtil;
 import org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.protobuf.generated.SnapshotProtos.SnapshotRegionManifest;
 import org.apache.hadoop.hbase.regionserver.StoreFileInfo;
@@ -209,7 +210,8 @@ public final class SnapshotReferenceUtil {
         throw new InterruptedIOException(e.getMessage());
       } catch (ExecutionException e) {
         if (e.getCause() instanceof CorruptedSnapshotException) {
-          throw new CorruptedSnapshotException(e.getCause().getMessage(), snapshotDesc);
+          throw new CorruptedSnapshotException(e.getCause().getMessage(),
+            ProtobufUtil.createSnapshotDesc(snapshotDesc));
         } else {
           IOException ex = new IOException();
           ex.initCause(e.getCause());
@@ -248,8 +250,9 @@ public final class SnapshotReferenceUtil {
       String refRegion = refPath.getParent().getParent().getName();
       refPath = HFileLink.createPath(table, refRegion, family, refPath.getName());
       if (!HFileLink.buildFromHFileLinkPattern(conf, refPath).exists(fs)) {
-        throw new CorruptedSnapshotException("Missing parent hfile for: " + fileName +
-          " path=" + refPath, snapshot);
+        throw new CorruptedSnapshotException(
+            "Missing parent hfile for: " + fileName + " path=" + refPath,
+            ProtobufUtil.createSnapshotDesc(snapshot));
       }
 
       if (storeFile.hasReference()) {
@@ -285,14 +288,16 @@ public final class SnapshotReferenceUtil {
         String msg = "hfile: " + fileName + " size does not match with the expected one.
" +
           " found=" + fstat.getLen() + " expected=" + storeFile.getFileSize();
         LOG.error(msg);
-        throw new CorruptedSnapshotException(msg, snapshot);
+        throw new CorruptedSnapshotException(msg,
+          ProtobufUtil.createSnapshotDesc(snapshot));
       }
     } catch (FileNotFoundException e) {
       String msg = "Can't find hfile: " + fileName + " in the real (" +
           link.getOriginPath() + ") or archive (" + link.getArchivePath()
           + ") directory for the primary table.";
       LOG.error(msg);
-      throw new CorruptedSnapshotException(msg, snapshot);
+      throw new CorruptedSnapshotException(msg,
+        ProtobufUtil.createSnapshotDesc(snapshot));
     }
   }
 


Mime
View raw message