hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1465198 [9/41] - in /hbase/hbase.apache.org/trunk: ./ css/ hbase-assembly/ images/ xref-test/ xref-test/org/apache/hadoop/hbase/ xref-test/org/apache/hadoop/hbase/client/ xref-test/org/apache/hadoop/hbase/client/replication/ xref-test/org/...
Date Sat, 06 Apr 2013 06:06:09 GMT
Modified: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IngestIntegrationTestBase.html
URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IngestIntegrationTestBase.html?rev=1465198&r1=1465197&r2=1465198&view=diff
==============================================================================
--- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IngestIntegrationTestBase.html (original)
+++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IngestIntegrationTestBase.html Sat Apr  6 06:06:07 2013
@@ -34,103 +34,108 @@
 <a class="jxr_linenumber" name="24" href="#24">24</a>  
 <a class="jxr_linenumber" name="25" href="#25">25</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
 <a class="jxr_linenumber" name="26" href="#26">26</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
-<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
-<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.LoadTestTool;
-<a class="jxr_linenumber" name="29" href="#29">29</a>  
-<a class="jxr_linenumber" name="30" href="#30">30</a>  <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="31" href="#31">31</a>  <em class="jxr_javadoccomment"> * A base class for tests that do something with the cluster while running</em>
-<a class="jxr_linenumber" name="32" href="#32">32</a>  <em class="jxr_javadoccomment"> * {@link LoadTestTool} to write and verify some data.</em>
-<a class="jxr_linenumber" name="33" href="#33">33</a>  <em class="jxr_javadoccomment"> */</em>
-<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">abstract</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/IngestIntegrationTestBase.html">IngestIntegrationTestBase</a> {
-<a class="jxr_linenumber" name="35" href="#35">35</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String tableName = <strong class="jxr_keyword">null</strong>;
-<a class="jxr_linenumber" name="36" href="#36">36</a>  
-<a class="jxr_linenumber" name="37" href="#37">37</a>    <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> A soft limit on how long we should run */</em>
-<a class="jxr_linenumber" name="38" href="#38">38</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String RUN_TIME_KEY = <span class="jxr_string">"hbase.%s.runtime"</span>;
-<a class="jxr_linenumber" name="39" href="#39">39</a>  
-<a class="jxr_linenumber" name="40" href="#40">40</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> Log LOG = LogFactory.getLog(IngestIntegrationTestBase.<strong class="jxr_keyword">class</strong>);
-<a class="jxr_linenumber" name="41" href="#41">41</a>    <strong class="jxr_keyword">protected</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestingUtility.html">IntegrationTestingUtility</a> util;
-<a class="jxr_linenumber" name="42" href="#42">42</a>    <strong class="jxr_keyword">protected</strong> <a href="../../../../org/apache/hadoop/hbase/HBaseCluster.html">HBaseCluster</a> cluster;
-<a class="jxr_linenumber" name="43" href="#43">43</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/hadoop/hbase/util/LoadTestTool.html">LoadTestTool</a> loadTool;
-<a class="jxr_linenumber" name="44" href="#44">44</a>  
-<a class="jxr_linenumber" name="45" href="#45">45</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> setUp(<strong class="jxr_keyword">int</strong> numSlavesBase) <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="46" href="#46">46</a>      tableName = <strong class="jxr_keyword">this</strong>.getClass().getSimpleName();
-<a class="jxr_linenumber" name="47" href="#47">47</a>      util = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestingUtility.html">IntegrationTestingUtility</a>();
-<a class="jxr_linenumber" name="48" href="#48">48</a>      LOG.info(<span class="jxr_string">"Initializing cluster with "</span> + numSlavesBase + <span class="jxr_string">" servers"</span>);
-<a class="jxr_linenumber" name="49" href="#49">49</a>      util.initializeCluster(numSlavesBase);
-<a class="jxr_linenumber" name="50" href="#50">50</a>      LOG.info(<span class="jxr_string">"Done initializing cluster"</span>);
-<a class="jxr_linenumber" name="51" href="#51">51</a>      cluster = util.getHBaseClusterInterface();
-<a class="jxr_linenumber" name="52" href="#52">52</a>      deleteTableIfNecessary();
-<a class="jxr_linenumber" name="53" href="#53">53</a>      loadTool = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/util/LoadTestTool.html">LoadTestTool</a>();
-<a class="jxr_linenumber" name="54" href="#54">54</a>      loadTool.setConf(util.getConfiguration());
-<a class="jxr_linenumber" name="55" href="#55">55</a>      <em class="jxr_comment">// Initialize load test tool before we start breaking things;</em>
-<a class="jxr_linenumber" name="56" href="#56">56</a>      <em class="jxr_comment">// LoadTestTool init, even when it is a no-op, is very fragile.</em>
-<a class="jxr_linenumber" name="57" href="#57">57</a>      <strong class="jxr_keyword">int</strong> ret = loadTool.run(<strong class="jxr_keyword">new</strong> String[] { <span class="jxr_string">"-tn"</span>, tableName, <span class="jxr_string">"-init_only"</span> });
-<a class="jxr_linenumber" name="58" href="#58">58</a>      Assert.assertEquals(<span class="jxr_string">"Failed to initialize LoadTestTool"</span>, 0, ret);
-<a class="jxr_linenumber" name="59" href="#59">59</a>    }
-<a class="jxr_linenumber" name="60" href="#60">60</a>  
-<a class="jxr_linenumber" name="61" href="#61">61</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> tearDown() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="62" href="#62">62</a>      LOG.info(<span class="jxr_string">"Restoring the cluster"</span>);
-<a class="jxr_linenumber" name="63" href="#63">63</a>      util.restoreCluster();
-<a class="jxr_linenumber" name="64" href="#64">64</a>      LOG.info(<span class="jxr_string">"Done restoring the cluster"</span>);
-<a class="jxr_linenumber" name="65" href="#65">65</a>    }
-<a class="jxr_linenumber" name="66" href="#66">66</a>  
-<a class="jxr_linenumber" name="67" href="#67">67</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> deleteTableIfNecessary() <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="68" href="#68">68</a>      <strong class="jxr_keyword">if</strong> (util.getHBaseAdmin().tableExists(tableName)) {
-<a class="jxr_linenumber" name="69" href="#69">69</a>        util.deleteTable(Bytes.toBytes(tableName));
-<a class="jxr_linenumber" name="70" href="#70">70</a>      }
-<a class="jxr_linenumber" name="71" href="#71">71</a>    }
-<a class="jxr_linenumber" name="72" href="#72">72</a>  
-<a class="jxr_linenumber" name="73" href="#73">73</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> runIngestTest(<strong class="jxr_keyword">long</strong> defaultRunTime, <strong class="jxr_keyword">int</strong> keysPerServerPerIter,
-<a class="jxr_linenumber" name="74" href="#74">74</a>        <strong class="jxr_keyword">int</strong> colsPerKey, <strong class="jxr_keyword">int</strong> recordSize, <strong class="jxr_keyword">int</strong> writeThreads) <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="75" href="#75">75</a>      LOG.info(<span class="jxr_string">"Running ingest"</span>);
-<a class="jxr_linenumber" name="76" href="#76">76</a>      LOG.info(<span class="jxr_string">"Cluster size:"</span> + util.getHBaseClusterInterface().getClusterStatus().getServersSize());
+<a class="jxr_linenumber" name="27" href="#27">27</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.conf.Configuration;
+<a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
+<a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.LoadTestTool;
+<a class="jxr_linenumber" name="30" href="#30">30</a>  
+<a class="jxr_linenumber" name="31" href="#31">31</a>  <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="32" href="#32">32</a>  <em class="jxr_javadoccomment"> * A base class for tests that do something with the cluster while running</em>
+<a class="jxr_linenumber" name="33" href="#33">33</a>  <em class="jxr_javadoccomment"> * {@link LoadTestTool} to write and verify some data.</em>
+<a class="jxr_linenumber" name="34" href="#34">34</a>  <em class="jxr_javadoccomment"> */</em>
+<a class="jxr_linenumber" name="35" href="#35">35</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">abstract</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/IngestIntegrationTestBase.html">IngestIntegrationTestBase</a> {
+<a class="jxr_linenumber" name="36" href="#36">36</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> String tableName = <strong class="jxr_keyword">null</strong>;
+<a class="jxr_linenumber" name="37" href="#37">37</a>  
+<a class="jxr_linenumber" name="38" href="#38">38</a>    <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> A soft limit on how long we should run */</em>
+<a class="jxr_linenumber" name="39" href="#39">39</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> String RUN_TIME_KEY = <span class="jxr_string">"hbase.%s.runtime"</span>;
+<a class="jxr_linenumber" name="40" href="#40">40</a>  
+<a class="jxr_linenumber" name="41" href="#41">41</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> Log LOG = LogFactory.getLog(IngestIntegrationTestBase.<strong class="jxr_keyword">class</strong>);
+<a class="jxr_linenumber" name="42" href="#42">42</a>    <strong class="jxr_keyword">protected</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestingUtility.html">IntegrationTestingUtility</a> util;
+<a class="jxr_linenumber" name="43" href="#43">43</a>    <strong class="jxr_keyword">protected</strong> <a href="../../../../org/apache/hadoop/hbase/HBaseCluster.html">HBaseCluster</a> cluster;
+<a class="jxr_linenumber" name="44" href="#44">44</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/hadoop/hbase/util/LoadTestTool.html">LoadTestTool</a> loadTool;
+<a class="jxr_linenumber" name="45" href="#45">45</a>  
+<a class="jxr_linenumber" name="46" href="#46">46</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> setUp(<strong class="jxr_keyword">int</strong> numSlavesBase, Configuration conf) <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="47" href="#47">47</a>      tableName = <strong class="jxr_keyword">this</strong>.getClass().getSimpleName();
+<a class="jxr_linenumber" name="48" href="#48">48</a>      util = (conf == <strong class="jxr_keyword">null</strong>) ? <strong class="jxr_keyword">new</strong> IntegrationTestingUtility() : <strong class="jxr_keyword">new</strong> IntegrationTestingUtility(conf);
+<a class="jxr_linenumber" name="49" href="#49">49</a>      LOG.info(<span class="jxr_string">"Initializing cluster with "</span> + numSlavesBase + <span class="jxr_string">" servers"</span>);
+<a class="jxr_linenumber" name="50" href="#50">50</a>      util.initializeCluster(numSlavesBase);
+<a class="jxr_linenumber" name="51" href="#51">51</a>      LOG.info(<span class="jxr_string">"Done initializing cluster"</span>);
+<a class="jxr_linenumber" name="52" href="#52">52</a>      cluster = util.getHBaseClusterInterface();
+<a class="jxr_linenumber" name="53" href="#53">53</a>      deleteTableIfNecessary();
+<a class="jxr_linenumber" name="54" href="#54">54</a>      loadTool = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/util/LoadTestTool.html">LoadTestTool</a>();
+<a class="jxr_linenumber" name="55" href="#55">55</a>      loadTool.setConf(util.getConfiguration());
+<a class="jxr_linenumber" name="56" href="#56">56</a>      <em class="jxr_comment">// Initialize load test tool before we start breaking things;</em>
+<a class="jxr_linenumber" name="57" href="#57">57</a>      <em class="jxr_comment">// LoadTestTool init, even when it is a no-op, is very fragile.</em>
+<a class="jxr_linenumber" name="58" href="#58">58</a>      <strong class="jxr_keyword">int</strong> ret = loadTool.run(<strong class="jxr_keyword">new</strong> String[] { <span class="jxr_string">"-tn"</span>, tableName, <span class="jxr_string">"-init_only"</span> });
+<a class="jxr_linenumber" name="59" href="#59">59</a>      Assert.assertEquals(<span class="jxr_string">"Failed to initialize LoadTestTool"</span>, 0, ret);
+<a class="jxr_linenumber" name="60" href="#60">60</a>    }
+<a class="jxr_linenumber" name="61" href="#61">61</a>  
+<a class="jxr_linenumber" name="62" href="#62">62</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> setUp(<strong class="jxr_keyword">int</strong> numSlavesBase) <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="63" href="#63">63</a>      setUp(numSlavesBase, <strong class="jxr_keyword">null</strong>);
+<a class="jxr_linenumber" name="64" href="#64">64</a>    }
+<a class="jxr_linenumber" name="65" href="#65">65</a>  
+<a class="jxr_linenumber" name="66" href="#66">66</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> tearDown() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="67" href="#67">67</a>      LOG.info(<span class="jxr_string">"Restoring the cluster"</span>);
+<a class="jxr_linenumber" name="68" href="#68">68</a>      util.restoreCluster();
+<a class="jxr_linenumber" name="69" href="#69">69</a>      LOG.info(<span class="jxr_string">"Done restoring the cluster"</span>);
+<a class="jxr_linenumber" name="70" href="#70">70</a>    }
+<a class="jxr_linenumber" name="71" href="#71">71</a>  
+<a class="jxr_linenumber" name="72" href="#72">72</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">void</strong> deleteTableIfNecessary() <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="73" href="#73">73</a>      <strong class="jxr_keyword">if</strong> (util.getHBaseAdmin().tableExists(tableName)) {
+<a class="jxr_linenumber" name="74" href="#74">74</a>        util.deleteTable(Bytes.toBytes(tableName));
+<a class="jxr_linenumber" name="75" href="#75">75</a>      }
+<a class="jxr_linenumber" name="76" href="#76">76</a>    }
 <a class="jxr_linenumber" name="77" href="#77">77</a>  
-<a class="jxr_linenumber" name="78" href="#78">78</a>      <strong class="jxr_keyword">long</strong> start = System.currentTimeMillis();
-<a class="jxr_linenumber" name="79" href="#79">79</a>      String runtimeKey = String.format(RUN_TIME_KEY, <strong class="jxr_keyword">this</strong>.getClass().getSimpleName());
-<a class="jxr_linenumber" name="80" href="#80">80</a>      <strong class="jxr_keyword">long</strong> runtime = util.getConfiguration().getLong(runtimeKey, defaultRunTime);
-<a class="jxr_linenumber" name="81" href="#81">81</a>      <strong class="jxr_keyword">long</strong> startKey = 0;
+<a class="jxr_linenumber" name="78" href="#78">78</a>    <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> runIngestTest(<strong class="jxr_keyword">long</strong> defaultRunTime, <strong class="jxr_keyword">int</strong> keysPerServerPerIter,
+<a class="jxr_linenumber" name="79" href="#79">79</a>        <strong class="jxr_keyword">int</strong> colsPerKey, <strong class="jxr_keyword">int</strong> recordSize, <strong class="jxr_keyword">int</strong> writeThreads) <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="80" href="#80">80</a>      LOG.info(<span class="jxr_string">"Running ingest"</span>);
+<a class="jxr_linenumber" name="81" href="#81">81</a>      LOG.info(<span class="jxr_string">"Cluster size:"</span> + util.getHBaseClusterInterface().getClusterStatus().getServersSize());
 <a class="jxr_linenumber" name="82" href="#82">82</a>  
-<a class="jxr_linenumber" name="83" href="#83">83</a>      <strong class="jxr_keyword">long</strong> numKeys = getNumKeys(keysPerServerPerIter);
-<a class="jxr_linenumber" name="84" href="#84">84</a>      <strong class="jxr_keyword">while</strong> (System.currentTimeMillis() - start &lt; 0.9 * runtime) {
-<a class="jxr_linenumber" name="85" href="#85">85</a>        LOG.info(<span class="jxr_string">"Intended run time: "</span> + (runtime/60000) + <span class="jxr_string">" min, left:"</span> +
-<a class="jxr_linenumber" name="86" href="#86">86</a>            ((runtime - (System.currentTimeMillis() - start))/60000) + <span class="jxr_string">" min"</span>);
+<a class="jxr_linenumber" name="83" href="#83">83</a>      <strong class="jxr_keyword">long</strong> start = System.currentTimeMillis();
+<a class="jxr_linenumber" name="84" href="#84">84</a>      String runtimeKey = String.format(RUN_TIME_KEY, <strong class="jxr_keyword">this</strong>.getClass().getSimpleName());
+<a class="jxr_linenumber" name="85" href="#85">85</a>      <strong class="jxr_keyword">long</strong> runtime = util.getConfiguration().getLong(runtimeKey, defaultRunTime);
+<a class="jxr_linenumber" name="86" href="#86">86</a>      <strong class="jxr_keyword">long</strong> startKey = 0;
 <a class="jxr_linenumber" name="87" href="#87">87</a>  
-<a class="jxr_linenumber" name="88" href="#88">88</a>        <strong class="jxr_keyword">int</strong> ret = loadTool.run(<strong class="jxr_keyword">new</strong> String[] {
-<a class="jxr_linenumber" name="89" href="#89">89</a>            <span class="jxr_string">"-tn"</span>, tableName,
-<a class="jxr_linenumber" name="90" href="#90">90</a>            <span class="jxr_string">"-write"</span>, String.format(<span class="jxr_string">"%d:%d:%d"</span>, colsPerKey, recordSize, writeThreads),
-<a class="jxr_linenumber" name="91" href="#91">91</a>            <span class="jxr_string">"-start_key"</span>, String.valueOf(startKey),
-<a class="jxr_linenumber" name="92" href="#92">92</a>            <span class="jxr_string">"-num_keys"</span>, String.valueOf(numKeys),
-<a class="jxr_linenumber" name="93" href="#93">93</a>            <span class="jxr_string">"-skip_init"</span>
-<a class="jxr_linenumber" name="94" href="#94">94</a>        });
-<a class="jxr_linenumber" name="95" href="#95">95</a>        <strong class="jxr_keyword">if</strong> (0 != ret) {
-<a class="jxr_linenumber" name="96" href="#96">96</a>          String errorMsg = <span class="jxr_string">"Load failed with error code "</span> + ret;
-<a class="jxr_linenumber" name="97" href="#97">97</a>          LOG.error(errorMsg);
-<a class="jxr_linenumber" name="98" href="#98">98</a>          Assert.fail(errorMsg);
-<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>       ret = loadTool.run(<strong class="jxr_keyword">new</strong> String[] {
-<a class="jxr_linenumber" name="102" href="#102">102</a>           <span class="jxr_string">"-tn"</span>, tableName,
-<a class="jxr_linenumber" name="103" href="#103">103</a>           <span class="jxr_string">"-read"</span>, <span class="jxr_string">"100:20"</span>,
-<a class="jxr_linenumber" name="104" href="#104">104</a>           <span class="jxr_string">"-start_key"</span>, String.valueOf(startKey),
-<a class="jxr_linenumber" name="105" href="#105">105</a>           <span class="jxr_string">"-num_keys"</span>, String.valueOf(numKeys),
-<a class="jxr_linenumber" name="106" href="#106">106</a>           <span class="jxr_string">"-skip_init"</span>
-<a class="jxr_linenumber" name="107" href="#107">107</a>       });
-<a class="jxr_linenumber" name="108" href="#108">108</a>       <strong class="jxr_keyword">if</strong> (0 != ret) {
-<a class="jxr_linenumber" name="109" href="#109">109</a>         String errorMsg = <span class="jxr_string">"Verification failed with error code "</span> + ret;
-<a class="jxr_linenumber" name="110" href="#110">110</a>         LOG.error(errorMsg);
-<a class="jxr_linenumber" name="111" href="#111">111</a>         Assert.fail(errorMsg);
-<a class="jxr_linenumber" name="112" href="#112">112</a>       }
-<a class="jxr_linenumber" name="113" href="#113">113</a>       startKey += numKeys;
-<a class="jxr_linenumber" name="114" href="#114">114</a>     }
-<a class="jxr_linenumber" name="115" href="#115">115</a>   }
-<a class="jxr_linenumber" name="116" href="#116">116</a> 
-<a class="jxr_linenumber" name="117" href="#117">117</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Estimates a data size based on the cluster size */</em>
-<a class="jxr_linenumber" name="118" href="#118">118</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">long</strong> getNumKeys(<strong class="jxr_keyword">int</strong> keysPerServer)
-<a class="jxr_linenumber" name="119" href="#119">119</a>       <strong class="jxr_keyword">throws</strong> IOException {
-<a class="jxr_linenumber" name="120" href="#120">120</a>     <strong class="jxr_keyword">int</strong> numRegionServers = cluster.getClusterStatus().getServersSize();
-<a class="jxr_linenumber" name="121" href="#121">121</a>     <strong class="jxr_keyword">return</strong> keysPerServer * numRegionServers;
-<a class="jxr_linenumber" name="122" href="#122">122</a>   }
-<a class="jxr_linenumber" name="123" href="#123">123</a> }
+<a class="jxr_linenumber" name="88" href="#88">88</a>      <strong class="jxr_keyword">long</strong> numKeys = getNumKeys(keysPerServerPerIter);
+<a class="jxr_linenumber" name="89" href="#89">89</a>      <strong class="jxr_keyword">while</strong> (System.currentTimeMillis() - start &lt; 0.9 * runtime) {
+<a class="jxr_linenumber" name="90" href="#90">90</a>        LOG.info(<span class="jxr_string">"Intended run time: "</span> + (runtime/60000) + <span class="jxr_string">" min, left:"</span> +
+<a class="jxr_linenumber" name="91" href="#91">91</a>            ((runtime - (System.currentTimeMillis() - start))/60000) + <span class="jxr_string">" min"</span>);
+<a class="jxr_linenumber" name="92" href="#92">92</a>  
+<a class="jxr_linenumber" name="93" href="#93">93</a>        <strong class="jxr_keyword">int</strong> ret = loadTool.run(<strong class="jxr_keyword">new</strong> String[] {
+<a class="jxr_linenumber" name="94" href="#94">94</a>            <span class="jxr_string">"-tn"</span>, tableName,
+<a class="jxr_linenumber" name="95" href="#95">95</a>            <span class="jxr_string">"-write"</span>, String.format(<span class="jxr_string">"%d:%d:%d"</span>, colsPerKey, recordSize, writeThreads),
+<a class="jxr_linenumber" name="96" href="#96">96</a>            <span class="jxr_string">"-start_key"</span>, String.valueOf(startKey),
+<a class="jxr_linenumber" name="97" href="#97">97</a>            <span class="jxr_string">"-num_keys"</span>, String.valueOf(numKeys),
+<a class="jxr_linenumber" name="98" href="#98">98</a>            <span class="jxr_string">"-skip_init"</span>
+<a class="jxr_linenumber" name="99" href="#99">99</a>        });
+<a class="jxr_linenumber" name="100" href="#100">100</a>       <strong class="jxr_keyword">if</strong> (0 != ret) {
+<a class="jxr_linenumber" name="101" href="#101">101</a>         String errorMsg = <span class="jxr_string">"Load failed with error code "</span> + ret;
+<a class="jxr_linenumber" name="102" href="#102">102</a>         LOG.error(errorMsg);
+<a class="jxr_linenumber" name="103" href="#103">103</a>         Assert.fail(errorMsg);
+<a class="jxr_linenumber" name="104" href="#104">104</a>       }
+<a class="jxr_linenumber" name="105" href="#105">105</a> 
+<a class="jxr_linenumber" name="106" href="#106">106</a>       ret = loadTool.run(<strong class="jxr_keyword">new</strong> String[] {
+<a class="jxr_linenumber" name="107" href="#107">107</a>           <span class="jxr_string">"-tn"</span>, tableName,
+<a class="jxr_linenumber" name="108" href="#108">108</a>           <span class="jxr_string">"-read"</span>, <span class="jxr_string">"100:20"</span>,
+<a class="jxr_linenumber" name="109" href="#109">109</a>           <span class="jxr_string">"-start_key"</span>, String.valueOf(startKey),
+<a class="jxr_linenumber" name="110" href="#110">110</a>           <span class="jxr_string">"-num_keys"</span>, String.valueOf(numKeys),
+<a class="jxr_linenumber" name="111" href="#111">111</a>           <span class="jxr_string">"-skip_init"</span>
+<a class="jxr_linenumber" name="112" href="#112">112</a>       });
+<a class="jxr_linenumber" name="113" href="#113">113</a>       <strong class="jxr_keyword">if</strong> (0 != ret) {
+<a class="jxr_linenumber" name="114" href="#114">114</a>         String errorMsg = <span class="jxr_string">"Verification failed with error code "</span> + ret;
+<a class="jxr_linenumber" name="115" href="#115">115</a>         LOG.error(errorMsg);
+<a class="jxr_linenumber" name="116" href="#116">116</a>         Assert.fail(errorMsg);
+<a class="jxr_linenumber" name="117" href="#117">117</a>       }
+<a class="jxr_linenumber" name="118" href="#118">118</a>       startKey += numKeys;
+<a class="jxr_linenumber" name="119" href="#119">119</a>     }
+<a class="jxr_linenumber" name="120" href="#120">120</a>   }
+<a class="jxr_linenumber" name="121" href="#121">121</a> 
+<a class="jxr_linenumber" name="122" href="#122">122</a>   <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Estimates a data size based on the cluster size */</em>
+<a class="jxr_linenumber" name="123" href="#123">123</a>   <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">long</strong> getNumKeys(<strong class="jxr_keyword">int</strong> keysPerServer)
+<a class="jxr_linenumber" name="124" href="#124">124</a>       <strong class="jxr_keyword">throws</strong> IOException {
+<a class="jxr_linenumber" name="125" href="#125">125</a>     <strong class="jxr_keyword">int</strong> numRegionServers = cluster.getClusterStatus().getServersSize();
+<a class="jxr_linenumber" name="126" href="#126">126</a>     <strong class="jxr_keyword">return</strong> keysPerServer * numRegionServers;
+<a class="jxr_linenumber" name="127" href="#127">127</a>   }
+<a class="jxr_linenumber" name="128" href="#128">128</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>

Modified: hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html
URL: http://svn.apache.org/viewvc/hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html?rev=1465198&r1=1465197&r2=1465198&view=diff
==============================================================================
--- hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html (original)
+++ hbase/hbase.apache.org/trunk/xref-test/org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html Sat Apr  6 06:06:07 2013
@@ -37,102 +37,106 @@
 <a class="jxr_linenumber" name="27" href="#27">27</a>  
 <a class="jxr_linenumber" name="28" href="#28">28</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.Log;
 <a class="jxr_linenumber" name="29" href="#29">29</a>  <strong class="jxr_keyword">import</strong> org.apache.commons.logging.LogFactory;
-<a class="jxr_linenumber" name="30" href="#30">30</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
-<a class="jxr_linenumber" name="31" href="#31">31</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.ChaosMonkey;
-<a class="jxr_linenumber" name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Pair;
-<a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.ChaosMonkey.Action;
-<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> org.junit.After;
-<a class="jxr_linenumber" name="35" href="#35">35</a>  <strong class="jxr_keyword">import</strong> org.junit.Before;
-<a class="jxr_linenumber" name="36" href="#36">36</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
-<a class="jxr_linenumber" name="37" href="#37">37</a>  <strong class="jxr_keyword">import</strong> org.junit.Ignore;
-<a class="jxr_linenumber" name="38" href="#38">38</a>  <strong class="jxr_keyword">import</strong> org.junit.experimental.categories.Category;
-<a class="jxr_linenumber" name="39" href="#39">39</a>  
-<a class="jxr_linenumber" name="40" href="#40">40</a>  <em class="jxr_javadoccomment">/**</em>
-<a class="jxr_linenumber" name="41" href="#41">41</a>  <em class="jxr_javadoccomment"> * A system test which does large data ingestion and verify using {@link LoadTestTool},</em>
-<a class="jxr_linenumber" name="42" href="#42">42</a>  <em class="jxr_javadoccomment"> * while introducing chaos by hoarding many regions into few servers (unbalancing), then</em>
-<a class="jxr_linenumber" name="43" href="#43">43</a>  <em class="jxr_javadoccomment"> * killing some of these servers, and triggering balancer.</em>
-<a class="jxr_linenumber" name="44" href="#44">44</a>  <em class="jxr_javadoccomment"> * It's configured using a set of constants on top, which cover this scenario and are</em>
-<a class="jxr_linenumber" name="45" href="#45">45</a>  <em class="jxr_javadoccomment"> * reasonable for minicluster. See constants if you want to tweak the test.</em>
-<a class="jxr_linenumber" name="46" href="#46">46</a>  <em class="jxr_javadoccomment"> * You can configure how long the test should run by using</em>
-<a class="jxr_linenumber" name="47" href="#47">47</a>  <em class="jxr_javadoccomment"> * "hbase.IntegrationTestRebalanceAndKillServersTargeted.runtime" configuration parameter,</em>
-<a class="jxr_linenumber" name="48" href="#48">48</a>  <em class="jxr_javadoccomment"> * which is probably most useful on cluster.</em>
-<a class="jxr_linenumber" name="49" href="#49">49</a>  <em class="jxr_javadoccomment"> */</em>
-<a class="jxr_linenumber" name="50" href="#50">50</a>  @Category(IntegrationTests.<strong class="jxr_keyword">class</strong>)
-<a class="jxr_linenumber" name="51" href="#51">51</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html">IntegrationTestRebalanceAndKillServersTargeted</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/hadoop/hbase/IngestIntegrationTestBase.html">IngestIntegrationTestBase</a> {
-<a class="jxr_linenumber" name="52" href="#52">52</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> NUM_SLAVES_BASE = 4; <em class="jxr_comment">// number of slaves for the smallest cluster</em>
-<a class="jxr_linenumber" name="53" href="#53">53</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> DEFAULT_RUN_TIME = 5 * 60 * 1000; <em class="jxr_comment">// run for 5 min by default</em>
-<a class="jxr_linenumber" name="54" href="#54">54</a>  
-<a class="jxr_linenumber" name="55" href="#55">55</a>    <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> How often to introduce the chaos. If too frequent, sequence of kills on minicluster</em>
-<a class="jxr_linenumber" name="56" href="#56">56</a>  <em class="jxr_javadoccomment">   * can cause test to fail when Put runs out of retries. */</em>
-<a class="jxr_linenumber" name="57" href="#57">57</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> CHAOS_EVERY_MS = 65 * 1000;
-<a class="jxr_linenumber" name="58" href="#58">58</a>  
-<a class="jxr_linenumber" name="59" href="#59">59</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/hadoop/hbase/util/ChaosMonkey.html">ChaosMonkey</a> monkey;
+<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.hbase.client.HConnectionManager;
+<a class="jxr_linenumber" name="32" href="#32">32</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Bytes;
+<a class="jxr_linenumber" name="33" href="#33">33</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.ChaosMonkey;
+<a class="jxr_linenumber" name="34" href="#34">34</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.Pair;
+<a class="jxr_linenumber" name="35" href="#35">35</a>  <strong class="jxr_keyword">import</strong> org.apache.hadoop.hbase.util.ChaosMonkey.Action;
+<a class="jxr_linenumber" name="36" href="#36">36</a>  <strong class="jxr_keyword">import</strong> org.junit.After;
+<a class="jxr_linenumber" name="37" href="#37">37</a>  <strong class="jxr_keyword">import</strong> org.junit.Before;
+<a class="jxr_linenumber" name="38" href="#38">38</a>  <strong class="jxr_keyword">import</strong> org.junit.Test;
+<a class="jxr_linenumber" name="39" href="#39">39</a>  <strong class="jxr_keyword">import</strong> org.junit.Ignore;
+<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>  
+<a class="jxr_linenumber" name="42" href="#42">42</a>  <em class="jxr_javadoccomment">/**</em>
+<a class="jxr_linenumber" name="43" href="#43">43</a>  <em class="jxr_javadoccomment"> * A system test which does large data ingestion and verify using {@link LoadTestTool},</em>
+<a class="jxr_linenumber" name="44" href="#44">44</a>  <em class="jxr_javadoccomment"> * while introducing chaos by hoarding many regions into few servers (unbalancing), then</em>
+<a class="jxr_linenumber" name="45" href="#45">45</a>  <em class="jxr_javadoccomment"> * killing some of these servers, and triggering balancer.</em>
+<a class="jxr_linenumber" name="46" href="#46">46</a>  <em class="jxr_javadoccomment"> * It's configured using a set of constants on top, which cover this scenario and are</em>
+<a class="jxr_linenumber" name="47" href="#47">47</a>  <em class="jxr_javadoccomment"> * reasonable for minicluster. See constants if you want to tweak the test.</em>
+<a class="jxr_linenumber" name="48" href="#48">48</a>  <em class="jxr_javadoccomment"> * You can configure how long the test should run by using</em>
+<a class="jxr_linenumber" name="49" href="#49">49</a>  <em class="jxr_javadoccomment"> * "hbase.IntegrationTestRebalanceAndKillServersTargeted.runtime" configuration parameter,</em>
+<a class="jxr_linenumber" name="50" href="#50">50</a>  <em class="jxr_javadoccomment"> * which is probably most useful on cluster.</em>
+<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>  @Category(IntegrationTests.<strong class="jxr_keyword">class</strong>)
+<a class="jxr_linenumber" name="53" href="#53">53</a>  <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html">IntegrationTestRebalanceAndKillServersTargeted</a> <strong class="jxr_keyword">extends</strong> <a href="../../../../org/apache/hadoop/hbase/IngestIntegrationTestBase.html">IngestIntegrationTestBase</a> {
+<a class="jxr_linenumber" name="54" href="#54">54</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">int</strong> NUM_SLAVES_BASE = 4; <em class="jxr_comment">// number of slaves for the smallest cluster</em>
+<a class="jxr_linenumber" name="55" href="#55">55</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> DEFAULT_RUN_TIME = 5 * 60 * 1000; <em class="jxr_comment">// run for 5 min by default</em>
+<a class="jxr_linenumber" name="56" href="#56">56</a>  
+<a class="jxr_linenumber" name="57" href="#57">57</a>    <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> How often to introduce the chaos. If too frequent, sequence of kills on minicluster</em>
+<a class="jxr_linenumber" name="58" href="#58">58</a>  <em class="jxr_javadoccomment">   * can cause test to fail when Put runs out of retries. */</em>
+<a class="jxr_linenumber" name="59" href="#59">59</a>    <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> CHAOS_EVERY_MS = 65 * 1000;
 <a class="jxr_linenumber" name="60" href="#60">60</a>  
-<a class="jxr_linenumber" name="61" href="#61">61</a>    <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> This action is too specific to put in ChaosMonkey; put it here */</em>
-<a class="jxr_linenumber" name="62" href="#62">62</a>    <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html">UnbalanceKillAndRebalanceAction</a> <strong class="jxr_keyword">extends</strong> ChaosMonkey.Action {
-<a class="jxr_linenumber" name="63" href="#63">63</a>      <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Fractions of servers to get regions and live and die respectively; from all other</em>
-<a class="jxr_linenumber" name="64" href="#64">64</a>  <em class="jxr_javadoccomment">     * servers, HOARD_FRC_OF_REGIONS will be removed to the above randomly */</em>
-<a class="jxr_linenumber" name="65" href="#65">65</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> FRC_SERVERS_THAT_HOARD_AND_LIVE = 0.1;
-<a class="jxr_linenumber" name="66" href="#66">66</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> FRC_SERVERS_THAT_HOARD_AND_DIE = 0.1;
-<a class="jxr_linenumber" name="67" href="#67">67</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> HOARD_FRC_OF_REGIONS = 0.8;
-<a class="jxr_linenumber" name="68" href="#68">68</a>      <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Waits between calling unbalance and killing servers, kills and rebalance, and rebalance</em>
-<a class="jxr_linenumber" name="69" href="#69">69</a>  <em class="jxr_javadoccomment">     * and restarting the servers; to make sure these events have time to impact the cluster. */</em>
-<a class="jxr_linenumber" name="70" href="#70">70</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> WAIT_FOR_UNBALANCE_MS = 2 * 1000;
-<a class="jxr_linenumber" name="71" href="#71">71</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> WAIT_FOR_KILLS_MS = 2 * 1000;
-<a class="jxr_linenumber" name="72" href="#72">72</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> WAIT_AFTER_BALANCE_MS = 5 * 1000;
-<a class="jxr_linenumber" name="73" href="#73">73</a>  
-<a class="jxr_linenumber" name="74" href="#74">74</a>      @Override
-<a class="jxr_linenumber" name="75" href="#75">75</a>      <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> perform() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="76" href="#76">76</a>        ClusterStatus status = <strong class="jxr_keyword">this</strong>.cluster.getClusterStatus();
-<a class="jxr_linenumber" name="77" href="#77">77</a>        List&lt;ServerName&gt; victimServers = <strong class="jxr_keyword">new</strong> LinkedList&lt;ServerName&gt;(status.getServers());
-<a class="jxr_linenumber" name="78" href="#78">78</a>        <strong class="jxr_keyword">int</strong> liveCount = (<strong class="jxr_keyword">int</strong>)Math.ceil(FRC_SERVERS_THAT_HOARD_AND_LIVE * victimServers.size());
-<a class="jxr_linenumber" name="79" href="#79">79</a>        <strong class="jxr_keyword">int</strong> deadCount = (<strong class="jxr_keyword">int</strong>)Math.ceil(FRC_SERVERS_THAT_HOARD_AND_DIE * victimServers.size());
-<a class="jxr_linenumber" name="80" href="#80">80</a>        Assert.assertTrue((liveCount + deadCount) &lt; victimServers.size());
-<a class="jxr_linenumber" name="81" href="#81">81</a>        List&lt;ServerName&gt; targetServers = <strong class="jxr_keyword">new</strong> ArrayList&lt;ServerName&gt;(liveCount);
-<a class="jxr_linenumber" name="82" href="#82">82</a>        <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; liveCount + deadCount; ++i) {
-<a class="jxr_linenumber" name="83" href="#83">83</a>          <strong class="jxr_keyword">int</strong> victimIx = random.nextInt(victimServers.size());
-<a class="jxr_linenumber" name="84" href="#84">84</a>          targetServers.add(victimServers.remove(victimIx));
-<a class="jxr_linenumber" name="85" href="#85">85</a>        }
-<a class="jxr_linenumber" name="86" href="#86">86</a>        unbalanceRegions(status, victimServers, targetServers, HOARD_FRC_OF_REGIONS);
-<a class="jxr_linenumber" name="87" href="#87">87</a>        Thread.sleep(WAIT_FOR_UNBALANCE_MS);
-<a class="jxr_linenumber" name="88" href="#88">88</a>        <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; liveCount; ++i) {
-<a class="jxr_linenumber" name="89" href="#89">89</a>          killRs(targetServers.get(i));
-<a class="jxr_linenumber" name="90" href="#90">90</a>        }
-<a class="jxr_linenumber" name="91" href="#91">91</a>        Thread.sleep(WAIT_FOR_KILLS_MS);
-<a class="jxr_linenumber" name="92" href="#92">92</a>        forceBalancer();
-<a class="jxr_linenumber" name="93" href="#93">93</a>        Thread.sleep(WAIT_AFTER_BALANCE_MS);
-<a class="jxr_linenumber" name="94" href="#94">94</a>        <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; liveCount; ++i) {
-<a class="jxr_linenumber" name="95" href="#95">95</a>          startRs(targetServers.get(i));
-<a class="jxr_linenumber" name="96" href="#96">96</a>        }
-<a class="jxr_linenumber" name="97" href="#97">97</a>      }
-<a class="jxr_linenumber" name="98" href="#98">98</a>    }
-<a class="jxr_linenumber" name="99" href="#99">99</a>  
-<a class="jxr_linenumber" name="100" href="#100">100</a>   @Before
-<a class="jxr_linenumber" name="101" href="#101">101</a>   @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
-<a class="jxr_linenumber" name="102" href="#102">102</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="103" href="#103">103</a>     <strong class="jxr_keyword">super</strong>.setUp(NUM_SLAVES_BASE);
-<a class="jxr_linenumber" name="104" href="#104">104</a> 
-<a class="jxr_linenumber" name="105" href="#105">105</a>     ChaosMonkey.Policy chaosPolicy = <strong class="jxr_keyword">new</strong> ChaosMonkey.PeriodicRandomActionPolicy(
-<a class="jxr_linenumber" name="106" href="#106">106</a>       CHAOS_EVERY_MS, <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html">UnbalanceKillAndRebalanceAction</a>());
-<a class="jxr_linenumber" name="107" href="#107">107</a>     monkey = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/util/ChaosMonkey.html">ChaosMonkey</a>(util, chaosPolicy);
-<a class="jxr_linenumber" name="108" href="#108">108</a>     monkey.start();
-<a class="jxr_linenumber" name="109" href="#109">109</a>   }
-<a class="jxr_linenumber" name="110" href="#110">110</a> 
-<a class="jxr_linenumber" name="111" href="#111">111</a>   @After
-<a class="jxr_linenumber" name="112" href="#112">112</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="113" href="#113">113</a>     <strong class="jxr_keyword">if</strong> (monkey != <strong class="jxr_keyword">null</strong>) {
-<a class="jxr_linenumber" name="114" href="#114">114</a>       monkey.stop(<span class="jxr_string">"tearDown"</span>);
-<a class="jxr_linenumber" name="115" href="#115">115</a>       monkey.waitForStop();
-<a class="jxr_linenumber" name="116" href="#116">116</a>     }
-<a class="jxr_linenumber" name="117" href="#117">117</a>     <strong class="jxr_keyword">super</strong>.tearDown();
-<a class="jxr_linenumber" name="118" href="#118">118</a>   }
-<a class="jxr_linenumber" name="119" href="#119">119</a> 
-<a class="jxr_linenumber" name="120" href="#120">120</a>   <em class="jxr_comment">// Disabled until we fix hbase-7520</em>
-<a class="jxr_linenumber" name="121" href="#121">121</a>   @Test
-<a class="jxr_linenumber" name="122" href="#122">122</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testDataIngest() <strong class="jxr_keyword">throws</strong> Exception {
-<a class="jxr_linenumber" name="123" href="#123">123</a>     runIngestTest(DEFAULT_RUN_TIME, 2500, 10, 100, 20);
-<a class="jxr_linenumber" name="124" href="#124">124</a>   }
-<a class="jxr_linenumber" name="125" href="#125">125</a> }
+<a class="jxr_linenumber" name="61" href="#61">61</a>    <strong class="jxr_keyword">private</strong> <a href="../../../../org/apache/hadoop/hbase/util/ChaosMonkey.html">ChaosMonkey</a> monkey;
+<a class="jxr_linenumber" name="62" href="#62">62</a>  
+<a class="jxr_linenumber" name="63" href="#63">63</a>    <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> This action is too specific to put in ChaosMonkey; put it here */</em>
+<a class="jxr_linenumber" name="64" href="#64">64</a>    <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">class</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html">UnbalanceKillAndRebalanceAction</a> <strong class="jxr_keyword">extends</strong> ChaosMonkey.Action {
+<a class="jxr_linenumber" name="65" href="#65">65</a>      <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Fractions of servers to get regions and live and die respectively; from all other</em>
+<a class="jxr_linenumber" name="66" href="#66">66</a>  <em class="jxr_javadoccomment">     * servers, HOARD_FRC_OF_REGIONS will be removed to the above randomly */</em>
+<a class="jxr_linenumber" name="67" href="#67">67</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> FRC_SERVERS_THAT_HOARD_AND_LIVE = 0.1;
+<a class="jxr_linenumber" name="68" href="#68">68</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> FRC_SERVERS_THAT_HOARD_AND_DIE = 0.1;
+<a class="jxr_linenumber" name="69" href="#69">69</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">double</strong> HOARD_FRC_OF_REGIONS = 0.8;
+<a class="jxr_linenumber" name="70" href="#70">70</a>      <em class="jxr_javadoccomment">/**</em><em class="jxr_javadoccomment"> Waits between calling unbalance and killing servers, kills and rebalance, and rebalance</em>
+<a class="jxr_linenumber" name="71" href="#71">71</a>  <em class="jxr_javadoccomment">     * and restarting the servers; to make sure these events have time to impact the cluster. */</em>
+<a class="jxr_linenumber" name="72" href="#72">72</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> WAIT_FOR_UNBALANCE_MS = 2 * 1000;
+<a class="jxr_linenumber" name="73" href="#73">73</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> WAIT_FOR_KILLS_MS = 2 * 1000;
+<a class="jxr_linenumber" name="74" href="#74">74</a>      <strong class="jxr_keyword">private</strong> <strong class="jxr_keyword">static</strong> <strong class="jxr_keyword">final</strong> <strong class="jxr_keyword">long</strong> WAIT_AFTER_BALANCE_MS = 5 * 1000;
+<a class="jxr_linenumber" name="75" href="#75">75</a>  
+<a class="jxr_linenumber" name="76" href="#76">76</a>      @Override
+<a class="jxr_linenumber" name="77" href="#77">77</a>      <strong class="jxr_keyword">protected</strong> <strong class="jxr_keyword">void</strong> perform() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="78" href="#78">78</a>        ClusterStatus status = <strong class="jxr_keyword">this</strong>.cluster.getClusterStatus();
+<a class="jxr_linenumber" name="79" href="#79">79</a>        List&lt;ServerName&gt; victimServers = <strong class="jxr_keyword">new</strong> LinkedList&lt;ServerName&gt;(status.getServers());
+<a class="jxr_linenumber" name="80" href="#80">80</a>        <strong class="jxr_keyword">int</strong> liveCount = (<strong class="jxr_keyword">int</strong>)Math.ceil(FRC_SERVERS_THAT_HOARD_AND_LIVE * victimServers.size());
+<a class="jxr_linenumber" name="81" href="#81">81</a>        <strong class="jxr_keyword">int</strong> deadCount = (<strong class="jxr_keyword">int</strong>)Math.ceil(FRC_SERVERS_THAT_HOARD_AND_DIE * victimServers.size());
+<a class="jxr_linenumber" name="82" href="#82">82</a>        Assert.assertTrue((liveCount + deadCount) &lt; victimServers.size());
+<a class="jxr_linenumber" name="83" href="#83">83</a>        List&lt;ServerName&gt; targetServers = <strong class="jxr_keyword">new</strong> ArrayList&lt;ServerName&gt;(liveCount);
+<a class="jxr_linenumber" name="84" href="#84">84</a>        <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; liveCount + deadCount; ++i) {
+<a class="jxr_linenumber" name="85" href="#85">85</a>          <strong class="jxr_keyword">int</strong> victimIx = random.nextInt(victimServers.size());
+<a class="jxr_linenumber" name="86" href="#86">86</a>          targetServers.add(victimServers.remove(victimIx));
+<a class="jxr_linenumber" name="87" href="#87">87</a>        }
+<a class="jxr_linenumber" name="88" href="#88">88</a>        unbalanceRegions(status, victimServers, targetServers, HOARD_FRC_OF_REGIONS);
+<a class="jxr_linenumber" name="89" href="#89">89</a>        Thread.sleep(WAIT_FOR_UNBALANCE_MS);
+<a class="jxr_linenumber" name="90" href="#90">90</a>        <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; liveCount; ++i) {
+<a class="jxr_linenumber" name="91" href="#91">91</a>          killRs(targetServers.get(i));
+<a class="jxr_linenumber" name="92" href="#92">92</a>        }
+<a class="jxr_linenumber" name="93" href="#93">93</a>        Thread.sleep(WAIT_FOR_KILLS_MS);
+<a class="jxr_linenumber" name="94" href="#94">94</a>        forceBalancer();
+<a class="jxr_linenumber" name="95" href="#95">95</a>        Thread.sleep(WAIT_AFTER_BALANCE_MS);
+<a class="jxr_linenumber" name="96" href="#96">96</a>        <strong class="jxr_keyword">for</strong> (<strong class="jxr_keyword">int</strong> i = 0; i &lt; liveCount; ++i) {
+<a class="jxr_linenumber" name="97" href="#97">97</a>          startRs(targetServers.get(i));
+<a class="jxr_linenumber" name="98" href="#98">98</a>        }
+<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> 
+<a class="jxr_linenumber" name="102" href="#102">102</a>   @Before
+<a class="jxr_linenumber" name="103" href="#103">103</a>   @SuppressWarnings(<span class="jxr_string">"unchecked"</span>)
+<a class="jxr_linenumber" name="104" href="#104">104</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="105" href="#105">105</a>     Configuration conf = HBaseConfiguration.create();
+<a class="jxr_linenumber" name="106" href="#106">106</a>     conf.set(HConnectionManager.RETRIES_BY_SERVER, <span class="jxr_string">"true"</span>);
+<a class="jxr_linenumber" name="107" href="#107">107</a>     <strong class="jxr_keyword">super</strong>.setUp(NUM_SLAVES_BASE, conf);
+<a class="jxr_linenumber" name="108" href="#108">108</a> 
+<a class="jxr_linenumber" name="109" href="#109">109</a>     ChaosMonkey.Policy chaosPolicy = <strong class="jxr_keyword">new</strong> ChaosMonkey.PeriodicRandomActionPolicy(
+<a class="jxr_linenumber" name="110" href="#110">110</a>       CHAOS_EVERY_MS, <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/IntegrationTestRebalanceAndKillServersTargeted.html">UnbalanceKillAndRebalanceAction</a>());
+<a class="jxr_linenumber" name="111" href="#111">111</a>     monkey = <strong class="jxr_keyword">new</strong> <a href="../../../../org/apache/hadoop/hbase/util/ChaosMonkey.html">ChaosMonkey</a>(util, chaosPolicy);
+<a class="jxr_linenumber" name="112" href="#112">112</a>     monkey.start();
+<a class="jxr_linenumber" name="113" href="#113">113</a>   }
+<a class="jxr_linenumber" name="114" href="#114">114</a> 
+<a class="jxr_linenumber" name="115" href="#115">115</a>   @After
+<a class="jxr_linenumber" name="116" href="#116">116</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="117" href="#117">117</a>     <strong class="jxr_keyword">if</strong> (monkey != <strong class="jxr_keyword">null</strong>) {
+<a class="jxr_linenumber" name="118" href="#118">118</a>       monkey.stop(<span class="jxr_string">"tearDown"</span>);
+<a class="jxr_linenumber" name="119" href="#119">119</a>       monkey.waitForStop();
+<a class="jxr_linenumber" name="120" href="#120">120</a>     }
+<a class="jxr_linenumber" name="121" href="#121">121</a>     <strong class="jxr_keyword">super</strong>.tearDown();
+<a class="jxr_linenumber" name="122" href="#122">122</a>   }
+<a class="jxr_linenumber" name="123" href="#123">123</a> 
+<a class="jxr_linenumber" name="124" href="#124">124</a>   <em class="jxr_comment">// Disabled until we fix hbase-7520</em>
+<a class="jxr_linenumber" name="125" href="#125">125</a>   @Test
+<a class="jxr_linenumber" name="126" href="#126">126</a>   <strong class="jxr_keyword">public</strong> <strong class="jxr_keyword">void</strong> testDataIngest() <strong class="jxr_keyword">throws</strong> Exception {
+<a class="jxr_linenumber" name="127" href="#127">127</a>     runIngestTest(DEFAULT_RUN_TIME, 2500, 10, 100, 20);
+<a class="jxr_linenumber" name="128" href="#128">128</a>   }
+<a class="jxr_linenumber" name="129" href="#129">129</a> }
 </pre>
 <hr/><div id="footer">This page was automatically generated by <a href="http://maven.apache.org/">Maven</a></div></body>
 </html>



Mime
View raw message