Class InputStreamBlockDistribution

java.lang.Object
org.apache.hadoop.hbase.regionserver.InputStreamBlockDistribution

@Private public class InputStreamBlockDistribution extends Object
Computes the HDFSBlockDistribution for a file based on the underlying located blocks for an HdfsDataInputStream reading that file. The backing DFSInputStream.getAllBlocks involves allocating an array of numBlocks size per call. It may also involve calling the namenode, if the DFSInputStream has not fetched all the blocks yet. In order to avoid allocation pressure, we cache the computed distribution for a configurable period of time.

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.