HBASE-26270 Provide getConfiguration method for Region and Store interface (#3671)
Signed-off-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Anoop Sam John <anoopsamjohn@apache.org>
This commit is contained in:
parent
2599bd8eab
commit
e6508f6776
|
@ -44,10 +44,10 @@ import org.apache.yetus.audience.InterfaceAudience;
|
||||||
* Wraps a Configuration to make it read-only.
|
* Wraps a Configuration to make it read-only.
|
||||||
*/
|
*/
|
||||||
@InterfaceAudience.Private
|
@InterfaceAudience.Private
|
||||||
class ReadOnlyConfiguration extends Configuration {
|
public class ReadOnlyConfiguration extends Configuration {
|
||||||
private final Configuration conf;
|
private final Configuration conf;
|
||||||
|
|
||||||
ReadOnlyConfiguration(final Configuration conf) {
|
public ReadOnlyConfiguration(final Configuration conf) {
|
||||||
this.conf = conf;
|
this.conf = conf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -119,6 +119,7 @@ import org.apache.hadoop.hbase.client.TableDescriptorBuilder;
|
||||||
import org.apache.hadoop.hbase.conf.ConfigurationManager;
|
import org.apache.hadoop.hbase.conf.ConfigurationManager;
|
||||||
import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver;
|
import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver;
|
||||||
import org.apache.hadoop.hbase.coprocessor.CoprocessorHost;
|
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.errorhandling.ForeignExceptionSnare;
|
||||||
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
|
import org.apache.hadoop.hbase.exceptions.FailedSanityCheckException;
|
||||||
import org.apache.hadoop.hbase.exceptions.TimeoutIOException;
|
import org.apache.hadoop.hbase.exceptions.TimeoutIOException;
|
||||||
|
@ -1962,6 +1963,11 @@ public class HRegion implements HeapSize, PropagatingConfigurationObserver, Regi
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Configuration getReadOnlyConfiguration() {
|
||||||
|
return new ReadOnlyConfiguration(this.conf);
|
||||||
|
}
|
||||||
|
|
||||||
private ThreadPoolExecutor getStoreOpenAndCloseThreadPool(
|
private ThreadPoolExecutor getStoreOpenAndCloseThreadPool(
|
||||||
final String threadNamePrefix) {
|
final String threadNamePrefix) {
|
||||||
int numStores = Math.max(1, this.htableDescriptor.getColumnFamilyCount());
|
int numStores = Math.max(1, this.htableDescriptor.getColumnFamilyCount());
|
||||||
|
|
|
@ -69,6 +69,7 @@ import org.apache.hadoop.hbase.client.RegionInfo;
|
||||||
import org.apache.hadoop.hbase.client.Scan;
|
import org.apache.hadoop.hbase.client.Scan;
|
||||||
import org.apache.hadoop.hbase.conf.ConfigurationManager;
|
import org.apache.hadoop.hbase.conf.ConfigurationManager;
|
||||||
import org.apache.hadoop.hbase.conf.PropagatingConfigurationObserver;
|
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.HeapSize;
|
||||||
import org.apache.hadoop.hbase.io.compress.Compression;
|
import org.apache.hadoop.hbase.io.compress.Compression;
|
||||||
import org.apache.hadoop.hbase.io.crypto.Encryption;
|
import org.apache.hadoop.hbase.io.crypto.Encryption;
|
||||||
|
@ -2801,6 +2802,11 @@ public class HStore implements Store, HeapSize, StoreConfigInformation,
|
||||||
return mixedRowReadsCount.sum();
|
return mixedRowReadsCount.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Configuration getReadOnlyConfiguration() {
|
||||||
|
return new ReadOnlyConfiguration(this.conf);
|
||||||
|
}
|
||||||
|
|
||||||
void updateMetricsStore(boolean memstoreRead) {
|
void updateMetricsStore(boolean memstoreRead) {
|
||||||
if (memstoreRead) {
|
if (memstoreRead) {
|
||||||
memstoreOnlyRowReadsCount.increment();
|
memstoreOnlyRowReadsCount.increment();
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.Cell;
|
import org.apache.hadoop.hbase.Cell;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
import org.apache.hadoop.hbase.CompareOperator;
|
import org.apache.hadoop.hbase.CompareOperator;
|
||||||
|
@ -597,4 +598,10 @@ public interface Region extends ConfigurationObserver {
|
||||||
* max wait time period.
|
* max wait time period.
|
||||||
*/
|
*/
|
||||||
boolean waitForFlushes(long timeout);
|
boolean waitForFlushes(long timeout);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a read only configuration of this region; throws {@link UnsupportedOperationException}
|
||||||
|
* if you try to set a configuration.
|
||||||
|
*/
|
||||||
|
Configuration getReadOnlyConfiguration();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@ import java.util.Collection;
|
||||||
import java.util.OptionalDouble;
|
import java.util.OptionalDouble;
|
||||||
import java.util.OptionalLong;
|
import java.util.OptionalLong;
|
||||||
|
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.fs.FileSystem;
|
import org.apache.hadoop.fs.FileSystem;
|
||||||
import org.apache.hadoop.hbase.CellComparator;
|
import org.apache.hadoop.hbase.CellComparator;
|
||||||
import org.apache.hadoop.hbase.HBaseInterfaceAudience;
|
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.
|
* @return the number of read requests from the files under this store.
|
||||||
*/
|
*/
|
||||||
long getMixedRowReadsCount();
|
long getMixedRowReadsCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return a read only configuration of this store; throws {@link UnsupportedOperationException}
|
||||||
|
* if you try to set a configuration.
|
||||||
|
*/
|
||||||
|
Configuration getReadOnlyConfiguration();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue