This is an automated email from the ASF dual-hosted git repository. meiyi pushed a commit to branch branch-2.4 in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2.4 by this push: new d75d73b HBASE-26270 Provide getConfiguration method for Region and Store interface (#3671) d75d73b is described below commit d75d73bcc71239afa4b43237642475509907513e Author: meiyi <myime...@gmail.com> AuthorDate: Wed Sep 22 10:23:25 2021 +0800 HBASE-26270 Provide getConfiguration method for Region and Store interface (#3671) Signed-off-by: Duo Zhang <zhang...@apache.org> Signed-off-by: Anoop Sam John <anoopsamj...@apache.org> --- .../org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java | 4 ++-- .../main/java/org/apache/hadoop/hbase/regionserver/HRegion.java | 6 ++++++ .../src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java | 6 ++++++ .../src/main/java/org/apache/hadoop/hbase/regionserver/Region.java | 7 +++++++ .../src/main/java/org/apache/hadoop/hbase/regionserver/Store.java | 7 +++++++ 5 files changed, 28 insertions(+), 2 deletions(-) diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java index b805c50..d7705ef 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/coprocessor/ReadOnlyConfiguration.java @@ -44,10 +44,10 @@ import org.apache.yetus.audience.InterfaceAudience; * Wraps a Configuration to make it read-only. */ @InterfaceAudience.Private -class ReadOnlyConfiguration extends Configuration { +public class ReadOnlyConfiguration extends Configuration { private final Configuration conf; - ReadOnlyConfiguration(final Configuration conf) { + public ReadOnlyConfiguration(final Configuration conf) { this.conf = conf; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java index d304fa3..ee9026e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HRegion.java @@ -127,6 +127,7 @@ import org.apache.hadoop.hbase.client.TableDescriptorBuilder; import org.apache.hadoop.hbase.conf.ConfigurationManager; import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver; import org.apache.hadoop.hbase.coprocessor.CoprocessorHost; +import org.apache.hadoop.hbase.coprocessor.ReadOnlyConfiguration; import org.apache.hadoop.hbase.errorhandling.ForeignExceptionSnare; import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException; import org.apache.hadoop.hbase.exceptions.TimeoutIOException; @@ -1988,6 +1989,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi } } + @Override + public Configuration getReadOnlyConfiguration() { + return new ReadOnlyConfiguration(this.conf); + } + protected ThreadPoolExecutor getStoreOpenAndCloseThreadPool( final String threadNamePrefix) { int numStores = Math.max(1, this.htableDescriptor.getColumnFamilyCount()); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java index 43ca2ed..646b86e 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/HStore.java @@ -71,6 +71,7 @@ import org.apache.hadoop.hbase.client.RegionInfo; import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.conf.ConfigurationManager; import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver; +import org.apache.hadoop.hbase.coprocessor.ReadOnlyConfiguration; import org.apache.hadoop.hbase.io.HeapSize; import org.apache.hadoop.hbase.io.compress.Compression; import org.apache.hadoop.hbase.io.crypto.Encryption; @@ -2899,6 +2900,11 @@ public class HStore implements Store, HeapSize, StoreConfigInformation, return mixedRowReadsCount.sum(); } + @Override + public Configuration getReadOnlyConfiguration() { + return new ReadOnlyConfiguration(this.conf); + } + void updateMetricsStore(boolean memstoreRead) { if (memstoreRead) { memstoreOnlyRowReadsCount.increment(); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java index 71d9c4c..64eeee3 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Region.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.List; import java.util.Map; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.CompareOperator; @@ -639,4 +640,10 @@ public interface Region extends ConfigurationObserver { * max wait time period. */ boolean waitForFlushes(long timeout); + + /** + * @return a read only configuration of this region; throws {@link UnsupportedOperationException} + * if you try to set a configuration. + */ + Configuration getReadOnlyConfiguration(); } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java index 6ec9c51..fd1acd9 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/Store.java @@ -22,6 +22,7 @@ import java.util.Collection; import java.util.OptionalDouble; import java.util.OptionalLong; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.hbase.CellComparator; import org.apache.hadoop.hbase.HBaseInterfaceAudience; @@ -292,4 +293,10 @@ public interface Store { * @return the number of read requests from the files under this store. */ long getMixedRowReadsCount(); + + /** + * @return a read only configuration of this store; throws {@link UnsupportedOperationException} + * if you try to set a configuration. + */ + Configuration getReadOnlyConfiguration(); }