| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (17) --> |
| <title>BlockCacheUtil (Apache HBase 4.0.0-alpha-1-SNAPSHOT API)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="description" content="declaration: package: org.apache.hadoop.hbase.io.hfile, class: BlockCacheUtil"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../../script-dir/jquery-3.6.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var evenRowColor = "even-row-color"; |
| var oddRowColor = "odd-row-color"; |
| var tableTab = "table-tab"; |
| var activeTableTab = "active-table-tab"; |
| var pathtoroot = "../../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <ul id="navbar-top-firstrow" class="nav-list" title="Navigation"> |
| <li><a href="../../../../../../index.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="nav-bar-cell1-rev">Class</li> |
| <li><a href="class-use/BlockCacheUtil.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../../index-all.html">Index</a></li> |
| <li><a href="../../../../../../help-doc.html#class">Help</a></li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div> |
| <ul class="sub-nav-list"> |
| <li>Summary: </li> |
| <li><a href="#nested-class-summary">Nested</a> | </li> |
| <li><a href="#field-summary">Field</a> | </li> |
| <li><a href="#constructor-summary">Constr</a> | </li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| <ul class="sub-nav-list"> |
| <li>Detail: </li> |
| <li><a href="#field-detail">Field</a> | </li> |
| <li><a href="#constructor-detail">Constr</a> | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><label for="search-input">SEARCH:</label> |
| <input type="text" id="search-input" value="search" disabled="disabled"> |
| <input type="reset" id="reset-button" value="reset" disabled="disabled"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">org.apache.hadoop.hbase.io.hfile</a></div> |
| <h1 title="Class BlockCacheUtil" class="title">Class BlockCacheUtil</h1> |
| </div> |
| <div class="inheritance" title="Inheritance Tree"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">java.lang.Object</a> |
| <div class="inheritance">org.apache.hadoop.hbase.io.hfile.BlockCacheUtil</div> |
| </div> |
| <section class="class-description" id="class-description"> |
| <hr> |
| <div class="type-signature"><span class="annotations">@Private |
| </span><span class="modifiers">public class </span><span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-47">BlockCacheUtil</a></span> |
| <span class="extends-implements">extends <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></span></div> |
| <div class="block">Utilty for aggregating counts in CachedBlocks and toString/toJSON CachedBlocks and BlockCaches. |
| No attempt has been made at making this thread safe.</div> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <li> |
| <section class="nested-class-summary" id="nested-class-summary"> |
| <h2>Nested Class Summary</h2> |
| <div class="caption"><span>Nested Classes</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Class</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>(package private) static class </code></div> |
| <div class="col-second even-row-color"><code><a href="BlockCacheUtil.CachedBlockCountsPerFile.html" class="type-name-link" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheUtil.CachedBlockCountsPerFile</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Little data structure to hold counts for a file.</div> |
| </div> |
| <div class="col-first odd-row-color"><code>static class </code></div> |
| <div class="col-second odd-row-color"><code><a href="BlockCacheUtil.CachedBlocksByFile.html" class="type-name-link" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheUtil.CachedBlocksByFile</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Use one of these to keep a running account of cached blocks by file.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- =========== FIELD SUMMARY =========== --> |
| <li> |
| <section class="field-summary" id="field-summary"> |
| <h2>Field Summary</h2> |
| <div class="caption"><span>Fields</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Field</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>private static final int</code></div> |
| <div class="col-second even-row-color"><code><a href="#DEFAULT_MAX" class="member-name-link">DEFAULT_MAX</a></code></div> |
| <div class="col-last even-row-color"> </div> |
| <div class="col-first odd-row-color"><code>private static final org.apache.hbase.thirdparty.com.google.gson.Gson</code></div> |
| <div class="col-second odd-row-color"><code><a href="#GSON" class="member-name-link">GSON</a></code></div> |
| <div class="col-last odd-row-color"> |
| <div class="block">Needed generating JSON.</div> |
| </div> |
| <div class="col-first even-row-color"><code>private static final org.slf4j.Logger</code></div> |
| <div class="col-second even-row-color"><code><a href="#LOG" class="member-name-link">LOG</a></code></div> |
| <div class="col-last even-row-color"> </div> |
| <div class="col-first odd-row-color"><code>static final long</code></div> |
| <div class="col-second odd-row-color"><code><a href="#NANOS_PER_SECOND" class="member-name-link">NANOS_PER_SECOND</a></code></div> |
| <div class="col-last odd-row-color"> </div> |
| </div> |
| </section> |
| </li> |
| <!-- ======== CONSTRUCTOR SUMMARY ======== --> |
| <li> |
| <section class="constructor-summary" id="constructor-summary"> |
| <h2>Constructor Summary</h2> |
| <div class="caption"><span>Constructors</span></div> |
| <div class="summary-table two-column-summary"> |
| <div class="table-header col-first">Constructor</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-constructor-name even-row-color"><code><a href="#%3Cinit%3E()" class="member-name-link">BlockCacheUtil</a>()</code></div> |
| <div class="col-last even-row-color"> </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab1" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab1', 3)" class="table-tab">Static Methods</button><button id="method-summary-table-tab4" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab4', 3)" class="table-tab">Concrete Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#cloneContext(org.apache.hadoop.hbase.io.hfile.HFileContext)" class="member-name-link">cloneContext</a><wbr>(<a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a> context)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>private static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#compareCacheBlock(org.apache.hadoop.hbase.io.hfile.Cacheable,org.apache.hadoop.hbase.io.hfile.Cacheable,boolean)" class="member-name-link">compareCacheBlock</a><wbr>(<a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> left, |
| <a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> right, |
| boolean includeNextBlockMetadata)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getBlockForCaching(org.apache.hadoop.hbase.io.hfile.CacheConfig,org.apache.hadoop.hbase.io.hfile.HFileBlock)" class="member-name-link">getBlockForCaching</a><wbr>(<a href="CacheConfig.html" title="class in org.apache.hadoop.hbase.io.hfile">CacheConfig</a> cacheConf, |
| <a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a> block)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Similarly to HFileBlock.Writer.getBlockForCaching(), creates a HFileBlock instance without |
| checksum for caching.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="BlockCacheUtil.CachedBlocksByFile.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheUtil.CachedBlocksByFile</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getLoadedCachedBlocksByFile(org.apache.hadoop.conf.Configuration,org.apache.hadoop.hbase.io.hfile.BlockCache)" class="member-name-link">getLoadedCachedBlocksByFile</a><wbr>(org.apache.hadoop.conf.Configuration conf, |
| <a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCache</a> bc)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Get a <a href="BlockCacheUtil.CachedBlocksByFile.html" title="class in org.apache.hadoop.hbase.io.hfile"><code>BlockCacheUtil.CachedBlocksByFile</code></a> instance and load it up by iterating content in |
| <a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile"><code>BlockCache</code></a>.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#getMaxCachedBlocksByFile(org.apache.hadoop.conf.Configuration)" class="member-name-link">getMaxCachedBlocksByFile</a><wbr>(org.apache.hadoop.conf.Configuration conf)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#shouldReplaceExistingCacheBlock(org.apache.hadoop.hbase.io.hfile.BlockCache,org.apache.hadoop.hbase.io.hfile.BlockCacheKey,org.apache.hadoop.hbase.io.hfile.Cacheable)" class="member-name-link">shouldReplaceExistingCacheBlock</a><wbr>(<a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCache</a> blockCache, |
| <a href="BlockCacheKey.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheKey</a> cacheKey, |
| <a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> newBlock)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Because of the region splitting, it's possible that the split key locate in the middle of a |
| block.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#toJSON(java.lang.String,java.util.NavigableSet)" class="member-name-link">toJSON</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> filename, |
| <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/NavigableSet.html" title="class or interface in java.util" class="external-link">NavigableSet</a><<a href="CachedBlock.html" title="interface in org.apache.hadoop.hbase.io.hfile">CachedBlock</a>> blocks)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns A JSON String of <code>filename</code> and counts of <code>blocks</code></div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#toJSON(org.apache.hadoop.hbase.io.hfile.BlockCache)" class="member-name-link">toJSON</a><wbr>(<a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCache</a> bc)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns JSON string of <code>bc</code> content.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#toJSON(org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile)" class="member-name-link">toJSON</a><wbr>(<a href="BlockCacheUtil.CachedBlocksByFile.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheUtil.CachedBlocksByFile</a> cbsbf)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns JSON string of <code>cbsf</code> aggregated</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#toString(org.apache.hadoop.hbase.io.hfile.CachedBlock,long)" class="member-name-link">toString</a><wbr>(<a href="CachedBlock.html" title="interface in org.apache.hadoop.hbase.io.hfile">CachedBlock</a> cb, |
| long now)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns The block content as String.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#toStringMinusFileName(org.apache.hadoop.hbase.io.hfile.CachedBlock,long)" class="member-name-link">toStringMinusFileName</a><wbr>(<a href="CachedBlock.html" title="interface in org.apache.hadoop.hbase.io.hfile">CachedBlock</a> cb, |
| long now)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Returns The block content of <code>bc</code> as a String minus the filename.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code>static int</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"><code><a href="#validateBlockAddition(org.apache.hadoop.hbase.io.hfile.Cacheable,org.apache.hadoop.hbase.io.hfile.Cacheable,org.apache.hadoop.hbase.io.hfile.BlockCacheKey)" class="member-name-link">validateBlockAddition</a><wbr>(<a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> existing, |
| <a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> newBlock, |
| <a href="BlockCacheKey.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheKey</a> cacheKey)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab1 method-summary-table-tab4"> |
| <div class="block">Validate that the existing and newBlock are the same without including the nextBlockMetadata, |
| if not, throw an exception.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-java.lang.Object">Methods inherited from class java.lang.<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html" title="class or interface in java.lang" class="external-link">Object</a></h3> |
| <code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#clone()" title="class or interface in java.lang" class="external-link">clone</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#equals(java.lang.Object)" title="class or interface in java.lang" class="external-link">equals</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#finalize()" title="class or interface in java.lang" class="external-link">finalize</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#getClass()" title="class or interface in java.lang" class="external-link">getClass</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#hashCode()" title="class or interface in java.lang" class="external-link">hashCode</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notify()" title="class or interface in java.lang" class="external-link">notify</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#notifyAll()" title="class or interface in java.lang" class="external-link">notifyAll</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#toString()" title="class or interface in java.lang" class="external-link">toString</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait()" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long)" title="class or interface in java.lang" class="external-link">wait</a>, <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/Object.html#wait(long,int)" title="class or interface in java.lang" class="external-link">wait</a></code></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ FIELD DETAIL =========== --> |
| <li> |
| <section class="field-details" id="field-detail"> |
| <h2>Field Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="LOG"> |
| <h3>LOG</h3> |
| <div class="member-signature"><span class="modifiers">private static final</span> <span class="return-type">org.slf4j.Logger</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-50">LOG</a></span></div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="NANOS_PER_SECOND"> |
| <h3>NANOS_PER_SECOND</h3> |
| <div class="member-signature"><span class="modifiers">public static final</span> <span class="return-type">long</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-52">NANOS_PER_SECOND</a></span></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.NANOS_PER_SECOND">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="GSON"> |
| <h3>GSON</h3> |
| <div class="member-signature"><span class="modifiers">private static final</span> <span class="return-type">org.apache.hbase.thirdparty.com.google.gson.Gson</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-57">GSON</a></span></div> |
| <div class="block">Needed generating JSON.</div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="DEFAULT_MAX"> |
| <h3>DEFAULT_MAX</h3> |
| <div class="member-signature"><span class="modifiers">private static final</span> <span class="return-type">int</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-245">DEFAULT_MAX</a></span></div> |
| <dl class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.DEFAULT_MAX">Constant Field Values</a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ========= CONSTRUCTOR DETAIL ======== --> |
| <li> |
| <section class="constructor-details" id="constructor-detail"> |
| <h2>Constructor Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="<init>()"> |
| <h3>BlockCacheUtil</h3> |
| <div class="member-signature"><span class="modifiers">public</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-48">BlockCacheUtil</a></span>()</div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="toString(org.apache.hadoop.hbase.io.hfile.CachedBlock,long)"> |
| <h3>toString</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-82">toString</a></span><wbr><span class="parameters">(<a href="CachedBlock.html" title="interface in org.apache.hadoop.hbase.io.hfile">CachedBlock</a> cb, |
| long now)</span></div> |
| <div class="block">Returns The block content as String.</div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="toJSON(java.lang.String,java.util.NavigableSet)"> |
| <h3>toJSON</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-122">toJSON</a></span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a> filename, |
| <a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/NavigableSet.html" title="class or interface in java.util" class="external-link">NavigableSet</a><<a href="CachedBlock.html" title="interface in org.apache.hadoop.hbase.io.hfile">CachedBlock</a>> blocks)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div> |
| <div class="block">Returns A JSON String of <code>filename</code> and counts of <code>blocks</code></div> |
| <dl class="notes"> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="toJSON(org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile)"> |
| <h3>toJSON</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-138">toJSON</a></span><wbr><span class="parameters">(<a href="BlockCacheUtil.CachedBlocksByFile.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheUtil.CachedBlocksByFile</a> cbsbf)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div> |
| <div class="block">Returns JSON string of <code>cbsf</code> aggregated</div> |
| <dl class="notes"> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="toJSON(org.apache.hadoop.hbase.io.hfile.BlockCache)"> |
| <h3>toJSON</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-143">toJSON</a></span><wbr><span class="parameters">(<a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCache</a> bc)</span> |
| throws <span class="exceptions"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></span></div> |
| <div class="block">Returns JSON string of <code>bc</code> content.</div> |
| <dl class="notes"> |
| <dt>Throws:</dt> |
| <dd><code><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/IOException.html" title="class or interface in java.io" class="external-link">IOException</a></code></dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="toStringMinusFileName(org.apache.hadoop.hbase.io.hfile.CachedBlock,long)"> |
| <h3>toStringMinusFileName</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link">String</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-148">toStringMinusFileName</a></span><wbr><span class="parameters">(<a href="CachedBlock.html" title="interface in org.apache.hadoop.hbase.io.hfile">CachedBlock</a> cb, |
| long now)</span></div> |
| <div class="block">Returns The block content of <code>bc</code> as a String minus the filename.</div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getLoadedCachedBlocksByFile(org.apache.hadoop.conf.Configuration,org.apache.hadoop.hbase.io.hfile.BlockCache)"> |
| <h3>getLoadedCachedBlocksByFile</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="BlockCacheUtil.CachedBlocksByFile.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheUtil.CachedBlocksByFile</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-161">getLoadedCachedBlocksByFile</a></span><wbr><span class="parameters">(org.apache.hadoop.conf.Configuration conf, |
| <a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCache</a> bc)</span></div> |
| <div class="block">Get a <a href="BlockCacheUtil.CachedBlocksByFile.html" title="class in org.apache.hadoop.hbase.io.hfile"><code>BlockCacheUtil.CachedBlocksByFile</code></a> instance and load it up by iterating content in |
| <a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile"><code>BlockCache</code></a>.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>conf</code> - Used to read configurations</dd> |
| <dd><code>bc</code> - Block Cache to iterate.</dd> |
| <dt>Returns:</dt> |
| <dd>Laoded up instance of CachedBlocksByFile</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="compareCacheBlock(org.apache.hadoop.hbase.io.hfile.Cacheable,org.apache.hadoop.hbase.io.hfile.Cacheable,boolean)"> |
| <h3>compareCacheBlock</h3> |
| <div class="member-signature"><span class="modifiers">private static</span> <span class="return-type">int</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-170">compareCacheBlock</a></span><wbr><span class="parameters">(<a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> left, |
| <a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> right, |
| boolean includeNextBlockMetadata)</span></div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="validateBlockAddition(org.apache.hadoop.hbase.io.hfile.Cacheable,org.apache.hadoop.hbase.io.hfile.Cacheable,org.apache.hadoop.hbase.io.hfile.BlockCacheKey)"> |
| <h3>validateBlockAddition</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-189">validateBlockAddition</a></span><wbr><span class="parameters">(<a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> existing, |
| <a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> newBlock, |
| <a href="BlockCacheKey.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheKey</a> cacheKey)</span></div> |
| <div class="block">Validate that the existing and newBlock are the same without including the nextBlockMetadata, |
| if not, throw an exception. If they are the same without the nextBlockMetadata, return the |
| comparison.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>existing</code> - block that is existing in the cache.</dd> |
| <dd><code>newBlock</code> - block that is trying to be cached.</dd> |
| <dd><code>cacheKey</code> - the cache key of the blocks.</dd> |
| <dt>Returns:</dt> |
| <dd>comparison of the existing block to the newBlock.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="shouldReplaceExistingCacheBlock(org.apache.hadoop.hbase.io.hfile.BlockCache,org.apache.hadoop.hbase.io.hfile.BlockCacheKey,org.apache.hadoop.hbase.io.hfile.Cacheable)"> |
| <h3>shouldReplaceExistingCacheBlock</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">boolean</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-217">shouldReplaceExistingCacheBlock</a></span><wbr><span class="parameters">(<a href="BlockCache.html" title="interface in org.apache.hadoop.hbase.io.hfile">BlockCache</a> blockCache, |
| <a href="BlockCacheKey.html" title="class in org.apache.hadoop.hbase.io.hfile">BlockCacheKey</a> cacheKey, |
| <a href="Cacheable.html" title="interface in org.apache.hadoop.hbase.io.hfile">Cacheable</a> newBlock)</span></div> |
| <div class="block">Because of the region splitting, it's possible that the split key locate in the middle of a |
| block. So it's possible that both the daughter regions load the same block from their parent |
| HFile. When pread, we don't force the read to read all of the next block header. So when two |
| threads try to cache the same block, it's possible that one thread read all of the next block |
| header but the other one didn't. if the already cached block hasn't next block header but the |
| new block to cache has, then we can replace the existing block with the new block for better |
| performance.(HBASE-20447)</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>blockCache</code> - BlockCache to check</dd> |
| <dd><code>cacheKey</code> - the block cache key</dd> |
| <dd><code>newBlock</code> - the new block which try to put into the block cache.</dd> |
| <dt>Returns:</dt> |
| <dd>true means need to replace existing block with new block for the same block cache key. |
| false means just keep the existing block.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getMaxCachedBlocksByFile(org.apache.hadoop.conf.Configuration)"> |
| <h3>getMaxCachedBlocksByFile</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type">int</span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-247">getMaxCachedBlocksByFile</a></span><wbr><span class="parameters">(org.apache.hadoop.conf.Configuration conf)</span></div> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="getBlockForCaching(org.apache.hadoop.hbase.io.hfile.CacheConfig,org.apache.hadoop.hbase.io.hfile.HFileBlock)"> |
| <h3>getBlockForCaching</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-260">getBlockForCaching</a></span><wbr><span class="parameters">(<a href="CacheConfig.html" title="class in org.apache.hadoop.hbase.io.hfile">CacheConfig</a> cacheConf, |
| <a href="HFileBlock.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileBlock</a> block)</span></div> |
| <div class="block">Similarly to HFileBlock.Writer.getBlockForCaching(), creates a HFileBlock instance without |
| checksum for caching. This is needed for when we cache blocks via readers (either prefetch or |
| client read), otherwise we may fail equality comparison when checking against same block that |
| may already have been cached at write time.</div> |
| <dl class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>cacheConf</code> - the related CacheConfig object.</dd> |
| <dd><code>block</code> - the HFileBlock instance to be converted.</dd> |
| <dt>Returns:</dt> |
| <dd>the resulting HFileBlock instance without checksum.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="cloneContext(org.apache.hadoop.hbase.io.hfile.HFileContext)"> |
| <h3>cloneContext</h3> |
| <div class="member-signature"><span class="modifiers">public static</span> <span class="return-type"><a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a></span> <span class="element-name"><a href="../../../../../../src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html#line-278">cloneContext</a></span><wbr><span class="parameters">(<a href="HFileContext.html" title="class in org.apache.hadoop.hbase.io.hfile">HFileContext</a> context)</span></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| <footer role="contentinfo"> |
| <hr> |
| <p class="legal-copy"><small>Copyright © 2007–2020 <a href="https://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> |
| </footer> |
| </div> |
| </div> |
| </body> |
| </html> |