hbase-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jonathan Hsieh (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HBASE-8446) Allow parallel snapshot of different tables
Date Mon, 29 Apr 2013 23:06:16 GMT

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

Jonathan Hsieh commented on HBASE-8446:
---------------------------------------

Holdup on commit!

Remove TODO
{code}
  // TODO: this is a bad smell;  likely replace with a collection in the future.  Also this
gets
   // reset by every operation.
-  private TakeSnapshotHandler handler;
+  private Map<String, TakeSnapshotHandler> snapshotHandlers =
+      new HashMap<String, TakeSnapshotHandler>();
{code}

Is this the correct place to remove handler references? (in #getTakeSnapshotHandler)?  Removing
from the list seems like a unexpected side-effect for a getter.  I'd imagine this would be
at the end of the TableSnasphotHandler#process call or in #completeSnapshot.  This introduces
two problems -- a concurrency problem (what if two getTakeSnapshotHandlers called) and a resource
leak problem (what if over time we create many snapshots -- these handlers never get gc'ed
since they continue to live in the table..)
{code}
@@ -306,6 +308,11 @@ public class SnapshotManager implements Stoppable {
       return null;
     }
 
+    // Remove from the "in-progress" list once completed
+    if (h.isFinished()) {
+      snapshotHandlers.remove(snapshot.getTable());
+    }
+
     return h;
   }
{code}

Change comment to say only a single snapshot per table at a time.
{code}
  }
-
-  /**
    * Check to see if the specified table has a snapshot in progress.  Currently we have a
    * limitation only allowing a single snapshot attempt at a time.
    * @param tableName name of the table being snapshotted.
    * @return <tt>true</tt> if there is a snapshot in progress on the specified
table.
    */
-  private boolean isTakingSnapshot(final String tableName) {
-    if (handler != null && handler.getSnapshot().getTable().equals(tableName)) {
-      return !handler.isFinished();
-    }
-    return false;
+  boolean isTakingSnapshot(final String tableName) {
+    TakeSnapshotHandler handler = this.snapshotHandlers.get(tableName);
+    return handler != null && !handler.isFinished();
   }
{code}

SnapshotManager lines 455. (delete working dir on failed snapshot) -- will this affect other
concurrently table snapshots? Are they isolated? (Please add test.).  Could one fail on verification
(if another is getting deleted?)


                
> Allow parallel snapshot of different tables
> -------------------------------------------
>
>                 Key: HBASE-8446
>                 URL: https://issues.apache.org/jira/browse/HBASE-8446
>             Project: HBase
>          Issue Type: Improvement
>          Components: snapshots
>    Affects Versions: 0.95.0
>            Reporter: Matteo Bertozzi
>            Assignee: Matteo Bertozzi
>            Priority: Minor
>             Fix For: 0.95.2
>
>         Attachments: HBASE-8446-94.patch, HBASE-8446-v0.patch, HBASE-8446-v1.patch, HBASE-8446-v2.patch
>
>
> currently only one snapshot at the time is allowed.
> Like for the restore, we should allow taking snapshot of different tables in parallel.

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

Mime
View raw message