wchevreuil commented on a change in pull request #3749: URL: https://github.com/apache/hbase/pull/3749#discussion_r731073980
########## File path: hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/storefiletracker/SnapshotStoreFileTracker.java ########## @@ -0,0 +1,77 @@ +/** + * 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.conf.Configuration; +import org.apache.hadoop.hbase.regionserver.StoreContext; +import org.apache.hadoop.hbase.regionserver.StoreFileInfo; +import org.apache.hbase.thirdparty.com.google.common.base.Preconditions; +import org.apache.yetus.audience.InterfaceAudience; + +import java.io.IOException; +import java.util.List; + +/** + * Extends MigrationStoreFileTracker for Snapshot restore/clone specific case. + * When restoring/cloning snapshots, new regions are created with reference files to the + * original regions files. This work is done in snapshot specific classes. We need to somehow + * initialize these reference files in the configured StoreFileTracker. Once snapshot logic has + * cloned the store dir and created the references, it should set the list of reference files in + * <code>SourceTracker.setReferenceFiles</code> then invoke <code>load</code> method. + * <p/> + */ +@InterfaceAudience.Private +public class SnapshotStoreFileTracker extends MigrationStoreFileTracker { Review comment: So when restoring or cloning to existing table, because we may have to keep some of the existing hfiles that are still valid, but remove some others, we can't rely on the pre-existing record of "tracked files". That means we can't call `StoreFileTracker.call`, nor `StoreFileTracker.replace`. We need to reset the SFT registry with the new list of files built by `RestoreSnapshotHelper`. That means we need to call `StoreFileTrackerBase.set`, but this is package private. So we could either expose `StoreFileTrackerBase`, or extend `MigrationStoreFileTracker` in such way that you can properly initialise the SFT with the list of files built by `RestoreSnapshotHelper`. -- 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