[ 
https://issues.apache.org/jira/browse/HBASE-8341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13631039#comment-13631039
 ] 

Jonathan Hsieh commented on HBASE-8341:
---------------------------------------

Restore/SnapshotManager part looks good to me. (would like test but this is 
pretty trivial). 

Can you explain what problem this code is solving (it is snapshot related but 
not to restore)?  Is this supposed to be a separate fix?

{code}
diff --git 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/TakeSnapshotHandler.java
 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/TakeSnapshotHandler.java
index 6d018e5..7d0a621 100644
--- 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/TakeSnapshotHandler.java
+++ 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/snapshot/TakeSnapshotHandler.java
@@ -43,10 +43,10 @@ import org.apache.hadoop.hbase.executor.EventType;
 import org.apache.hadoop.hbase.master.MasterServices;
 import org.apache.hadoop.hbase.master.MetricsMaster;
 import org.apache.hadoop.hbase.master.SnapshotSentinel;
-import org.apache.hadoop.hbase.monitoring.MonitoredTask;
-import org.apache.hadoop.hbase.monitoring.TaskMonitor;
 import org.apache.hadoop.hbase.master.TableLockManager;
 import org.apache.hadoop.hbase.master.TableLockManager.TableLock;
+import org.apache.hadoop.hbase.monitoring.MonitoredTask;
+import org.apache.hadoop.hbase.monitoring.TaskMonitor;
 import 
org.apache.hadoop.hbase.protobuf.generated.HBaseProtos.SnapshotDescription;
 import org.apache.hadoop.hbase.snapshot.ClientSnapshotDescriptionUtils;
 import org.apache.hadoop.hbase.snapshot.SnapshotDescriptionUtils;
@@ -129,10 +129,18 @@ public abstract class TakeSnapshotHandler extends 
EventHandler implements Snapsh
 
   public TakeSnapshotHandler prepare() throws Exception {
     super.prepare();
-    loadTableDescriptor(); // check that .tableinfo is present
+    this.tableLock.acquire(); // after this, you should ensure to release this 
lock in
+                              // case of exceptions
+    boolean success = false;
+    try {
+      loadTableDescriptor(); // check that .tableinfo is present
+      success = true;
+    } finally {
+      if (!success) {
+        releaseTableLock();
+      }
+    }
 
-    this.tableLock.acquire(); //after this, you should ensure to release this 
lock in
-                              //case of exceptions
     return this;
   }
{code}
                
> RestoreSnapshotHandler.prepare() is not called by SnapshotManager  
> -------------------------------------------------------------------
>
>                 Key: HBASE-8341
>                 URL: https://issues.apache.org/jira/browse/HBASE-8341
>             Project: HBase
>          Issue Type: Bug
>            Reporter: Enis Soztutar
>            Assignee: Enis Soztutar
>             Fix For: 0.98.0, 0.95.1
>
>         Attachments: hbase-8341_v1.patch
>
>
> In HBASE-7848, we added table lock to enabled/disabled snapshot handlers, and 
> fixed SnapshotManager to call CloneSnapshotHandler.prepare() in HBASE-7957. 
> It seems that we overlooked the RestoreSnapshotHandler.prepare(). In this 
> issue we should fix that so that we acquire the table lock in restore 
> snapshot. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to