Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 3.4k
HBASE-26079 Use StoreFileTracker when splitting and merging#3617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
99ba9781a2510cbfc0e20a66cecc888f140c39ad6461022012ccd11085aff92fae49d9cfc3535d459996af2ad21File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -21,6 +21,7 @@ | ||
| import java.util.Collection; | ||
| import java.util.List; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.hbase.regionserver.StoreContext; | ||
| import org.apache.hadoop.hbase.regionserver.StoreFileInfo; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
| @@ -32,8 +33,7 @@ | ||
| @InterfaceAudience.Private | ||
| class DefaultStoreFileTracker extends StoreFileTrackerBase { | ||
| public DefaultStoreFileTracker(Configuration conf, boolean isPrimaryReplica, | ||
| StoreContext ctx) { | ||
| public DefaultStoreFileTracker(Configuration conf, boolean isPrimaryReplica, StoreContext ctx) { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do not need to touch this file? | ||
| super(conf, isPrimaryReplica, ctx); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -48,7 +48,6 @@ | ||
| */ | ||
| @InterfaceAudience.Private | ||
| public interface StoreFileTracker { | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. | ||
| /** | ||
| * Load the store files list when opening a region. | ||
| */ | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -18,22 +18,51 @@ | ||
| package org.apache.hadoop.hbase.regionserver.storefiletracker; | ||
| import org.apache.hadoop.conf.Configuration; | ||
| import org.apache.hadoop.hbase.CompoundConfiguration; | ||
| import org.apache.hadoop.hbase.client.ColumnFamilyDescriptor; | ||
| import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; | ||
| import org.apache.hadoop.hbase.client.TableDescriptor; | ||
| import org.apache.hadoop.hbase.regionserver.HRegionFileSystem; | ||
| import org.apache.hadoop.hbase.regionserver.StoreContext; | ||
| import org.apache.hadoop.hbase.util.Bytes; | ||
| import org.apache.hadoop.hbase.util.ReflectionUtils; | ||
| import org.apache.yetus.audience.InterfaceAudience; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| /** | ||
| * Factory method for creating store file tracker. | ||
| */ | ||
| @InterfaceAudience.Private | ||
| public final class StoreFileTrackerFactory { | ||
| public static final String TRACK_IMPL = "hbase.store.file-tracker.impl"; | ||
| private static final Logger LOG = LoggerFactory.getLogger(StoreFileTrackerFactory.class); | ||
| public static StoreFileTracker create(Configuration conf, boolean isPrimaryReplica, | ||
| StoreContext ctx) { | ||
| StoreContext ctx) { | ||
| Class<? extends StoreFileTracker> tracker = | ||
| conf.getClass(TRACK_IMPL, DefaultStoreFileTracker.class, StoreFileTracker.class); | ||
| LOG.info("instantiating StoreFileTracker impl {}", tracker.getName()); | ||
| return ReflectionUtils.newInstance(tracker, conf, isPrimaryReplica, ctx); | ||
| } | ||
| public static StoreFileTracker create(Configuration conf, boolean isPrimaryReplica, String family, | ||
| HRegionFileSystem regionFs) { | ||
| ColumnFamilyDescriptorBuilder fDescBuilder = | ||
| ColumnFamilyDescriptorBuilder.newBuilder(Bytes.toBytes(family)); | ||
| StoreContext ctx = StoreContext.getBuilder(). | ||
| withColumnFamilyDescriptor(fDescBuilder.build()). | ||
| withRegionFileSystem(regionFs). | ||
| build(); | ||
| return StoreFileTrackerFactory.create(conf, isPrimaryReplica, ctx); | ||
| } | ||
| public static Configuration mergeConfigurations(Configuration global, | ||
Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'd better merge all the configurations? For example, if the tracker itself needs some configurations... Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is what we have in HStore, for initializaing the Configuration. Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's extract the above code into a util method and use it also for merging configurations in MergeTableRegionsProcedure and SplitTableRegionProcedure? ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, missed this suggestion before pushing up last commit. Let me change this. ContributorAuthor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed the implementation to use CompoundConfiguration accordingly. Sorry, ain't sure where you think this should be used. Wa are already calling Contributor There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean we could extract a util method, so we do not need to write the logic twice in both here and the constructor of HStore. Not a big deal, can do it later. | ||
| TableDescriptor table, ColumnFamilyDescriptor family) { | ||
| return new CompoundConfiguration() | ||
| .add(global) | ||
| .addBytesMap(table.getValues()) | ||
| .addStringMap(family.getConfiguration()) | ||
| .addBytesMap(family.getValues()); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -67,6 +67,7 @@ public void testCustomParts() throws Exception { | ||
| DummyStoreFlusher.class.getName()); | ||
| HRegion mockRegion = Mockito.mock(HRegion.class); | ||
| HStore mockStore = Mockito.mock(HStore.class); | ||
| mockStore.conf = conf; | ||
Apache9 marked this conversation as resolved.
Uh oh!There was an error while loading. Please reload this page. | ||
| Mockito.when(mockStore.getRegionInfo()).thenReturn(RegionInfoBuilder.FIRST_META_REGIONINFO); | ||
| Mockito.when(mockStore.getHRegion()).thenReturn(mockRegion); | ||
| StoreEngine<?, ?, ?, ?> se = | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.