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



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/DirectStoreFSWriteStrategy.java
##########
@@ -0,0 +1,258 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hbase.regionserver;
+
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.hbase.client.ConnectionFactory;
+import org.apache.hadoop.hbase.client.RegionInfo;
+import org.apache.yetus.audience.InterfaceAudience;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * <code>HRegionFileSystemWriteStrategy</code> implementation to be used in 
combination with
+ * <code>PersistedStoreEngine</code> to avoid renames when splitting and 
merging regions.
+ *
+ * To use it, define the following properties under master configuration:
+ * 1) <property>
+ *      <name>hbase.hregion.file.write.strategy</name>
+ *      
<value>org.apache.hadoop.hbase.regionserver.DirectStoreFSWriteStrategy</value>
+ *    </property>
+ * 2) <property>
+ *      <name>hbase.hregion.merge.strategy</name>
+ *      
<value>org.apache.hadoop.hbase.master.assignment.DirectStoreMergeRegionsStrategy</value>
+ *    </property>
+ *
+ * This will create the resulting merging and splitting regions directory 
straight under
+ * the table dir, instead of creating it under the temporary ".tmp" or 
".merges" dirs,
+ * as done by the default implementation.
+ */
+@InterfaceAudience.Private
+public class DirectStoreFSWriteStrategy extends HRegionFileSystemWriteStrategy 
{
+  private StoreFilePathAccessor accessor;
+  private Map<String, Map<String,List<Path>>> regionSplitReferences = new 
ConcurrentHashMap<>();

Review comment:
       > Is the ConcurrentHashMap necessary? Multiple concurrent splits 
accessing this?
   
   No concurrent access, so no need for `ConcurrentHashMap`. 
   
   > Also, who cleans up the entries in this map?
   
   Yeah, this is a mistake. Entries are not being cleaned. Not a problem for 
now, as each `HRegionFileSystem` representing region being split is unique for 
the context of a single SplitProcedure, but better fix that if this is to be 
used in a different context. 




-- 
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: issues-unsubscr...@hbase.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to