wchevreuil commented on a change in pull request #3488:
URL: https://github.com/apache/hbase/pull/3488#discussion_r675142140



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegionFileSystem.java
##########
@@ -1247,4 +1149,186 @@ private static void sleepBeforeRetry(String msg, int 
sleepMultiplier, int baseSl
     }
     Thread.sleep((long)baseSleepBeforeRetries * sleepMultiplier);
   }
+
+  private void createWriteStrategy(Configuration conf) {
+    String className = conf.get(REGION_WRITE_STRATEGY, 
DefaultWriteStrategy.class.getName());
+    try {
+      LOG.info("instantiating write strategy {}", className);
+      writeStrategy = ReflectionUtils.instantiateWithCustomCtor(className,
+        new Class[] { HRegionFileSystem.class }, new Object[] { this });
+    } catch (Exception e) {
+      LOG.error("Unable to create write strategy: {}", className, e);
+    }
+  }
+
+  public static class DefaultWriteStrategy extends 
HRegionFileSystemWriteStrategy {
+
+    public DefaultWriteStrategy(HRegionFileSystem fileSystem){
+      super(fileSystem);
+    }
+
+    /**
+     * Constructs a Path for the split dir as follows:
+     *  "/hbase/data/NS/TABLE/PARENT_REGION_DIR/.splits/"
+     * @return the temporary parent path for the split dir
+     */
+    @Override
+    public Path getParentSplitsDir() {
+      return new Path(fileSystem.getRegionDir(), REGION_SPLITS_DIR);
+    }
+
+    /**
+     * Constructs a Path for the merged dir as follows:
+     *  "/hbase/data/NS/TABLE/PARENT_REGION_DIR/.merges/"
+     * @return the temporary parent path for the merges dir.
+     */
+    @Override
+    public Path getParentMergesDir() {
+      return new Path(fileSystem.getRegionDir(), REGION_MERGES_DIR);
+    }
+
+    /**
+     * Creates the region splits directory. Assumes getSplitsDir 
implementation returns a tmp dir,
+     * therefore, it deletes any existing directory returned by getSplitsDir.
+     *
+     * @param daughterA the first half of the split region
+     * @param daughterB the second half of the split region
+     *
+     * @throws IOException if splits dir creation fails.
+     */
+    @Override
+    public void createSplitsDir(RegionInfo daughterA, RegionInfo daughterB) 
throws IOException {
+      Path splitdir = getParentSplitsDir();
+      if (this.fileSystem.fs.exists(splitdir)) {
+        LOG.info("The " + splitdir + " directory exists.  Hence deleting it to 
recreate it");

Review comment:
       Ack




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to