-
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
Changes from all commits
99ba978
1a2510c
bfc0e20
a66cecc
888f140
c39ad64
6102201
2ccd110
85aff92
fae49d9
cfc3535
d459996
af2ad21
File filter
Filter by extension
Conversations
Jump to
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) { | ||
|
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 { | ||
|
|
||
|
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, | ||
|
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... 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. 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? 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. 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 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()); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.