Repository: hbase
Updated Branches:
  refs/heads/master 1b041a4fc -> 9d5d25c88


HBASE-17618 Refactor the implementation of modify table and delete column in MOB


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

Branch: refs/heads/master
Commit: 9d5d25c88d70b48e9218fd699050e13973b61216
Parents: 1b041a4
Author: Jingcheng Du <[email protected]>
Authored: Fri Feb 10 21:26:53 2017 +0800
Committer: Jingcheng Du <[email protected]>
Committed: Fri Feb 10 21:26:53 2017 +0800

----------------------------------------------------------------------
 .../hadoop/hbase/master/MasterFileSystem.java   | 28 +++++---------------
 .../procedure/MasterDDLOperationHelper.java     | 13 ++++++---
 .../org/apache/hadoop/hbase/mob/MobUtils.java   | 25 -----------------
 3 files changed, 17 insertions(+), 49 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/9d5d25c8/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
index 84e88a9..ee195cc 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/MasterFileSystem.java
@@ -39,7 +39,6 @@ import 
org.apache.hadoop.hbase.exceptions.DeserializationException;
 import org.apache.hadoop.hbase.fs.HFileSystem;
 import org.apache.hadoop.hbase.master.procedure.MasterProcedureConstants;
 import org.apache.hadoop.hbase.mob.MobConstants;
-import org.apache.hadoop.hbase.mob.MobUtils;
 import org.apache.hadoop.hbase.regionserver.HRegion;
 import org.apache.hadoop.hbase.util.Bytes;
 import org.apache.hadoop.hbase.util.FSTableDescriptors;
@@ -413,10 +412,15 @@ public class MasterFileSystem {
     }
   }
 
-  public void deleteFamilyFromFS(HRegionInfo region, byte[] familyName, 
boolean hasMob)
+  public void deleteFamilyFromFS(HRegionInfo region, byte[] familyName)
+      throws IOException {
+    deleteFamilyFromFS(rootdir, region, familyName);
+  }
+
+  public void deleteFamilyFromFS(Path rootDir, HRegionInfo region, byte[] 
familyName)
       throws IOException {
     // archive family store files
-    Path tableDir = FSUtils.getTableDir(rootdir, region.getTable());
+    Path tableDir = FSUtils.getTableDir(rootDir, region.getTable());
     HFileArchiver.archiveFamily(fs, conf, region, tableDir, familyName);
 
     // delete the family folder
@@ -430,24 +434,6 @@ public class MasterFileSystem {
             + ")");
       }
     }
-
-    // archive and delete mob files
-    if (hasMob) {
-      Path mobTableDir =
-          FSUtils.getTableDir(new Path(getRootDir(), 
MobConstants.MOB_DIR_NAME), region.getTable());
-      HRegionInfo mobRegionInfo = MobUtils.getMobRegionInfo(region.getTable());
-      Path mobFamilyDir =
-          new Path(mobTableDir,
-              new Path(mobRegionInfo.getEncodedName(), 
Bytes.toString(familyName)));
-      // archive mob family store files
-      MobUtils.archiveMobStoreFiles(conf, fs, mobRegionInfo, mobFamilyDir, 
familyName);
-
-      if (!fs.delete(mobFamilyDir, true)) {
-        throw new IOException("Could not delete mob store files for family "
-            + Bytes.toString(familyName) + " from FileSystem region "
-            + mobRegionInfo.getRegionNameAsString() + "(" + 
mobRegionInfo.getEncodedName() + ")");
-      }
-    }
   }
 
   public void stop() {

http://git-wip-us.apache.org/repos/asf/hbase/blob/9d5d25c8/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterDDLOperationHelper.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterDDLOperationHelper.java
 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterDDLOperationHelper.java
index 8fa4183..980bf94 100644
--- 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterDDLOperationHelper.java
+++ 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/procedure/MasterDDLOperationHelper.java
@@ -27,18 +27,19 @@ import java.util.TreeMap;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.HRegionInfo;
 import org.apache.hadoop.hbase.HRegionLocation;
 import org.apache.hadoop.hbase.ServerName;
 import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.TableNotDisabledException;
 import org.apache.hadoop.hbase.classification.InterfaceAudience;
 import org.apache.hadoop.hbase.client.Connection;
 import org.apache.hadoop.hbase.client.RegionLocator;
-import org.apache.hadoop.hbase.client.TableState;
 import org.apache.hadoop.hbase.master.AssignmentManager;
 import org.apache.hadoop.hbase.master.BulkReOpen;
 import org.apache.hadoop.hbase.master.MasterFileSystem;
+import org.apache.hadoop.hbase.mob.MobConstants;
+import org.apache.hadoop.hbase.mob.MobUtils;
 import org.apache.hadoop.hbase.util.Bytes;
 
 import com.google.common.collect.Lists;
@@ -71,7 +72,13 @@ public final class MasterDDLOperationHelper {
     }
     for (HRegionInfo hri : regionInfoList) {
       // Delete the family directory in FS for all the regions one by one
-      mfs.deleteFamilyFromFS(hri, familyName, hasMob);
+      mfs.deleteFamilyFromFS(hri, familyName);
+    }
+    if (hasMob) {
+      // Delete the mob region
+      Path mobRootDir = new Path(mfs.getRootDir(), MobConstants.MOB_DIR_NAME);
+      HRegionInfo mobRegionInfo = MobUtils.getMobRegionInfo(tableName);
+      mfs.deleteFamilyFromFS(mobRootDir, mobRegionInfo, familyName);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/9d5d25c8/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java
index 3b0b990..7e46291 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/mob/MobUtils.java
@@ -44,7 +44,6 @@ import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Cell;
 import org.apache.hadoop.hbase.CellComparator;
 import org.apache.hadoop.hbase.CellUtil;
-import org.apache.hadoop.hbase.HBaseConfiguration;
 import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.HRegionInfo;
@@ -65,7 +64,6 @@ import org.apache.hadoop.hbase.io.hfile.HFileContext;
 import org.apache.hadoop.hbase.io.hfile.HFileContextBuilder;
 import org.apache.hadoop.hbase.master.locking.LockManager;
 import org.apache.hadoop.hbase.mob.compactions.MobCompactor;
-import org.apache.hadoop.hbase.mob.compactions.PartitionedMobCompactionRequest;
 import 
org.apache.hadoop.hbase.mob.compactions.PartitionedMobCompactionRequest.CompactionPartitionId;
 import org.apache.hadoop.hbase.mob.compactions.PartitionedMobCompactor;
 import org.apache.hadoop.hbase.regionserver.BloomType;
@@ -844,29 +842,6 @@ public final class MobUtils {
   }
 
   /**
-   * Archives mob store files
-   * @param conf The current configuration.
-   * @param fs The current file system.
-   * @param mobRegionInfo The mob family region info.
-   * @param mobFamilyDir The mob family directory.
-   * @param family The name of the column family.
-   * @throws IOException
-   */
-  public static void archiveMobStoreFiles(Configuration conf, FileSystem fs,
-      HRegionInfo mobRegionInfo, Path mobFamilyDir, byte[] family) throws 
IOException {
-    // disable the block cache.
-    Configuration copyOfConf = HBaseConfiguration.create(conf);
-    copyOfConf.setFloat(HConstants.HFILE_BLOCK_CACHE_SIZE_KEY, 0f);
-    CacheConfig cacheConfig = new CacheConfig(copyOfConf);
-    FileStatus[] fileStatus = FSUtils.listStatus(fs, mobFamilyDir);
-    List<StoreFile> storeFileList = new ArrayList<StoreFile>();
-    for (FileStatus file : fileStatus) {
-      storeFileList.add(new StoreFile(fs, file.getPath(), conf, cacheConfig, 
BloomType.NONE));
-    }
-    HFileArchiver.archiveStoreFiles(conf, fs, mobRegionInfo, mobFamilyDir, 
family, storeFileList);
-  }
-
-  /**
    * Creates a mob ref delete marker.
    * @param cell The current delete marker.
    * @return A delete marker with the ref tag.

Reply via email to