@InterfaceAudience.Private public class InputStreamBlockDistribution extends Object
This class only gets instantiated for the first FSDataInputStream of each StoreFile (i.e.
the one backing HStoreFile.initialReader
). It's then used to dynamically update the value
returned by HStoreFile.getHDFSBlockDistribution()
.
Once the backing FSDataInputStream is closed, we should not expect the distribution result to
change anymore. This is ok becuase the initialReader's InputStream is only closed when the
StoreFile itself is closed, at which point nothing will be querying getHDFSBlockDistribution
anymore. If/When the StoreFile is reopened, a new InputStreamBlockDistribution
will be
created for the new initialReader.
Modifier and Type | Field and Description |
---|---|
private int |
cachePeriodMs |
private static int |
DEFAULT_HBASE_LOCALITY_INPUTSTREAM_DERIVE_CACHE_PERIOD |
private static boolean |
DEFAULT_HBASE_LOCALITY_INPUTSTREAM_DERIVE_ENABLED |
private StoreFileInfo |
fileInfo |
private static String |
HBASE_LOCALITY_INPUTSTREAM_DERIVE_CACHE_PERIOD |
private static String |
HBASE_LOCALITY_INPUTSTREAM_DERIVE_ENABLED |
private HDFSBlocksDistribution |
hdfsBlocksDistribution |
private long |
lastCachedAt |
private static org.slf4j.Logger |
LOG |
private org.apache.hadoop.fs.FSDataInputStream |
stream |
private boolean |
streamUnsupported |
Constructor and Description |
---|
InputStreamBlockDistribution(org.apache.hadoop.fs.FSDataInputStream stream,
StoreFileInfo fileInfo)
This should only be called for the first FSDataInputStream of a StoreFile, in
HStoreFile.open() . |
Modifier and Type | Method and Description |
---|---|
private void |
computeBlockDistribution() |
(package private) long |
getCachePeriodMs()
For tests only, returns the configured cache period
|
HDFSBlocksDistribution |
getHDFSBlockDistribution()
Get the HDFSBlocksDistribution derived from the StoreFile input stream, re-computing if cache
is expired.
|
static boolean |
isEnabled(org.apache.hadoop.conf.Configuration conf)
True if we should derive StoreFile HDFSBlockDistribution from the underlying input stream
|
(package private) boolean |
isStreamUnsupported()
For tests only, returns whether the passed stream is supported
|
(package private) void |
setLastCachedAt(long timestamp)
For tests only, sets lastCachedAt so we can force a refresh
|
private static final org.slf4j.Logger LOG
private static final String HBASE_LOCALITY_INPUTSTREAM_DERIVE_ENABLED
private static final boolean DEFAULT_HBASE_LOCALITY_INPUTSTREAM_DERIVE_ENABLED
private static final String HBASE_LOCALITY_INPUTSTREAM_DERIVE_CACHE_PERIOD
private static final int DEFAULT_HBASE_LOCALITY_INPUTSTREAM_DERIVE_CACHE_PERIOD
private final org.apache.hadoop.fs.FSDataInputStream stream
private final StoreFileInfo fileInfo
private final int cachePeriodMs
private HDFSBlocksDistribution hdfsBlocksDistribution
private long lastCachedAt
private boolean streamUnsupported
public InputStreamBlockDistribution(org.apache.hadoop.fs.FSDataInputStream stream, StoreFileInfo fileInfo)
HStoreFile.open()
.stream
- the input stream to derive locality fromfileInfo
- the StoreFileInfo for the related store fileInputStreamBlockDistribution
public static boolean isEnabled(org.apache.hadoop.conf.Configuration conf)
public HDFSBlocksDistribution getHDFSBlockDistribution()
private void computeBlockDistribution() throws IOException
IOException
void setLastCachedAt(long timestamp)
long getCachePeriodMs()
boolean isStreamUnsupported()
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.