Added: hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html (added) +++ hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,424 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- NewPage --> +<html lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> +<title>HeapMemorySizeUtil (HBase 2.0.0-SNAPSHOT API)</title> +<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<script type="text/javascript"><!-- + if (location.href.indexOf('is-external=true') == -1) { + parent.document.title="HeapMemorySizeUtil (HBase 2.0.0-SNAPSHOT API)"; + } +//--> +</script> +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<!-- ========= START OF TOP NAVBAR ======= --> +<div class="topNav"><a name="navbar_top"> +<!-- --> +</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> +<!-- --> +</a> +<ul class="navList" title="Navigation"> +<li><a href="../../../../../../overview-summary.html">Overview</a></li> +<li><a href="package-summary.html">Package</a></li> +<li class="navBarCell1Rev">Class</li> +<li><a href="class-use/HeapMemorySizeUtil.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">Help</a></li> +</ul> +</div> +<div class="subNav"> +<ul class="navList"> +<li><a href="../../../../../../org/apache/hadoop/hbase/io/util/Dictionary.html" title="interface in org.apache.hadoop.hbase.io.util"><span class="strong">Prev Class</span></a></li> +<li><a href="../../../../../../org/apache/hadoop/hbase/io/util/LRUDictionary.html" title="class in org.apache.hadoop.hbase.io.util"><span class="strong">Next Class</span></a></li> +</ul> +<ul class="navList"> +<li><a href="../../../../../../index.html?org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html" target="_top">Frames</a></li> +<li><a href="HeapMemorySizeUtil.html" target="_top">No Frames</a></li> +</ul> +<ul class="navList" id="allclasses_navbar_top"> +<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> +</ul> +<div> +<script type="text/javascript"><!-- + allClassesLink = document.getElementById("allclasses_navbar_top"); + if(window==top) { + allClassesLink.style.display = "block"; + } + else { + allClassesLink.style.display = "none"; + } + //--> +</script> +</div> +<div> +<ul class="subNavList"> +<li>Summary: </li> +<li>Nested | </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="subNavList"> +<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> +<a name="skip-navbar_top"> +<!-- --> +</a></div> +<!-- ========= END OF TOP NAVBAR ========= --> +<!-- ======== START OF CLASS DATA ======== --> +<div class="header"> +<div class="subTitle">org.apache.hadoop.hbase.io.util</div> +<h2 title="Class HeapMemorySizeUtil" class="title">Class HeapMemorySizeUtil</h2> +</div> +<div class="contentContainer"> +<ul class="inheritance"> +<li><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> +<li> +<ul class="inheritance"> +<li>org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil</li> +</ul> +</li> +</ul> +<div class="description"> +<ul class="blockList"> +<li class="blockList"> +<hr> +<br> +<pre>@InterfaceAudience.Private +public class <span class="strong">HeapMemorySizeUtil</span> +extends <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> +</li> +</ul> +</div> +<div class="summary"> +<ul class="blockList"> +<li class="blockList"> +<!-- =========== FIELD SUMMARY =========== --> +<ul class="blockList"> +<li class="blockList"><a name="field_summary"> +<!-- --> +</a> +<h3>Field Summary</h3> +<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> +<caption><span>Fields</span><span class="tabEnd"> </span></caption> +<tr> +<th class="colFirst" scope="col">Modifier and Type</th> +<th class="colLast" scope="col">Field and Description</th> +</tr> +<tr class="altColor"> +<td class="colFirst"><code>static float</code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#DEFAULT_MEMSTORE_SIZE">DEFAULT_MEMSTORE_SIZE</a></strong></code> </td> +</tr> +<tr class="rowColor"> +<td class="colFirst"><code>static float</code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#DEFAULT_MEMSTORE_SIZE_LOWER_LIMIT">DEFAULT_MEMSTORE_SIZE_LOWER_LIMIT</a></strong></code> </td> +</tr> +<tr class="altColor"> +<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#MEMSTORE_SIZE_KEY">MEMSTORE_SIZE_KEY</a></strong></code> </td> +</tr> +<tr class="rowColor"> +<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#MEMSTORE_SIZE_LOWER_LIMIT_KEY">MEMSTORE_SIZE_LOWER_LIMIT_KEY</a></strong></code> </td> +</tr> +<tr class="altColor"> +<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY">MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY</a></strong></code> </td> +</tr> +<tr class="rowColor"> +<td class="colFirst"><code>static <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a></code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#MEMSTORE_SIZE_OLD_KEY">MEMSTORE_SIZE_OLD_KEY</a></strong></code> </td> +</tr> +</table> +</li> +</ul> +<!-- ======== CONSTRUCTOR SUMMARY ======== --> +<ul class="blockList"> +<li class="blockList"><a name="constructor_summary"> +<!-- --> +</a> +<h3>Constructor Summary</h3> +<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> +<caption><span>Constructors</span><span class="tabEnd"> </span></caption> +<tr> +<th class="colOne" scope="col">Constructor and Description</th> +</tr> +<tr class="altColor"> +<td class="colOne"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#HeapMemorySizeUtil()">HeapMemorySizeUtil</a></strong>()</code> </td> +</tr> +</table> +</li> +</ul> +<!-- ========== METHOD SUMMARY =========== --> +<ul class="blockList"> +<li class="blockList"><a name="method_summary"> +<!-- --> +</a> +<h3>Method Summary</h3> +<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> +<caption><span>Methods</span><span class="tabEnd"> </span></caption> +<tr> +<th class="colFirst" scope="col">Modifier and Type</th> +<th class="colLast" scope="col">Method and Description</th> +</tr> +<tr class="altColor"> +<td class="colFirst"><code>static void</code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#checkForClusterFreeMemoryLimit(org.apache.hadoop.conf.Configuration)">checkForClusterFreeMemoryLimit</a></strong>(org.apache.hadoop.conf.Configuration conf)</code> +<div class="block">Checks whether we have enough heap memory left out after portion for Memstore and Block cache.</div> +</td> +</tr> +<tr class="rowColor"> +<td class="colFirst"><code>static float</code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#getBlockCacheHeapPercent(org.apache.hadoop.conf.Configuration)">getBlockCacheHeapPercent</a></strong>(org.apache.hadoop.conf.Configuration conf)</code> +<div class="block">Retrieve configured size for on heap block cache as percentage of total heap.</div> +</td> +</tr> +<tr class="altColor"> +<td class="colFirst"><code>static float</code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#getGlobalMemStoreLowerMark(org.apache.hadoop.conf.Configuration, float)">getGlobalMemStoreLowerMark</a></strong>(org.apache.hadoop.conf.Configuration c, + float globalMemStorePercent)</code> +<div class="block">Retrieve configured size for global memstore lower water mark as percentage of total heap.</div> +</td> +</tr> +<tr class="rowColor"> +<td class="colFirst"><code>static float</code></td> +<td class="colLast"><code><strong><a href="../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html#getGlobalMemStorePercent(org.apache.hadoop.conf.Configuration, boolean)">getGlobalMemStorePercent</a></strong>(org.apache.hadoop.conf.Configuration c, + boolean logInvalid)</code> +<div class="block">Retrieve global memstore configured size as percentage of total heap.</div> +</td> +</tr> +</table> +<ul class="blockList"> +<li class="blockList"><a name="methods_inherited_from_class_java.lang.Object"> +<!-- --> +</a> +<h3>Methods inherited from class java.lang.<a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> +<code><a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#clone()" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#finalize()" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang /Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#toString()" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</a></code></li> +</ul> +</li> +</ul> +</li> +</ul> +</div> +<div class="details"> +<ul class="blockList"> +<li class="blockList"> +<!-- ============ FIELD DETAIL =========== --> +<ul class="blockList"> +<li class="blockList"><a name="field_detail"> +<!-- --> +</a> +<h3>Field Detail</h3> +<a name="MEMSTORE_SIZE_KEY"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>MEMSTORE_SIZE_KEY</h4> +<pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> MEMSTORE_SIZE_KEY</pre> +<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil.MEMSTORE_SIZE_KEY">Constant Field Values</a></dd></dl> +</li> +</ul> +<a name="MEMSTORE_SIZE_OLD_KEY"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>MEMSTORE_SIZE_OLD_KEY</h4> +<pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> MEMSTORE_SIZE_OLD_KEY</pre> +<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil.MEMSTORE_SIZE_OLD_KEY">Constant Field Values</a></dd></dl> +</li> +</ul> +<a name="MEMSTORE_SIZE_LOWER_LIMIT_KEY"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>MEMSTORE_SIZE_LOWER_LIMIT_KEY</h4> +<pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> MEMSTORE_SIZE_LOWER_LIMIT_KEY</pre> +<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil.MEMSTORE_SIZE_LOWER_LIMIT_KEY">Constant Field Values</a></dd></dl> +</li> +</ul> +<a name="MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY</h4> +<pre>public static final <a href="http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a> MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY</pre> +<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil.MEMSTORE_SIZE_LOWER_LIMIT_OLD_KEY">Constant Field Values</a></dd></dl> +</li> +</ul> +<a name="DEFAULT_MEMSTORE_SIZE"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>DEFAULT_MEMSTORE_SIZE</h4> +<pre>public static final float DEFAULT_MEMSTORE_SIZE</pre> +<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil.DEFAULT_MEMSTORE_SIZE">Constant Field Values</a></dd></dl> +</li> +</ul> +<a name="DEFAULT_MEMSTORE_SIZE_LOWER_LIMIT"> +<!-- --> +</a> +<ul class="blockListLast"> +<li class="blockList"> +<h4>DEFAULT_MEMSTORE_SIZE_LOWER_LIMIT</h4> +<pre>public static final float DEFAULT_MEMSTORE_SIZE_LOWER_LIMIT</pre> +<dl><dt><span class="strong">See Also:</span></dt><dd><a href="../../../../../../constant-values.html#org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil.DEFAULT_MEMSTORE_SIZE_LOWER_LIMIT">Constant Field Values</a></dd></dl> +</li> +</ul> +</li> +</ul> +<!-- ========= CONSTRUCTOR DETAIL ======== --> +<ul class="blockList"> +<li class="blockList"><a name="constructor_detail"> +<!-- --> +</a> +<h3>Constructor Detail</h3> +<a name="HeapMemorySizeUtil()"> +<!-- --> +</a> +<ul class="blockListLast"> +<li class="blockList"> +<h4>HeapMemorySizeUtil</h4> +<pre>public HeapMemorySizeUtil()</pre> +</li> +</ul> +</li> +</ul> +<!-- ============ METHOD DETAIL ========== --> +<ul class="blockList"> +<li class="blockList"><a name="method_detail"> +<!-- --> +</a> +<h3>Method Detail</h3> +<a name="checkForClusterFreeMemoryLimit(org.apache.hadoop.conf.Configuration)"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>checkForClusterFreeMemoryLimit</h4> +<pre>public static void checkForClusterFreeMemoryLimit(org.apache.hadoop.conf.Configuration conf)</pre> +<div class="block">Checks whether we have enough heap memory left out after portion for Memstore and Block cache. + We need atleast 20% of heap left out for other RS functions.</div> +<dl><dt><span class="strong">Parameters:</span></dt><dd><code>conf</code> - </dd></dl> +</li> +</ul> +<a name="getGlobalMemStorePercent(org.apache.hadoop.conf.Configuration, boolean)"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getGlobalMemStorePercent</h4> +<pre>public static float getGlobalMemStorePercent(org.apache.hadoop.conf.Configuration c, + boolean logInvalid)</pre> +<div class="block">Retrieve global memstore configured size as percentage of total heap.</div> +<dl><dt><span class="strong">Parameters:</span></dt><dd><code>c</code> - </dd><dd><code>logInvalid</code> - </dd></dl> +</li> +</ul> +<a name="getGlobalMemStoreLowerMark(org.apache.hadoop.conf.Configuration, float)"> +<!-- --> +</a> +<ul class="blockList"> +<li class="blockList"> +<h4>getGlobalMemStoreLowerMark</h4> +<pre>public static float getGlobalMemStoreLowerMark(org.apache.hadoop.conf.Configuration c, + float globalMemStorePercent)</pre> +<div class="block">Retrieve configured size for global memstore lower water mark as percentage of total heap.</div> +<dl><dt><span class="strong">Parameters:</span></dt><dd><code>c</code> - </dd><dd><code>globalMemStorePercent</code> - </dd></dl> +</li> +</ul> +<a name="getBlockCacheHeapPercent(org.apache.hadoop.conf.Configuration)"> +<!-- --> +</a> +<ul class="blockListLast"> +<li class="blockList"> +<h4>getBlockCacheHeapPercent</h4> +<pre>public static float getBlockCacheHeapPercent(org.apache.hadoop.conf.Configuration conf)</pre> +<div class="block">Retrieve configured size for on heap block cache as percentage of total heap.</div> +<dl><dt><span class="strong">Parameters:</span></dt><dd><code>conf</code> - </dd></dl> +</li> +</ul> +</li> +</ul> +</li> +</ul> +</div> +</div> +<!-- ========= END OF CLASS DATA ========= --> +<!-- ======= START OF BOTTOM NAVBAR ====== --> +<div class="bottomNav"><a name="navbar_bottom"> +<!-- --> +</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> +<!-- --> +</a> +<ul class="navList" title="Navigation"> +<li><a href="../../../../../../overview-summary.html">Overview</a></li> +<li><a href="package-summary.html">Package</a></li> +<li class="navBarCell1Rev">Class</li> +<li><a href="class-use/HeapMemorySizeUtil.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">Help</a></li> +</ul> +</div> +<div class="subNav"> +<ul class="navList"> +<li><a href="../../../../../../org/apache/hadoop/hbase/io/util/Dictionary.html" title="interface in org.apache.hadoop.hbase.io.util"><span class="strong">Prev Class</span></a></li> +<li><a href="../../../../../../org/apache/hadoop/hbase/io/util/LRUDictionary.html" title="class in org.apache.hadoop.hbase.io.util"><span class="strong">Next Class</span></a></li> +</ul> +<ul class="navList"> +<li><a href="../../../../../../index.html?org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html" target="_top">Frames</a></li> +<li><a href="HeapMemorySizeUtil.html" target="_top">No Frames</a></li> +</ul> +<ul class="navList" id="allclasses_navbar_bottom"> +<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li> +</ul> +<div> +<script type="text/javascript"><!-- + allClassesLink = document.getElementById("allclasses_navbar_bottom"); + if(window==top) { + allClassesLink.style.display = "block"; + } + else { + allClassesLink.style.display = "none"; + } + //--> +</script> +</div> +<div> +<ul class="subNavList"> +<li>Summary: </li> +<li>Nested | </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="subNavList"> +<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> +<a name="skip-navbar_bottom"> +<!-- --> +</a></div> +<!-- ======== END OF BOTTOM NAVBAR ======= --> +<p class="legalCopy"><small>Copyright © 2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> +</body> +</html>
Added: hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/class-use/HeapMemorySizeUtil.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/class-use/HeapMemorySizeUtil.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/class-use/HeapMemorySizeUtil.html (added) +++ hbase/hbase.apache.org/trunk/devapidocs/org/apache/hadoop/hbase/io/util/class-use/HeapMemorySizeUtil.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,115 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> +<!-- NewPage --> +<html lang="en"> +<head> +<meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> +<title>Uses of Class org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil (HBase 2.0.0-SNAPSHOT API)</title> +<link rel="stylesheet" type="text/css" href="../../../../../../../stylesheet.css" title="Style"> +</head> +<body> +<script type="text/javascript"><!-- + if (location.href.indexOf('is-external=true') == -1) { + parent.document.title="Uses of Class org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil (HBase 2.0.0-SNAPSHOT API)"; + } +//--> +</script> +<noscript> +<div>JavaScript is disabled on your browser.</div> +</noscript> +<!-- ========= START OF TOP NAVBAR ======= --> +<div class="topNav"><a name="navbar_top"> +<!-- --> +</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> +<!-- --> +</a> +<ul class="navList" title="Navigation"> +<li><a href="../../../../../../../overview-summary.html">Overview</a></li> +<li><a href="../package-summary.html">Package</a></li> +<li><a href="../../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html" title="class in org.apache.hadoop.hbase.io.util">Class</a></li> +<li class="navBarCell1Rev">Use</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">Help</a></li> +</ul> +</div> +<div class="subNav"> +<ul class="navList"> +<li>Prev</li> +<li>Next</li> +</ul> +<ul class="navList"> +<li><a href="../../../../../../../index.html?org/apache/hadoop/hbase/io/util/class-use/HeapMemorySizeUtil.html" target="_top">Frames</a></li> +<li><a href="HeapMemorySizeUtil.html" target="_top">No Frames</a></li> +</ul> +<ul class="navList" id="allclasses_navbar_top"> +<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> +</ul> +<div> +<script type="text/javascript"><!-- + allClassesLink = document.getElementById("allclasses_navbar_top"); + if(window==top) { + allClassesLink.style.display = "block"; + } + else { + allClassesLink.style.display = "none"; + } + //--> +</script> +</div> +<a name="skip-navbar_top"> +<!-- --> +</a></div> +<!-- ========= END OF TOP NAVBAR ========= --> +<div class="header"> +<h2 title="Uses of Class org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil" class="title">Uses of Class<br>org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil</h2> +</div> +<div class="classUseContainer">No usage of org.apache.hadoop.hbase.io.util.HeapMemorySizeUtil</div> +<!-- ======= START OF BOTTOM NAVBAR ====== --> +<div class="bottomNav"><a name="navbar_bottom"> +<!-- --> +</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> +<!-- --> +</a> +<ul class="navList" title="Navigation"> +<li><a href="../../../../../../../overview-summary.html">Overview</a></li> +<li><a href="../package-summary.html">Package</a></li> +<li><a href="../../../../../../../org/apache/hadoop/hbase/io/util/HeapMemorySizeUtil.html" title="class in org.apache.hadoop.hbase.io.util">Class</a></li> +<li class="navBarCell1Rev">Use</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">Help</a></li> +</ul> +</div> +<div class="subNav"> +<ul class="navList"> +<li>Prev</li> +<li>Next</li> +</ul> +<ul class="navList"> +<li><a href="../../../../../../../index.html?org/apache/hadoop/hbase/io/util/class-use/HeapMemorySizeUtil.html" target="_top">Frames</a></li> +<li><a href="HeapMemorySizeUtil.html" target="_top">No Frames</a></li> +</ul> +<ul class="navList" id="allclasses_navbar_bottom"> +<li><a href="../../../../../../../allclasses-noframe.html">All Classes</a></li> +</ul> +<div> +<script type="text/javascript"><!-- + allClassesLink = document.getElementById("allclasses_navbar_bottom"); + if(window==top) { + allClassesLink.style.display = "block"; + } + else { + allClassesLink.style.display = "none"; + } + //--> +</script> +</div> +<a name="skip-navbar_bottom"> +<!-- --> +</a></div> +<!-- ======== END OF BOTTOM NAVBAR ======= --> +<p class="legalCopy"><small>Copyright © 2014 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p> +</body> +</html> Added: hbase/hbase.apache.org/trunk/ld-d2012e1089.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/ld-d2012e1089.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/ld-d2012e1089.html (added) +++ hbase/hbase.apache.org/trunk/ld-d2012e1089.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,4 @@ +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Long Description</title><link rel="stylesheet" type="text/css" href="${baserdir}/src/main/site/resources/css/freebsd_docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><p>Illustration of the replication architecture in HBase, as described in the prior + text.</p></body></html> \ No newline at end of file Added: hbase/hbase.apache.org/trunk/ld-d4029e17132.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/ld-d4029e17132.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/ld-d4029e17132.html (added) +++ hbase/hbase.apache.org/trunk/ld-d4029e17132.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,4 @@ +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Long Description</title><link rel="stylesheet" type="text/css" href="${baserdir}/src/main/site/resources/css/freebsd_docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><p>Illustration of the replication architecture in HBase, as described in the prior + text.</p></body></html> \ No newline at end of file Added: hbase/hbase.apache.org/trunk/ld-d4029e21286.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/ld-d4029e21286.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/ld-d4029e21286.html (added) +++ hbase/hbase.apache.org/trunk/ld-d4029e21286.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,3 @@ +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Long Description</title><link rel="stylesheet" type="text/css" href="${baserdir}/src/main/site/resources/css/freebsd_docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><p></p></body></html> \ No newline at end of file Added: hbase/hbase.apache.org/trunk/ld-d4029e21296.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/ld-d4029e21296.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/ld-d4029e21296.html (added) +++ hbase/hbase.apache.org/trunk/ld-d4029e21296.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,3 @@ +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Long Description</title><link rel="stylesheet" type="text/css" href="${baserdir}/src/main/site/resources/css/freebsd_docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><p></p></body></html> \ No newline at end of file Added: hbase/hbase.apache.org/trunk/ld-d4029e21311.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/ld-d4029e21311.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/ld-d4029e21311.html (added) +++ hbase/hbase.apache.org/trunk/ld-d4029e21311.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,3 @@ +<html><head> + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> + <title>Long Description</title><link rel="stylesheet" type="text/css" href="${baserdir}/src/main/site/resources/css/freebsd_docbook.css"><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><p></p></body></html> \ No newline at end of file Added: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketWriterThread.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketWriterThread.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketWriterThread.html (added) +++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/io/hfile/bucket/TestBucketWriterThread.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,184 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> +<title>TestBucketWriterThread xref</title> +<link type="text/css" rel="stylesheet" href="../../../../../../../stylesheet.css" /> +</head> +<body> +<pre> + +<a class="jxr_linenumber" name="1" href="#1">1</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="2" href="#2">2</a> <em class="jxr_javadoccomment"> * Copyright The Apache Software Foundation</em> +<a class="jxr_linenumber" name="3" href="#3">3</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="4" href="#4">4</a> <em class="jxr_javadoccomment"> * Licensed to the Apache Software Foundation (ASF) under one or more</em> +<a class="jxr_linenumber" name="5" href="#5">5</a> <em class="jxr_javadoccomment"> * contributor license agreements. See the NOTICE file distributed with this</em> +<a class="jxr_linenumber" name="6" href="#6">6</a> <em class="jxr_javadoccomment"> * work for additional information regarding copyright ownership. The ASF</em> +<a class="jxr_linenumber" name="7" href="#7">7</a> <em class="jxr_javadoccomment"> * licenses this file to you under the Apache License, Version 2.0 (the</em> +<a class="jxr_linenumber" name="8" href="#8">8</a> <em class="jxr_javadoccomment"> * "License"); you may not use this file except in compliance with the License.</em> +<a class="jxr_linenumber" name="9" href="#9">9</a> <em class="jxr_javadoccomment"> * You may obtain a copy of the License at</em> +<a class="jxr_linenumber" name="10" href="#10">10</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="11" href="#11">11</a> <em class="jxr_javadoccomment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em> +<a class="jxr_linenumber" name="12" href="#12">12</a> <em class="jxr_javadoccomment"> *</em> +<a class="jxr_linenumber" name="13" href="#13">13</a> <em class="jxr_javadoccomment"> * Unless required by applicable law or agreed to in writing, software</em> +<a class="jxr_linenumber" name="14" href="#14">14</a> <em class="jxr_javadoccomment"> * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT</em> +<a class="jxr_linenumber" name="15" href="#15">15</a> <em class="jxr_javadoccomment"> * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the</em> +<a class="jxr_linenumber" name="16" href="#16">16</a> <em class="jxr_javadoccomment"> * License for the specific language governing permissions and limitations</em> +<a class="jxr_linenumber" name="17" href="#17">17</a> <em class="jxr_javadoccomment"> * under the License.</em> +<a class="jxr_linenumber" name="18" href="#18">18</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="19" href="#19">19</a> <strong class="jxr_keyword">package</strong> org.apache.hadoop.hbase.io.hfile.bucket; +<a class="jxr_linenumber" name="20" href="#20">20</a> +<a class="jxr_linenumber" name="21" href="#21">21</a> <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertEquals; +<a class="jxr_linenumber" name="22" href="#22">22</a> <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertTrue; +<a class="jxr_linenumber" name="23" href="#23">23</a> +<a class="jxr_linenumber" name="24" href="#24">24</a> <strong class="jxr_keyword">import</strong> java.io.FileNotFoundException; +<a class="jxr_linenumber" name="25" href="#25">25</a> <strong class="jxr_keyword">import</strong> java.io.IOException; +<a class="jxr_linenumber" name="26" href="#26">26</a> <strong class="jxr_keyword">import</strong> java.util.ArrayList; +<a class="jxr_linenumber" name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> java.util.List; +<a class="jxr_linenumber" name="28" href="#28">28</a> <strong class="jxr_keyword">import</strong> java.util.concurrent.BlockingQueue; +<a class="jxr_linenumber" name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> java.util.concurrent.atomic.AtomicLong; +<a class="jxr_linenumber" name="30" href="#30">30</a> +<a class="jxr_linenumber" name="31" href="#31">31</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.SmallTests; +<a class="jxr_linenumber" name="32" href="#32">32</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.hfile.BlockCacheKey; +<a class="jxr_linenumber" name="33" href="#33">33</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.hfile.Cacheable; +<a class="jxr_linenumber" name="34" href="#34">34</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.BucketEntry; +<a class="jxr_linenumber" name="35" href="#35">35</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.hfile.bucket.BucketCache.RAMQueueEntry; +<a class="jxr_linenumber" name="36" href="#36">36</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Threads; +<a class="jxr_linenumber" name="37" href="#37">37</a> <strong class="jxr_keyword">import</strong> org.junit.After; +<a class="jxr_linenumber" name="38" href="#38">38</a> <strong class="jxr_keyword">import</strong> org.junit.Before; +<a class="jxr_linenumber" name="39" href="#39">39</a> <strong class="jxr_keyword">import</strong> org.junit.Test; +<a class="jxr_linenumber" name="40" href="#40">40</a> <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category; +<a class="jxr_linenumber" name="41" href="#41">41</a> <strong class="jxr_keyword">import</strong> org.mockito.Mockito; +<a class="jxr_linenumber" name="42" href="#42">42</a> +<a class="jxr_linenumber" name="43" href="#43">43</a> @Category(SmallTests.<strong class="jxr_keyword">class</strong>) +<a class="jxr_linenumber" name="44" href="#44">44</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../../org/apache/hadoop/hbase/io/hfile/bucket/TestBucketWriterThread.html">TestBucketWriterThread</a> { +<a class="jxr_linenumber" name="45" href="#45">45</a> <strong class="jxr_keyword">private</strong> BucketCache bc; +<a class="jxr_linenumber" name="46" href="#46">46</a> <strong class="jxr_keyword">private</strong> BucketCache.WriterThread wt; +<a class="jxr_linenumber" name="47" href="#47">47</a> <strong class="jxr_keyword">private</strong> BlockingQueue<RAMQueueEntry> q; +<a class="jxr_linenumber" name="48" href="#48">48</a> <strong class="jxr_keyword">private</strong> Cacheable plainCacheable; +<a class="jxr_linenumber" name="49" href="#49">49</a> <strong class="jxr_keyword">private</strong> BlockCacheKey plainKey; +<a class="jxr_linenumber" name="50" href="#50">50</a> +<a class="jxr_linenumber" name="51" href="#51">51</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="52" href="#52">52</a> <em class="jxr_javadoccomment"> * Set up variables and get BucketCache and WriterThread into state where tests can manually</em> +<a class="jxr_linenumber" name="53" href="#53">53</a> <em class="jxr_javadoccomment"> * control the running of WriterThread and BucketCache is empty.</em> +<a class="jxr_linenumber" name="54" href="#54">54</a> <em class="jxr_javadoccomment"> * @throws Exception</em> +<a class="jxr_linenumber" name="55" href="#55">55</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="56" href="#56">56</a> @Before +<a class="jxr_linenumber" name="57" href="#57">57</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> setUp() <strong class="jxr_keyword">throws</strong> Exception { +<a class="jxr_linenumber" name="58" href="#58">58</a> <em class="jxr_comment">// Arbitrary capacity.</em> +<a class="jxr_linenumber" name="59" href="#59">59</a> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> capacity = 16; +<a class="jxr_linenumber" name="60" href="#60">60</a> <em class="jxr_comment">// Run with one writer thread only. Means there will be one writer queue only too. We depend</em> +<a class="jxr_linenumber" name="61" href="#61">61</a> <em class="jxr_comment">// on this in below.</em> +<a class="jxr_linenumber" name="62" href="#62">62</a> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> writerThreadsCount = 1; +<a class="jxr_linenumber" name="63" href="#63">63</a> <strong class="jxr_keyword">this</strong>.bc = <strong class="jxr_keyword">new</strong> BucketCache(<span class="jxr_string">"heap"</span>, capacity, 1, <strong class="jxr_keyword">new</strong> <strong class="jxr_keyword">int</strong> [] {1}, writerThreadsCount, +<a class="jxr_linenumber" name="64" href="#64">64</a> capacity, <strong class="jxr_keyword">null</strong>, 100<em class="jxr_comment">/*<em class="jxr_comment">Tolerate ioerrors for 100ms*/</em>);</em> +<a class="jxr_linenumber" name="65" href="#65">65</a> assertEquals(writerThreadsCount, bc.writerThreads.length); +<a class="jxr_linenumber" name="66" href="#66">66</a> assertEquals(writerThreadsCount, bc.writerQueues.size()); +<a class="jxr_linenumber" name="67" href="#67">67</a> <em class="jxr_comment">// Get reference to our single WriterThread instance.</em> +<a class="jxr_linenumber" name="68" href="#68">68</a> <strong class="jxr_keyword">this</strong>.wt = bc.writerThreads[0]; +<a class="jxr_linenumber" name="69" href="#69">69</a> <strong class="jxr_keyword">this</strong>.q = bc.writerQueues.get(0); +<a class="jxr_linenumber" name="70" href="#70">70</a> <em class="jxr_comment">// On construction bucketcache WriterThread is blocked on the writer queue so it will not</em> +<a class="jxr_linenumber" name="71" href="#71">71</a> <em class="jxr_comment">// notice the disabling of the writer until after it has processed an entry. Lets pass one</em> +<a class="jxr_linenumber" name="72" href="#72">72</a> <em class="jxr_comment">// through after setting disable flag on the writer. We want to disable the WriterThread so</em> +<a class="jxr_linenumber" name="73" href="#73">73</a> <em class="jxr_comment">// we can run the doDrain manually so we can watch it working and assert it doing right thing.</em> +<a class="jxr_linenumber" name="74" href="#74">74</a> wt.disableWriter(); +<a class="jxr_linenumber" name="75" href="#75">75</a> <strong class="jxr_keyword">this</strong>.plainKey = <strong class="jxr_keyword">new</strong> BlockCacheKey(<span class="jxr_string">"f"</span>, 0); +<a class="jxr_linenumber" name="76" href="#76">76</a> <strong class="jxr_keyword">this</strong>.plainCacheable = Mockito.mock(Cacheable.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="77" href="#77">77</a> bc.cacheBlock(<strong class="jxr_keyword">this</strong>.plainKey, plainCacheable); +<a class="jxr_linenumber" name="78" href="#78">78</a> <strong class="jxr_keyword">while</strong>(!bc.ramCache.isEmpty()) Threads.sleep(1); +<a class="jxr_linenumber" name="79" href="#79">79</a> assertTrue(q.isEmpty()); +<a class="jxr_linenumber" name="80" href="#80">80</a> <em class="jxr_comment">// Now writer thread should be disabled.</em> +<a class="jxr_linenumber" name="81" href="#81">81</a> } +<a class="jxr_linenumber" name="82" href="#82">82</a> +<a class="jxr_linenumber" name="83" href="#83">83</a> @After +<a class="jxr_linenumber" name="84" href="#84">84</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> tearDown() <strong class="jxr_keyword">throws</strong> Exception { +<a class="jxr_linenumber" name="85" href="#85">85</a> <strong class="jxr_keyword">if</strong> (<strong class="jxr_keyword">this</strong>.bc != <strong class="jxr_keyword">null</strong>) <strong class="jxr_keyword">this</strong>.bc.shutdown(); +<a class="jxr_linenumber" name="86" href="#86">86</a> } +<a class="jxr_linenumber" name="87" href="#87">87</a> +<a class="jxr_linenumber" name="88" href="#88">88</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="89" href="#89">89</a> <em class="jxr_javadoccomment"> * Test non-error case just works.</em> +<a class="jxr_linenumber" name="90" href="#90">90</a> <em class="jxr_javadoccomment"> * @throws FileNotFoundException</em> +<a class="jxr_linenumber" name="91" href="#91">91</a> <em class="jxr_javadoccomment"> * @throws IOException</em> +<a class="jxr_linenumber" name="92" href="#92">92</a> <em class="jxr_javadoccomment"> * @throws InterruptedException</em> +<a class="jxr_linenumber" name="93" href="#93">93</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="94" href="#94">94</a> @Test (timeout=30000) +<a class="jxr_linenumber" name="95" href="#95">95</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testNonErrorCase() +<a class="jxr_linenumber" name="96" href="#96">96</a> <strong class="jxr_keyword">throws</strong> FileNotFoundException, IOException, InterruptedException { +<a class="jxr_linenumber" name="97" href="#97">97</a> bc.cacheBlock(<strong class="jxr_keyword">this</strong>.plainKey, <strong class="jxr_keyword">this</strong>.plainCacheable); +<a class="jxr_linenumber" name="98" href="#98">98</a> doDrainOfOneEntry(<strong class="jxr_keyword">this</strong>.bc, <strong class="jxr_keyword">this</strong>.wt, <strong class="jxr_keyword">this</strong>.q); +<a class="jxr_linenumber" name="99" href="#99">99</a> } +<a class="jxr_linenumber" name="100" href="#100">100</a> +<a class="jxr_linenumber" name="101" href="#101">101</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="102" href="#102">102</a> <em class="jxr_javadoccomment"> * Pass through a too big entry and ensure it is cleared from queues and ramCache.</em> +<a class="jxr_linenumber" name="103" href="#103">103</a> <em class="jxr_javadoccomment"> * Manually run the WriterThread.</em> +<a class="jxr_linenumber" name="104" href="#104">104</a> <em class="jxr_javadoccomment"> * @throws InterruptedException </em> +<a class="jxr_linenumber" name="105" href="#105">105</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="106" href="#106">106</a> @Test +<a class="jxr_linenumber" name="107" href="#107">107</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testTooBigEntry() <strong class="jxr_keyword">throws</strong> InterruptedException { +<a class="jxr_linenumber" name="108" href="#108">108</a> Cacheable tooBigCacheable = Mockito.mock(Cacheable.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="109" href="#109">109</a> Mockito.when(tooBigCacheable.getSerializedLength()).thenReturn(Integer.MAX_VALUE); +<a class="jxr_linenumber" name="110" href="#110">110</a> <strong class="jxr_keyword">this</strong>.bc.cacheBlock(<strong class="jxr_keyword">this</strong>.plainKey, tooBigCacheable); +<a class="jxr_linenumber" name="111" href="#111">111</a> doDrainOfOneEntry(<strong class="jxr_keyword">this</strong>.bc, <strong class="jxr_keyword">this</strong>.wt, <strong class="jxr_keyword">this</strong>.q); +<a class="jxr_linenumber" name="112" href="#112">112</a> } +<a class="jxr_linenumber" name="113" href="#113">113</a> +<a class="jxr_linenumber" name="114" href="#114">114</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="115" href="#115">115</a> <em class="jxr_javadoccomment"> * Do IOE. Take the RAMQueueEntry that was on the queue, doctor it to throw exception, then</em> +<a class="jxr_linenumber" name="116" href="#116">116</a> <em class="jxr_javadoccomment"> * put it back and process it.</em> +<a class="jxr_linenumber" name="117" href="#117">117</a> <em class="jxr_javadoccomment"> * @throws IOException </em> +<a class="jxr_linenumber" name="118" href="#118">118</a> <em class="jxr_javadoccomment"> * @throws BucketAllocatorException </em> +<a class="jxr_linenumber" name="119" href="#119">119</a> <em class="jxr_javadoccomment"> * @throws CacheFullException </em> +<a class="jxr_linenumber" name="120" href="#120">120</a> <em class="jxr_javadoccomment"> * @throws InterruptedException </em> +<a class="jxr_linenumber" name="121" href="#121">121</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="122" href="#122">122</a> @SuppressWarnings(<span class="jxr_string">"unchecked"</span>) +<a class="jxr_linenumber" name="123" href="#123">123</a> @Test (timeout=30000) +<a class="jxr_linenumber" name="124" href="#124">124</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testIOE() +<a class="jxr_linenumber" name="125" href="#125">125</a> <strong class="jxr_keyword">throws</strong> CacheFullException, BucketAllocatorException, IOException, InterruptedException { +<a class="jxr_linenumber" name="126" href="#126">126</a> <strong class="jxr_keyword">this</strong>.bc.cacheBlock(<strong class="jxr_keyword">this</strong>.plainKey, plainCacheable); +<a class="jxr_linenumber" name="127" href="#127">127</a> RAMQueueEntry rqe = q.remove(); +<a class="jxr_linenumber" name="128" href="#128">128</a> RAMQueueEntry spiedRqe = Mockito.spy(rqe); +<a class="jxr_linenumber" name="129" href="#129">129</a> Mockito.doThrow(<strong class="jxr_keyword">new</strong> IOException(<span class="jxr_string">"Mocked!"</span>)).when(spiedRqe). +<a class="jxr_linenumber" name="130" href="#130">130</a> writeToCache((IOEngine)Mockito.any(), (BucketAllocator)Mockito.any(), +<a class="jxr_linenumber" name="131" href="#131">131</a> (UniqueIndexMap<Integer>)Mockito.any(), (AtomicLong)Mockito.any()); +<a class="jxr_linenumber" name="132" href="#132">132</a> <strong class="jxr_keyword">this</strong>.q.add(spiedRqe); +<a class="jxr_linenumber" name="133" href="#133">133</a> doDrainOfOneEntry(bc, wt, q); +<a class="jxr_linenumber" name="134" href="#134">134</a> <em class="jxr_comment">// Cache disabled when ioes w/o ever healing.</em> +<a class="jxr_linenumber" name="135" href="#135">135</a> assertTrue(!bc.isCacheEnabled()); +<a class="jxr_linenumber" name="136" href="#136">136</a> } +<a class="jxr_linenumber" name="137" href="#137">137</a> +<a class="jxr_linenumber" name="138" href="#138">138</a> <em class="jxr_javadoccomment">/**</em> +<a class="jxr_linenumber" name="139" href="#139">139</a> <em class="jxr_javadoccomment"> * Do Cache full exception</em> +<a class="jxr_linenumber" name="140" href="#140">140</a> <em class="jxr_javadoccomment"> * @throws IOException </em> +<a class="jxr_linenumber" name="141" href="#141">141</a> <em class="jxr_javadoccomment"> * @throws BucketAllocatorException </em> +<a class="jxr_linenumber" name="142" href="#142">142</a> <em class="jxr_javadoccomment"> * @throws CacheFullException </em> +<a class="jxr_linenumber" name="143" href="#143">143</a> <em class="jxr_javadoccomment"> * @throws InterruptedException </em> +<a class="jxr_linenumber" name="144" href="#144">144</a> <em class="jxr_javadoccomment"> */</em> +<a class="jxr_linenumber" name="145" href="#145">145</a> @Test (timeout=30000) +<a class="jxr_linenumber" name="146" href="#146">146</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testCacheFullException() +<a class="jxr_linenumber" name="147" href="#147">147</a> <strong class="jxr_keyword">throws</strong> CacheFullException, BucketAllocatorException, IOException, InterruptedException { +<a class="jxr_linenumber" name="148" href="#148">148</a> <strong class="jxr_keyword">this</strong>.bc.cacheBlock(<strong class="jxr_keyword">this</strong>.plainKey, plainCacheable); +<a class="jxr_linenumber" name="149" href="#149">149</a> RAMQueueEntry rqe = q.remove(); +<a class="jxr_linenumber" name="150" href="#150">150</a> RAMQueueEntry spiedRqe = Mockito.spy(rqe); +<a class="jxr_linenumber" name="151" href="#151">151</a> <strong class="jxr_keyword">final</strong> CacheFullException cfe = <strong class="jxr_keyword">new</strong> CacheFullException(0, 0); +<a class="jxr_linenumber" name="152" href="#152">152</a> BucketEntry mockedBucketEntry = Mockito.mock(BucketEntry.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="153" href="#153">153</a> Mockito.doThrow(cfe). +<a class="jxr_linenumber" name="154" href="#154">154</a> doReturn(mockedBucketEntry). +<a class="jxr_linenumber" name="155" href="#155">155</a> when(spiedRqe).writeToCache((IOEngine)Mockito.any(), (BucketAllocator)Mockito.any(), +<a class="jxr_linenumber" name="156" href="#156">156</a> (UniqueIndexMap<Integer>)Mockito.any(), (AtomicLong)Mockito.any()); +<a class="jxr_linenumber" name="157" href="#157">157</a> <strong class="jxr_keyword">this</strong>.q.add(spiedRqe); +<a class="jxr_linenumber" name="158" href="#158">158</a> doDrainOfOneEntry(bc, wt, q); +<a class="jxr_linenumber" name="159" href="#159">159</a> } +<a class="jxr_linenumber" name="160" href="#160">160</a> +<a class="jxr_linenumber" name="161" href="#161">161</a> <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> doDrainOfOneEntry(<strong class="jxr_keyword">final</strong> BucketCache bc, <strong class="jxr_keyword">final</strong> BucketCache.WriterThread wt, +<a class="jxr_linenumber" name="162" href="#162">162</a> <strong class="jxr_keyword">final</strong> BlockingQueue<RAMQueueEntry> q) +<a class="jxr_linenumber" name="163" href="#163">163</a> <strong class="jxr_keyword">throws</strong> InterruptedException { +<a class="jxr_linenumber" name="164" href="#164">164</a> List<RAMQueueEntry> rqes = BucketCache.getRAMQueueEntries(q, <strong class="jxr_keyword">new</strong> ArrayList<RAMQueueEntry>(1)); +<a class="jxr_linenumber" name="165" href="#165">165</a> wt.doDrain(rqes); +<a class="jxr_linenumber" name="166" href="#166">166</a> assertTrue(q.isEmpty()); +<a class="jxr_linenumber" name="167" href="#167">167</a> assertTrue(bc.ramCache.isEmpty()); +<a class="jxr_linenumber" name="168" href="#168">168</a> assertEquals(0, bc.heapSize()); +<a class="jxr_linenumber" name="169" href="#169">169</a> } +<a class="jxr_linenumber" name="170" href="#170">170</a> } +</pre> +<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body> +</html> + Added: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/regionserver/wal/TestHLogReaderOnSecureHLog.html URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/regionserver/wal/TestHLogReaderOnSecureHLog.html?rev=1616896&view=auto ============================================================================== --- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/regionserver/wal/TestHLogReaderOnSecureHLog.html (added) +++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/regionserver/wal/TestHLogReaderOnSecureHLog.html Fri Aug 8 22:19:16 2014 @@ -0,0 +1,201 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8" /> +<title>TestHLogReaderOnSecureHLog xref</title> +<link type="text/css" rel="stylesheet" href="../../../../../../stylesheet.css" /> +</head> +<body> +<pre> + +<a class="jxr_linenumber" name="1" href="#1">1</a> <em class="jxr_comment">/*</em> +<a class="jxr_linenumber" name="2" href="#2">2</a> <em class="jxr_comment"> * Licensed to the Apache Software Foundation (ASF) under one</em> +<a class="jxr_linenumber" name="3" href="#3">3</a> <em class="jxr_comment"> * or more contributor license agreements. See the NOTICE file</em> +<a class="jxr_linenumber" name="4" href="#4">4</a> <em class="jxr_comment"> * distributed with this work for additional information</em> +<a class="jxr_linenumber" name="5" href="#5">5</a> <em class="jxr_comment"> * regarding copyright ownership. The ASF licenses this file</em> +<a class="jxr_linenumber" name="6" href="#6">6</a> <em class="jxr_comment"> * to you under the Apache License, Version 2.0 (the</em> +<a class="jxr_linenumber" name="7" href="#7">7</a> <em class="jxr_comment"> * "License"); you may not use this file except in compliance</em> +<a class="jxr_linenumber" name="8" href="#8">8</a> <em class="jxr_comment"> * with the License. You may obtain a copy of the License at</em> +<a class="jxr_linenumber" name="9" href="#9">9</a> <em class="jxr_comment"> *</em> +<a class="jxr_linenumber" name="10" href="#10">10</a> <em class="jxr_comment"> * <a href="http://www.apache.org/licenses/LICENSE-2.0" target="alexandria_uri">http://www.apache.org/licenses/LICENSE-2.0</a></em> +<a class="jxr_linenumber" name="11" href="#11">11</a> <em class="jxr_comment"> *</em> +<a class="jxr_linenumber" name="12" href="#12">12</a> <em class="jxr_comment"> * Unless required by applicable law or agreed to in writing, software</em> +<a class="jxr_linenumber" name="13" href="#13">13</a> <em class="jxr_comment"> * distributed under the License is distributed on an "AS IS" BASIS,</em> +<a class="jxr_linenumber" name="14" href="#14">14</a> <em class="jxr_comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</em> +<a class="jxr_linenumber" name="15" href="#15">15</a> <em class="jxr_comment"> * See the License for the specific language governing permissions and</em> +<a class="jxr_linenumber" name="16" href="#16">16</a> <em class="jxr_comment"> * limitations under the License.</em> +<a class="jxr_linenumber" name="17" href="#17">17</a> <em class="jxr_comment"> */</em> +<a class="jxr_linenumber" name="18" href="#18">18</a> <strong class="jxr_keyword">package</strong> org.apache.hadoop.hbase.regionserver.wal; +<a class="jxr_linenumber" name="19" href="#19">19</a> +<a class="jxr_linenumber" name="20" href="#20">20</a> <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertFalse; +<a class="jxr_linenumber" name="21" href="#21">21</a> <strong class="jxr_keyword">import</strong> <strong class="jxr_keyword">static</strong> org.junit.Assert.assertTrue; +<a class="jxr_linenumber" name="22" href="#22">22</a> +<a class="jxr_linenumber" name="23" href="#23">23</a> <strong class="jxr_keyword">import</strong> java.io.IOException; +<a class="jxr_linenumber" name="24" href="#24">24</a> <strong class="jxr_keyword">import</strong> java.util.concurrent.atomic.AtomicLong; +<a class="jxr_linenumber" name="25" href="#25">25</a> +<a class="jxr_linenumber" name="26" href="#26">26</a> <strong class="jxr_keyword">import</strong> org.apache.commons.io.IOUtils; +<a class="jxr_linenumber" name="27" href="#27">27</a> <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log; +<a class="jxr_linenumber" name="28" href="#28">28</a> <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory; +<a class="jxr_linenumber" name="29" href="#29">29</a> <strong class="jxr_keyword">import</strong> org.apache.commons.logging.impl.Log4JLogger; +<a class="jxr_linenumber" name="30" href="#30">30</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration; +<a class="jxr_linenumber" name="31" href="#31">31</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.fs.FSDataInputStream; +<a class="jxr_linenumber" name="32" href="#32">32</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.fs.FileStatus; +<a class="jxr_linenumber" name="33" href="#33">33</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.fs.FileSystem; +<a class="jxr_linenumber" name="34" href="#34">34</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.fs.Path; +<a class="jxr_linenumber" name="35" href="#35">35</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HBaseTestingUtility; +<a class="jxr_linenumber" name="36" href="#36">36</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HColumnDescriptor; +<a class="jxr_linenumber" name="37" href="#37">37</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HConstants; +<a class="jxr_linenumber" name="38" href="#38">38</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HRegionInfo; +<a class="jxr_linenumber" name="39" href="#39">39</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.HTableDescriptor; +<a class="jxr_linenumber" name="40" href="#40">40</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.KeyValue; +<a class="jxr_linenumber" name="41" href="#41">41</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.MediumTests; +<a class="jxr_linenumber" name="42" href="#42">42</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.TableName; +<a class="jxr_linenumber" name="43" href="#43">43</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.io.crypto.KeyProviderForTesting; +<a class="jxr_linenumber" name="44" href="#44">44</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.protobuf.generated.ZooKeeperProtos.SplitLogTask.RecoveryMode; +<a class="jxr_linenumber" name="45" href="#45">45</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes; +<a class="jxr_linenumber" name="46" href="#46">46</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.FSUtils; +<a class="jxr_linenumber" name="47" href="#47">47</a> <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.zookeeper.ZKSplitLog; +<a class="jxr_linenumber" name="48" href="#48">48</a> <strong class="jxr_keyword">import</strong> org.apache.log4j.Level; +<a class="jxr_linenumber" name="49" href="#49">49</a> <strong class="jxr_keyword">import</strong> org.junit.BeforeClass; +<a class="jxr_linenumber" name="50" href="#50">50</a> <strong class="jxr_keyword">import</strong> org.junit.Test; +<a class="jxr_linenumber" name="51" href="#51">51</a> <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category; +<a class="jxr_linenumber" name="52" href="#52">52</a> +<a class="jxr_linenumber" name="53" href="#53">53</a> <em class="jxr_comment">/*</em> +<a class="jxr_linenumber" name="54" href="#54">54</a> <em class="jxr_comment"> * Test that verifies WAL written by SecureProtobufLogWriter is not readable by ProtobufLogReader</em> +<a class="jxr_linenumber" name="55" href="#55">55</a> <em class="jxr_comment"> */</em> +<a class="jxr_linenumber" name="56" href="#56">56</a> @Category(MediumTests.<strong class="jxr_keyword">class</strong>) +<a class="jxr_linenumber" name="57" href="#57">57</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../../../org/apache/hadoop/hbase/regionserver/wal/TestHLogReaderOnSecureHLog.html">TestHLogReaderOnSecureHLog</a> { +<a class="jxr_linenumber" name="58" href="#58">58</a> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> Log LOG = LogFactory.getLog(TestHLogReaderOnSecureHLog.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="59" href="#59">59</a> <strong class="jxr_keyword">static</strong> { +<a class="jxr_linenumber" name="60" href="#60">60</a> ((Log4JLogger)LogFactory.getLog(<span class="jxr_string">"org.apache.hadoop.hbase.regionserver.wal"</span>)) +<a class="jxr_linenumber" name="61" href="#61">61</a> .getLogger().setLevel(Level.ALL); +<a class="jxr_linenumber" name="62" href="#62">62</a> }; +<a class="jxr_linenumber" name="63" href="#63">63</a> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <a href="../../../../../../org/apache/hadoop/hbase/HBaseTestingUtility.html">HBaseTestingUtility</a> TEST_UTIL = <strong class="jxr_keyword">new</strong> <a href="../../../../../../org/apache/hadoop/hbase/HBaseTestingUtility.html">HBaseTestingUtility</a>(); +<a class="jxr_linenumber" name="64" href="#64">64</a> <strong class="jxr_keyword">final</strong> byte[] value = Bytes.toBytes(<span class="jxr_string">"Test value"</span>); +<a class="jxr_linenumber" name="65" href="#65">65</a> +<a class="jxr_linenumber" name="66" href="#66">66</a> @BeforeClass +<a class="jxr_linenumber" name="67" href="#67">67</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">void</strong> setUpBeforeClass() <strong class="jxr_keyword">throws</strong> Exception { +<a class="jxr_linenumber" name="68" href="#68">68</a> Configuration conf = TEST_UTIL.getConfiguration(); +<a class="jxr_linenumber" name="69" href="#69">69</a> conf.set(HConstants.CRYPTO_KEYPROVIDER_CONF_KEY, KeyProviderForTesting.<strong class="jxr_keyword">class</strong>.getName()); +<a class="jxr_linenumber" name="70" href="#70">70</a> conf.set(HConstants.CRYPTO_MASTERKEY_NAME_CONF_KEY, <span class="jxr_string">"hbase"</span>); +<a class="jxr_linenumber" name="71" href="#71">71</a> conf.setBoolean(<span class="jxr_string">"hbase.hlog.split.skip.errors"</span>, <strong class="jxr_keyword">true</strong>); +<a class="jxr_linenumber" name="72" href="#72">72</a> conf.setBoolean(HConstants.ENABLE_WAL_ENCRYPTION, <strong class="jxr_keyword">true</strong>); +<a class="jxr_linenumber" name="73" href="#73">73</a> } +<a class="jxr_linenumber" name="74" href="#74">74</a> +<a class="jxr_linenumber" name="75" href="#75">75</a> <strong class="jxr_keyword">private</strong> Path writeWAL(String tblName) <strong class="jxr_keyword">throws</strong> IOException { +<a class="jxr_linenumber" name="76" href="#76">76</a> Configuration conf = TEST_UTIL.getConfiguration(); +<a class="jxr_linenumber" name="77" href="#77">77</a> TableName tableName = TableName.valueOf(tblName); +<a class="jxr_linenumber" name="78" href="#78">78</a> HTableDescriptor htd = <strong class="jxr_keyword">new</strong> HTableDescriptor(tableName); +<a class="jxr_linenumber" name="79" href="#79">79</a> htd.addFamily(<strong class="jxr_keyword">new</strong> HColumnDescriptor(tableName.getName())); +<a class="jxr_linenumber" name="80" href="#80">80</a> HRegionInfo regioninfo = <strong class="jxr_keyword">new</strong> HRegionInfo(tableName, +<a class="jxr_linenumber" name="81" href="#81">81</a> HConstants.EMPTY_START_ROW, HConstants.EMPTY_END_ROW, false); +<a class="jxr_linenumber" name="82" href="#82">82</a> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> total = 10; +<a class="jxr_linenumber" name="83" href="#83">83</a> <strong class="jxr_keyword">final</strong> byte[] row = Bytes.toBytes(<span class="jxr_string">"row"</span>); +<a class="jxr_linenumber" name="84" href="#84">84</a> <strong class="jxr_keyword">final</strong> byte[] family = Bytes.toBytes(<span class="jxr_string">"family"</span>); +<a class="jxr_linenumber" name="85" href="#85">85</a> FileSystem fs = TEST_UTIL.getTestFileSystem(); +<a class="jxr_linenumber" name="86" href="#86">86</a> Path logDir = TEST_UTIL.getDataTestDir(tblName); +<a class="jxr_linenumber" name="87" href="#87">87</a> <strong class="jxr_keyword">final</strong> AtomicLong sequenceId = <strong class="jxr_keyword">new</strong> AtomicLong(1); +<a class="jxr_linenumber" name="88" href="#88">88</a> +<a class="jxr_linenumber" name="89" href="#89">89</a> <em class="jxr_comment">// Write the WAL</em> +<a class="jxr_linenumber" name="90" href="#90">90</a> FSHLog wal = <strong class="jxr_keyword">new</strong> FSHLog(fs, TEST_UTIL.getDataTestDir(), logDir.toString(), conf); +<a class="jxr_linenumber" name="91" href="#91">91</a> <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i < total; i++) { +<a class="jxr_linenumber" name="92" href="#92">92</a> WALEdit kvs = <strong class="jxr_keyword">new</strong> WALEdit(); +<a class="jxr_linenumber" name="93" href="#93">93</a> kvs.add(<strong class="jxr_keyword">new</strong> KeyValue(row, family, Bytes.toBytes(i), value)); +<a class="jxr_linenumber" name="94" href="#94">94</a> wal.append(regioninfo, tableName, kvs, System.currentTimeMillis(), htd, sequenceId); +<a class="jxr_linenumber" name="95" href="#95">95</a> } +<a class="jxr_linenumber" name="96" href="#96">96</a> <strong class="jxr_keyword">final</strong> Path walPath = ((FSHLog) wal).computeFilename(); +<a class="jxr_linenumber" name="97" href="#97">97</a> wal.close(); +<a class="jxr_linenumber" name="98" href="#98">98</a> +<a class="jxr_linenumber" name="99" href="#99">99</a> <strong class="jxr_keyword">return</strong> walPath; +<a class="jxr_linenumber" name="100" href="#100">100</a> } +<a class="jxr_linenumber" name="101" href="#101">101</a> +<a class="jxr_linenumber" name="102" href="#102">102</a> @Test() +<a class="jxr_linenumber" name="103" href="#103">103</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testHLogReaderOnSecureHLog() <strong class="jxr_keyword">throws</strong> Exception { +<a class="jxr_linenumber" name="104" href="#104">104</a> Configuration conf = TEST_UTIL.getConfiguration(); +<a class="jxr_linenumber" name="105" href="#105">105</a> HLogFactory.resetLogReaderClass(); +<a class="jxr_linenumber" name="106" href="#106">106</a> HLogFactory.resetLogWriterClass(); +<a class="jxr_linenumber" name="107" href="#107">107</a> conf.setClass(<span class="jxr_string">"hbase.regionserver.hlog.reader.impl"</span>, ProtobufLogReader.<strong class="jxr_keyword">class</strong>, +<a class="jxr_linenumber" name="108" href="#108">108</a> HLog.Reader.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="109" href="#109">109</a> conf.setClass(<span class="jxr_string">"hbase.regionserver.hlog.writer.impl"</span>, SecureProtobufLogWriter.<strong class="jxr_keyword">class</strong>, +<a class="jxr_linenumber" name="110" href="#110">110</a> HLog.Writer.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="111" href="#111">111</a> FileSystem fs = TEST_UTIL.getTestFileSystem(); +<a class="jxr_linenumber" name="112" href="#112">112</a> Path walPath = writeWAL(<span class="jxr_string">"testHLogReaderOnSecureHLog"</span>); +<a class="jxr_linenumber" name="113" href="#113">113</a> +<a class="jxr_linenumber" name="114" href="#114">114</a> <em class="jxr_comment">// Insure edits are not plaintext</em> +<a class="jxr_linenumber" name="115" href="#115">115</a> <strong class="jxr_keyword">long</strong> length = fs.getFileStatus(walPath).getLen(); +<a class="jxr_linenumber" name="116" href="#116">116</a> FSDataInputStream in = fs.open(walPath); +<a class="jxr_linenumber" name="117" href="#117">117</a> byte[] fileData = <strong class="jxr_keyword">new</strong> byte[(<strong class="jxr_keyword">int</strong>)length]; +<a class="jxr_linenumber" name="118" href="#118">118</a> IOUtils.readFully(in, fileData); +<a class="jxr_linenumber" name="119" href="#119">119</a> in.close(); +<a class="jxr_linenumber" name="120" href="#120">120</a> assertFalse(<span class="jxr_string">"Cells appear to be plaintext"</span>, Bytes.contains(fileData, value)); +<a class="jxr_linenumber" name="121" href="#121">121</a> +<a class="jxr_linenumber" name="122" href="#122">122</a> <em class="jxr_comment">// Confirm the WAL cannot be read back by ProtobufLogReader</em> +<a class="jxr_linenumber" name="123" href="#123">123</a> <strong class="jxr_keyword">try</strong> { +<a class="jxr_linenumber" name="124" href="#124">124</a> HLog.Reader reader = HLogFactory.createReader(TEST_UTIL.getTestFileSystem(), walPath, conf); +<a class="jxr_linenumber" name="125" href="#125">125</a> assertFalse(<strong class="jxr_keyword">true</strong>); +<a class="jxr_linenumber" name="126" href="#126">126</a> } <strong class="jxr_keyword">catch</strong> (IOException ioe) { +<a class="jxr_linenumber" name="127" href="#127">127</a> <em class="jxr_comment">// expected IOE</em> +<a class="jxr_linenumber" name="128" href="#128">128</a> } +<a class="jxr_linenumber" name="129" href="#129">129</a> +<a class="jxr_linenumber" name="130" href="#130">130</a> FileStatus[] listStatus = fs.listStatus(walPath.getParent()); +<a class="jxr_linenumber" name="131" href="#131">131</a> RecoveryMode mode = (conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false) ? +<a class="jxr_linenumber" name="132" href="#132">132</a> RecoveryMode.LOG_REPLAY : RecoveryMode.LOG_SPLITTING); +<a class="jxr_linenumber" name="133" href="#133">133</a> Path rootdir = FSUtils.getRootDir(conf); +<a class="jxr_linenumber" name="134" href="#134">134</a> <strong class="jxr_keyword">try</strong> { +<a class="jxr_linenumber" name="135" href="#135">135</a> HLogSplitter s = <strong class="jxr_keyword">new</strong> HLogSplitter(conf, rootdir, fs, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, mode); +<a class="jxr_linenumber" name="136" href="#136">136</a> s.splitLogFile(listStatus[0], <strong class="jxr_keyword">null</strong>); +<a class="jxr_linenumber" name="137" href="#137">137</a> Path file = <strong class="jxr_keyword">new</strong> Path(ZKSplitLog.getSplitLogDir(rootdir, listStatus[0].getPath().getName()), +<a class="jxr_linenumber" name="138" href="#138">138</a> <span class="jxr_string">"corrupt"</span>); +<a class="jxr_linenumber" name="139" href="#139">139</a> assertTrue(fs.exists(file)); +<a class="jxr_linenumber" name="140" href="#140">140</a> <em class="jxr_comment">// assertFalse("log splitting should have failed", true);</em> +<a class="jxr_linenumber" name="141" href="#141">141</a> } <strong class="jxr_keyword">catch</strong> (IOException ioe) { +<a class="jxr_linenumber" name="142" href="#142">142</a> assertTrue(<span class="jxr_string">"WAL should have been sidelined"</span>, false); +<a class="jxr_linenumber" name="143" href="#143">143</a> } +<a class="jxr_linenumber" name="144" href="#144">144</a> } +<a class="jxr_linenumber" name="145" href="#145">145</a> +<a class="jxr_linenumber" name="146" href="#146">146</a> @Test() +<a class="jxr_linenumber" name="147" href="#147">147</a> <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testSecureHLogReaderOnHLog() <strong class="jxr_keyword">throws</strong> Exception { +<a class="jxr_linenumber" name="148" href="#148">148</a> Configuration conf = TEST_UTIL.getConfiguration(); +<a class="jxr_linenumber" name="149" href="#149">149</a> HLogFactory.resetLogReaderClass(); +<a class="jxr_linenumber" name="150" href="#150">150</a> HLogFactory.resetLogWriterClass(); +<a class="jxr_linenumber" name="151" href="#151">151</a> conf.setClass(<span class="jxr_string">"hbase.regionserver.hlog.reader.impl"</span>, SecureProtobufLogReader.<strong class="jxr_keyword">class</strong>, +<a class="jxr_linenumber" name="152" href="#152">152</a> HLog.Reader.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="153" href="#153">153</a> conf.setClass(<span class="jxr_string">"hbase.regionserver.hlog.writer.impl"</span>, ProtobufLogWriter.<strong class="jxr_keyword">class</strong>, +<a class="jxr_linenumber" name="154" href="#154">154</a> HLog.Writer.<strong class="jxr_keyword">class</strong>); +<a class="jxr_linenumber" name="155" href="#155">155</a> FileSystem fs = TEST_UTIL.getTestFileSystem(); +<a class="jxr_linenumber" name="156" href="#156">156</a> Path walPath = writeWAL(<span class="jxr_string">"testSecureHLogReaderOnHLog"</span>); +<a class="jxr_linenumber" name="157" href="#157">157</a> +<a class="jxr_linenumber" name="158" href="#158">158</a> <em class="jxr_comment">// Ensure edits are plaintext</em> +<a class="jxr_linenumber" name="159" href="#159">159</a> <strong class="jxr_keyword">long</strong> length = fs.getFileStatus(walPath).getLen(); +<a class="jxr_linenumber" name="160" href="#160">160</a> FSDataInputStream in = fs.open(walPath); +<a class="jxr_linenumber" name="161" href="#161">161</a> byte[] fileData = <strong class="jxr_keyword">new</strong> byte[(<strong class="jxr_keyword">int</strong>)length]; +<a class="jxr_linenumber" name="162" href="#162">162</a> IOUtils.readFully(in, fileData); +<a class="jxr_linenumber" name="163" href="#163">163</a> in.close(); +<a class="jxr_linenumber" name="164" href="#164">164</a> assertTrue(<span class="jxr_string">"Cells should be plaintext"</span>, Bytes.contains(fileData, value)); +<a class="jxr_linenumber" name="165" href="#165">165</a> +<a class="jxr_linenumber" name="166" href="#166">166</a> <em class="jxr_comment">// Confirm the WAL can be read back by SecureProtobufLogReader</em> +<a class="jxr_linenumber" name="167" href="#167">167</a> <strong class="jxr_keyword">try</strong> { +<a class="jxr_linenumber" name="168" href="#168">168</a> HLog.Reader reader = HLogFactory.createReader(TEST_UTIL.getTestFileSystem(), walPath, conf); +<a class="jxr_linenumber" name="169" href="#169">169</a> } <strong class="jxr_keyword">catch</strong> (IOException ioe) { +<a class="jxr_linenumber" name="170" href="#170">170</a> assertFalse(<strong class="jxr_keyword">true</strong>); +<a class="jxr_linenumber" name="171" href="#171">171</a> } +<a class="jxr_linenumber" name="172" href="#172">172</a> +<a class="jxr_linenumber" name="173" href="#173">173</a> FileStatus[] listStatus = fs.listStatus(walPath.getParent()); +<a class="jxr_linenumber" name="174" href="#174">174</a> RecoveryMode mode = (conf.getBoolean(HConstants.DISTRIBUTED_LOG_REPLAY_KEY, false) ? +<a class="jxr_linenumber" name="175" href="#175">175</a> RecoveryMode.LOG_REPLAY : RecoveryMode.LOG_SPLITTING); +<a class="jxr_linenumber" name="176" href="#176">176</a> Path rootdir = FSUtils.getRootDir(conf); +<a class="jxr_linenumber" name="177" href="#177">177</a> <strong class="jxr_keyword">try</strong> { +<a class="jxr_linenumber" name="178" href="#178">178</a> HLogSplitter s = <strong class="jxr_keyword">new</strong> HLogSplitter(conf, rootdir, fs, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, <strong class="jxr_keyword">null</strong>, mode); +<a class="jxr_linenumber" name="179" href="#179">179</a> s.splitLogFile(listStatus[0], <strong class="jxr_keyword">null</strong>); +<a class="jxr_linenumber" name="180" href="#180">180</a> Path file = <strong class="jxr_keyword">new</strong> Path(ZKSplitLog.getSplitLogDir(rootdir, listStatus[0].getPath().getName()), +<a class="jxr_linenumber" name="181" href="#181">181</a> <span class="jxr_string">"corrupt"</span>); +<a class="jxr_linenumber" name="182" href="#182">182</a> assertTrue(!fs.exists(file)); +<a class="jxr_linenumber" name="183" href="#183">183</a> } <strong class="jxr_keyword">catch</strong> (IOException ioe) { +<a class="jxr_linenumber" name="184" href="#184">184</a> assertTrue(<span class="jxr_string">"WAL should have been processed"</span>, false); +<a class="jxr_linenumber" name="185" href="#185">185</a> } +<a class="jxr_linenumber" name="186" href="#186">186</a> } +<a class="jxr_linenumber" name="187" href="#187">187</a> } +</pre> +<hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body> +</html> +
