z-york commented on a change in pull request #3460:
URL: https://github.com/apache/hbase/pull/3460#discussion_r665485546



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/StoreContext.java
##########
@@ -49,6 +49,7 @@
   private final ColumnFamilyDescriptor family;
   private final Path familyStoreDirectoryPath;
   private final RegionCoprocessorHost coprocessorHost;
+  private final boolean primary;

Review comment:
       What exactly does primary mean here? Primary versus read replica?

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/StoreFileTrackerFactory.java
##########
@@ -0,0 +1,32 @@
+/**
+ * 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.storefiletracker;
+
+import org.apache.hadoop.hbase.regionserver.StoreContext;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * Factory method for creating store file tracker.
+ */
[email protected]
+public final class StoreFileTrackerFactory {
+
+  public static StoreFileTracker create(StoreContext ctx) {
+    return new DefaultStoreFileTracker(ctx);

Review comment:
       Create a NoopStoreFileTracker if the StoreContext tells us we aren't the 
primary? Then you don't have to add the isPrimary() checks everywhere

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/StoreFileTracker.java
##########
@@ -0,0 +1,73 @@
+/**
+ * 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.storefiletracker;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import org.apache.hadoop.hbase.regionserver.StoreFileInfo;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * An interface to define how we track the store files for a give store.
+ * <p/>
+ * In the old time, we will write store to a tmp directory first, and then 
rename it to the actual
+ * data file. And once a store file is under data directory, we will consider 
it as 'committed'. And
+ * we need to do listing when loading store files.
+ * <p/>
+ * When cloud age is coming, now we want to store the store files on object 
storage, where rename
+ * and list are not as cheap as on HDFS, especially rename. Although 
introducing a metadata
+ * management layer for object storage could solve the problem, but we still 
want HBase to run on
+ * pure object storage, so here we introduce this interface to abstract how we 
track the store
+ * files. For the old implementation, we just persist nothing here, and do 
listing to load store
+ * files. When running on object storage, we could persist the store file list 
in a system region,
+ * or in a file on the object storage, to make it possible to write directly 
into the data directory
+ * to avoid renaming, and also avoid listing when loading store files.
+ * <p/>
+ * The implementation requires to be thread safe as flush and compaction may 
occur as the same time,
+ * and we could also do multiple compactions at the same time. As the 
implementation may choose to
+ * persist the store file list to external storage, which could be slow, it is 
the duty for the
+ * callers to not call it inside a lock which may block normal read/write 
requests.
+ */
[email protected]
+public interface StoreFileTracker {
+
+  /**
+   * Load the store files list when opening a region.
+   */
+  List<StoreFileInfo> loadStoreFiles() throws IOException;

Review comment:
       +1 on moving this out of HStore. Let's discuss adding it to the SFM 
interface versus the StoreFileTracker. I believe in our implementation we added 
it to the SFM.

##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/StoreFileTracker.java
##########
@@ -0,0 +1,73 @@
+/**
+ * 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.storefiletracker;
+
+import java.io.IOException;
+import java.util.Collection;
+import java.util.List;
+import org.apache.hadoop.hbase.regionserver.StoreFileInfo;
+import org.apache.yetus.audience.InterfaceAudience;
+
+/**
+ * An interface to define how we track the store files for a give store.
+ * <p/>
+ * In the old time, we will write store to a tmp directory first, and then 
rename it to the actual
+ * data file. And once a store file is under data directory, we will consider 
it as 'committed'. And
+ * we need to do listing when loading store files.
+ * <p/>
+ * When cloud age is coming, now we want to store the store files on object 
storage, where rename
+ * and list are not as cheap as on HDFS, especially rename. Although 
introducing a metadata
+ * management layer for object storage could solve the problem, but we still 
want HBase to run on
+ * pure object storage, so here we introduce this interface to abstract how we 
track the store
+ * files. For the old implementation, we just persist nothing here, and do 
listing to load store
+ * files. When running on object storage, we could persist the store file list 
in a system region,
+ * or in a file on the object storage, to make it possible to write directly 
into the data directory
+ * to avoid renaming, and also avoid listing when loading store files.
+ * <p/>
+ * The implementation requires to be thread safe as flush and compaction may 
occur as the same time,
+ * and we could also do multiple compactions at the same time. As the 
implementation may choose to
+ * persist the store file list to external storage, which could be slow, it is 
the duty for the
+ * callers to not call it inside a lock which may block normal read/write 
requests.
+ */
[email protected]
+public interface StoreFileTracker {

Review comment:
       Let's talk a bit about your plans here.
   
   What is the reasoning for introducing a new StoreFileTracker that duplicates 
some of the APIs from the SFM? Why not handle internal to the SFM (+ add a 
method either in the SFM or HStore/StoreContect about should write to tmp)? The 
SFM should have the source of truth for the right files to be included. If we 
do add this separate StoreFileTracker, I think it should be called internal to 
the SFM methods. We should not require callers of the SFM to have to call two 
separate interfaces for one logical operation (for example updating the files 
that are present in the SFM).




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