You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by jm...@apache.org on 2014/12/24 19:00:22 UTC

hbase git commit: HBASE-12758 treat mob region as any other region when generating rs manifest

Repository: hbase
Updated Branches:
  refs/heads/hbase-11339 533aa52d8 -> 9f1f8c3bc


HBASE-12758 treat mob region as any other region when generating rs manifest


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

Branch: refs/heads/hbase-11339
Commit: 9f1f8c3bc6b09ede3dd9285e3a989337a135505e
Parents: 533aa52
Author: Jonathan M Hsieh <jm...@apache.org>
Authored: Wed Dec 24 08:18:48 2014 -0800
Committer: Jonathan M Hsieh <jm...@apache.org>
Committed: Wed Dec 24 08:18:48 2014 -0800

----------------------------------------------------------------------
 .../hadoop/hbase/regionserver/HRegion.java      | 31 ++++++++++----------
 1 file changed, 15 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9f1f8c3b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
index 60dc05d..df5c900 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java
@@ -2994,28 +2994,27 @@ public class HRegion implements HeapSize { // , Writable{
     Path rootDir = FSUtils.getRootDir(conf);
     Path snapshotDir = SnapshotDescriptionUtils.getWorkingSnapshotDir(desc, rootDir);
 
-    if (Bytes.equals(getStartKey(), HConstants.EMPTY_START_ROW)) {
-      Map<byte[], Store> stores = getStores();
-      boolean hasMobStore = false;
-      for (Entry<byte[], Store> store : stores.entrySet()) {
-        hasMobStore = store.getValue().getFamily().isMobEnabled();
-        if (hasMobStore) {
-          break;
-        }
-      }
-      if (hasMobStore) {
-        // if this is the first region, snapshot the mob files.
-        SnapshotManifest snapshotManifest = SnapshotManifest.create(conf, getFilesystem(),
+    SnapshotManifest manifest = SnapshotManifest.create(conf, getFilesystem(),
             snapshotDir, desc, exnSnare);
+    manifest.addRegion(this);
+
+    // The regionserver holding the first region of the table is responsible for taking the
+    // manifest of the mob dir.
+    if (!Bytes.equals(getStartKey(), HConstants.EMPTY_START_ROW))
+      return;
+
+    // if any cf's have is mob enabled, add the "mob region" to the manifest.
+    Map<byte[], Store> stores = getStores();
+    for (Entry<byte[], Store> store : stores.entrySet()) {
+      boolean hasMobStore = store.getValue().getFamily().isMobEnabled();
+      if (hasMobStore) {
         // use the .mob as the start key and 0 as the regionid
         HRegionInfo mobRegionInfo = MobUtils.getMobRegionInfo(this.getTableDesc().getTableName());
         mobRegionInfo.setOffline(true);
-        snapshotManifest.addMobRegion(mobRegionInfo, this.getTableDesc().getColumnFamilies());
+        manifest.addMobRegion(mobRegionInfo, this.getTableDesc().getColumnFamilies());
+        return;
       }
     }
-    SnapshotManifest manifest = SnapshotManifest.create(conf, getFilesystem(),
-                                                        snapshotDir, desc, exnSnare);
-    manifest.addRegion(this);
   }
 
   /**