hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [05/51] [partial] hbase-site git commit: Published site at .
Date Mon, 06 Nov 2017 15:17:24 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/32453e2d/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.html
index 59a55cf..a7a41a9 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi.html
@@ -39,290 +39,289 @@
 <span class="sourceLineNo">031</span>import java.util.EnumSet;<a name="line.31"></a>
 <span class="sourceLineNo">032</span>import java.util.List;<a name="line.32"></a>
 <span class="sourceLineNo">033</span>import java.util.Map;<a name="line.33"></a>
-<span class="sourceLineNo">034</span>import java.util.Optional;<a name="line.34"></a>
-<span class="sourceLineNo">035</span><a name="line.35"></a>
-<span class="sourceLineNo">036</span>import org.apache.hadoop.conf.Configuration;<a name="line.36"></a>
-<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.ClusterStatus;<a name="line.37"></a>
-<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.ClusterStatus.Option;<a name="line.38"></a>
-<span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.HBaseTestingUtility;<a name="line.39"></a>
-<span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.HConstants;<a name="line.40"></a>
-<span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.RegionLoad;<a name="line.41"></a>
-<span class="sourceLineNo">042</span>import org.apache.hadoop.hbase.ServerLoad;<a name="line.42"></a>
-<span class="sourceLineNo">043</span>import org.apache.hadoop.hbase.ServerName;<a name="line.43"></a>
-<span class="sourceLineNo">044</span>import org.apache.hadoop.hbase.TableName;<a name="line.44"></a>
-<span class="sourceLineNo">045</span>import org.apache.hadoop.hbase.regionserver.HRegion;<a name="line.45"></a>
-<span class="sourceLineNo">046</span>import org.apache.hadoop.hbase.regionserver.HRegionServer;<a name="line.46"></a>
-<span class="sourceLineNo">047</span>import org.apache.hadoop.hbase.testclassification.ClientTests;<a name="line.47"></a>
-<span class="sourceLineNo">048</span>import org.apache.hadoop.hbase.testclassification.MediumTests;<a name="line.48"></a>
-<span class="sourceLineNo">049</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.49"></a>
-<span class="sourceLineNo">050</span>import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;<a name="line.50"></a>
-<span class="sourceLineNo">051</span>import org.junit.BeforeClass;<a name="line.51"></a>
-<span class="sourceLineNo">052</span>import org.junit.Test;<a name="line.52"></a>
-<span class="sourceLineNo">053</span>import org.junit.experimental.categories.Category;<a name="line.53"></a>
-<span class="sourceLineNo">054</span>import org.junit.runner.RunWith;<a name="line.54"></a>
-<span class="sourceLineNo">055</span>import org.junit.runners.Parameterized;<a name="line.55"></a>
-<span class="sourceLineNo">056</span><a name="line.56"></a>
-<span class="sourceLineNo">057</span>import com.google.common.collect.Lists;<a name="line.57"></a>
-<span class="sourceLineNo">058</span>import com.google.common.collect.Maps;<a name="line.58"></a>
-<span class="sourceLineNo">059</span><a name="line.59"></a>
-<span class="sourceLineNo">060</span>@RunWith(Parameterized.class)<a name="line.60"></a>
-<span class="sourceLineNo">061</span>@Category({ ClientTests.class, MediumTests.class })<a name="line.61"></a>
-<span class="sourceLineNo">062</span>public class TestAsyncClusterAdminApi extends TestAsyncAdminBase {<a name="line.62"></a>
-<span class="sourceLineNo">063</span><a name="line.63"></a>
-<span class="sourceLineNo">064</span>  private final Path cnfPath = FileSystems.getDefault().getPath("target/test-classes/hbase-site.xml");<a name="line.64"></a>
-<span class="sourceLineNo">065</span>  private final Path cnf2Path = FileSystems.getDefault().getPath("target/test-classes/hbase-site2.xml");<a name="line.65"></a>
-<span class="sourceLineNo">066</span>  private final Path cnf3Path = FileSystems.getDefault().getPath("target/test-classes/hbase-site3.xml");<a name="line.66"></a>
-<span class="sourceLineNo">067</span><a name="line.67"></a>
-<span class="sourceLineNo">068</span>  @BeforeClass<a name="line.68"></a>
-<span class="sourceLineNo">069</span>  public static void setUpBeforeClass() throws Exception {<a name="line.69"></a>
-<span class="sourceLineNo">070</span>    TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 0);<a name="line.70"></a>
-<span class="sourceLineNo">071</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 60000);<a name="line.71"></a>
-<span class="sourceLineNo">072</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 120000);<a name="line.72"></a>
-<span class="sourceLineNo">073</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);<a name="line.73"></a>
-<span class="sourceLineNo">074</span>    TEST_UTIL.getConfiguration().setInt(START_LOG_ERRORS_AFTER_COUNT_KEY, 0);<a name="line.74"></a>
-<span class="sourceLineNo">075</span>    TEST_UTIL.startMiniCluster(2);<a name="line.75"></a>
-<span class="sourceLineNo">076</span>    ASYNC_CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get();<a name="line.76"></a>
-<span class="sourceLineNo">077</span>  }<a name="line.77"></a>
-<span class="sourceLineNo">078</span><a name="line.78"></a>
-<span class="sourceLineNo">079</span>  @Test<a name="line.79"></a>
-<span class="sourceLineNo">080</span>  public void testGetMasterInfoPort() throws Exception {<a name="line.80"></a>
-<span class="sourceLineNo">081</span>    assertEquals(TEST_UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(), (int) admin<a name="line.81"></a>
-<span class="sourceLineNo">082</span>        .getMasterInfoPort().get());<a name="line.82"></a>
-<span class="sourceLineNo">083</span>  }<a name="line.83"></a>
-<span class="sourceLineNo">084</span><a name="line.84"></a>
-<span class="sourceLineNo">085</span>  @Test<a name="line.85"></a>
-<span class="sourceLineNo">086</span>  public void testRegionServerOnlineConfigChange() throws Exception {<a name="line.86"></a>
-<span class="sourceLineNo">087</span>    replaceHBaseSiteXML();<a name="line.87"></a>
-<span class="sourceLineNo">088</span>    admin.getRegionServers().get().forEach(server -&gt; admin.updateConfiguration(server).join());<a name="line.88"></a>
-<span class="sourceLineNo">089</span><a name="line.89"></a>
-<span class="sourceLineNo">090</span>    // Check the configuration of the RegionServers<a name="line.90"></a>
-<span class="sourceLineNo">091</span>    TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -&gt; {<a name="line.91"></a>
-<span class="sourceLineNo">092</span>      Configuration conf = thread.getRegionServer().getConfiguration();<a name="line.92"></a>
-<span class="sourceLineNo">093</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.93"></a>
-<span class="sourceLineNo">094</span>    });<a name="line.94"></a>
-<span class="sourceLineNo">095</span><a name="line.95"></a>
-<span class="sourceLineNo">096</span>    restoreHBaseSiteXML();<a name="line.96"></a>
-<span class="sourceLineNo">097</span>  }<a name="line.97"></a>
-<span class="sourceLineNo">098</span><a name="line.98"></a>
-<span class="sourceLineNo">099</span>  @Test<a name="line.99"></a>
-<span class="sourceLineNo">100</span>  public void testMasterOnlineConfigChange() throws Exception {<a name="line.100"></a>
-<span class="sourceLineNo">101</span>    replaceHBaseSiteXML();<a name="line.101"></a>
-<span class="sourceLineNo">102</span>    ServerName master = admin.getMaster().get();<a name="line.102"></a>
-<span class="sourceLineNo">103</span>    admin.updateConfiguration(master).join();<a name="line.103"></a>
-<span class="sourceLineNo">104</span>    admin.getBackupMasters().get()<a name="line.104"></a>
-<span class="sourceLineNo">105</span>        .forEach(backupMaster -&gt; admin.updateConfiguration(backupMaster).join());<a name="line.105"></a>
-<span class="sourceLineNo">106</span><a name="line.106"></a>
-<span class="sourceLineNo">107</span>    // Check the configuration of the Masters<a name="line.107"></a>
-<span class="sourceLineNo">108</span>    TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -&gt; {<a name="line.108"></a>
-<span class="sourceLineNo">109</span>      Configuration conf = thread.getMaster().getConfiguration();<a name="line.109"></a>
-<span class="sourceLineNo">110</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.110"></a>
-<span class="sourceLineNo">111</span>    });<a name="line.111"></a>
-<span class="sourceLineNo">112</span><a name="line.112"></a>
-<span class="sourceLineNo">113</span>    restoreHBaseSiteXML();<a name="line.113"></a>
-<span class="sourceLineNo">114</span>  }<a name="line.114"></a>
-<span class="sourceLineNo">115</span><a name="line.115"></a>
-<span class="sourceLineNo">116</span>  @Test<a name="line.116"></a>
-<span class="sourceLineNo">117</span>  public void testAllClusterOnlineConfigChange() throws IOException {<a name="line.117"></a>
-<span class="sourceLineNo">118</span>    replaceHBaseSiteXML();<a name="line.118"></a>
-<span class="sourceLineNo">119</span>    admin.updateConfiguration().join();<a name="line.119"></a>
-<span class="sourceLineNo">120</span><a name="line.120"></a>
-<span class="sourceLineNo">121</span>    // Check the configuration of the Masters<a name="line.121"></a>
-<span class="sourceLineNo">122</span>    TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -&gt; {<a name="line.122"></a>
-<span class="sourceLineNo">123</span>      Configuration conf = thread.getMaster().getConfiguration();<a name="line.123"></a>
-<span class="sourceLineNo">124</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.124"></a>
-<span class="sourceLineNo">125</span>    });<a name="line.125"></a>
-<span class="sourceLineNo">126</span><a name="line.126"></a>
-<span class="sourceLineNo">127</span>    // Check the configuration of the RegionServers<a name="line.127"></a>
-<span class="sourceLineNo">128</span>    TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -&gt; {<a name="line.128"></a>
-<span class="sourceLineNo">129</span>      Configuration conf = thread.getRegionServer().getConfiguration();<a name="line.129"></a>
-<span class="sourceLineNo">130</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.130"></a>
-<span class="sourceLineNo">131</span>    });<a name="line.131"></a>
-<span class="sourceLineNo">132</span><a name="line.132"></a>
-<span class="sourceLineNo">133</span>    restoreHBaseSiteXML();<a name="line.133"></a>
-<span class="sourceLineNo">134</span>  }<a name="line.134"></a>
-<span class="sourceLineNo">135</span><a name="line.135"></a>
-<span class="sourceLineNo">136</span>  private void replaceHBaseSiteXML() throws IOException {<a name="line.136"></a>
-<span class="sourceLineNo">137</span>    // make a backup of hbase-site.xml<a name="line.137"></a>
-<span class="sourceLineNo">138</span>    Files.copy(cnfPath, cnf3Path, StandardCopyOption.REPLACE_EXISTING);<a name="line.138"></a>
-<span class="sourceLineNo">139</span>    // update hbase-site.xml by overwriting it<a name="line.139"></a>
-<span class="sourceLineNo">140</span>    Files.copy(cnf2Path, cnfPath, StandardCopyOption.REPLACE_EXISTING);<a name="line.140"></a>
-<span class="sourceLineNo">141</span>  }<a name="line.141"></a>
-<span class="sourceLineNo">142</span><a name="line.142"></a>
-<span class="sourceLineNo">143</span>  private void restoreHBaseSiteXML() throws IOException {<a name="line.143"></a>
-<span class="sourceLineNo">144</span>    // restore hbase-site.xml<a name="line.144"></a>
-<span class="sourceLineNo">145</span>    Files.copy(cnf3Path, cnfPath, StandardCopyOption.REPLACE_EXISTING);<a name="line.145"></a>
-<span class="sourceLineNo">146</span>  }<a name="line.146"></a>
-<span class="sourceLineNo">147</span><a name="line.147"></a>
-<span class="sourceLineNo">148</span>  @Test<a name="line.148"></a>
-<span class="sourceLineNo">149</span>  public void testRollWALWALWriter() throws Exception {<a name="line.149"></a>
-<span class="sourceLineNo">150</span>    setUpforLogRolling();<a name="line.150"></a>
-<span class="sourceLineNo">151</span>    String className = this.getClass().getName();<a name="line.151"></a>
-<span class="sourceLineNo">152</span>    StringBuilder v = new StringBuilder(className);<a name="line.152"></a>
-<span class="sourceLineNo">153</span>    while (v.length() &lt; 1000) {<a name="line.153"></a>
-<span class="sourceLineNo">154</span>      v.append(className);<a name="line.154"></a>
-<span class="sourceLineNo">155</span>    }<a name="line.155"></a>
-<span class="sourceLineNo">156</span>    byte[] value = Bytes.toBytes(v.toString());<a name="line.156"></a>
-<span class="sourceLineNo">157</span>    HRegionServer regionServer = startAndWriteData(tableName, value);<a name="line.157"></a>
-<span class="sourceLineNo">158</span>    LOG.info("after writing there are "<a name="line.158"></a>
-<span class="sourceLineNo">159</span>        + AbstractFSWALProvider.getNumRolledLogFiles(regionServer.getWAL(null)) + " log files");<a name="line.159"></a>
-<span class="sourceLineNo">160</span><a name="line.160"></a>
-<span class="sourceLineNo">161</span>    // flush all regions<a name="line.161"></a>
-<span class="sourceLineNo">162</span>    for (HRegion r : regionServer.getOnlineRegionsLocalContext()) {<a name="line.162"></a>
-<span class="sourceLineNo">163</span>      r.flush(true);<a name="line.163"></a>
-<span class="sourceLineNo">164</span>    }<a name="line.164"></a>
-<span class="sourceLineNo">165</span>    admin.rollWALWriter(regionServer.getServerName()).join();<a name="line.165"></a>
-<span class="sourceLineNo">166</span>    int count = AbstractFSWALProvider.getNumRolledLogFiles(regionServer.getWAL(null));<a name="line.166"></a>
-<span class="sourceLineNo">167</span>    LOG.info("after flushing all regions and rolling logs there are " +<a name="line.167"></a>
-<span class="sourceLineNo">168</span>        count + " log files");<a name="line.168"></a>
-<span class="sourceLineNo">169</span>    assertTrue(("actual count: " + count), count &lt;= 2);<a name="line.169"></a>
-<span class="sourceLineNo">170</span>  }<a name="line.170"></a>
-<span class="sourceLineNo">171</span><a name="line.171"></a>
-<span class="sourceLineNo">172</span>  private void setUpforLogRolling() {<a name="line.172"></a>
-<span class="sourceLineNo">173</span>    // Force a region split after every 768KB<a name="line.173"></a>
-<span class="sourceLineNo">174</span>    TEST_UTIL.getConfiguration().setLong(HConstants.HREGION_MAX_FILESIZE,<a name="line.174"></a>
-<span class="sourceLineNo">175</span>        768L * 1024L);<a name="line.175"></a>
-<span class="sourceLineNo">176</span><a name="line.176"></a>
-<span class="sourceLineNo">177</span>    // We roll the log after every 32 writes<a name="line.177"></a>
-<span class="sourceLineNo">178</span>    TEST_UTIL.getConfiguration().setInt("hbase.regionserver.maxlogentries", 32);<a name="line.178"></a>
-<span class="sourceLineNo">179</span><a name="line.179"></a>
-<span class="sourceLineNo">180</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.180"></a>
-<span class="sourceLineNo">181</span>        "hbase.regionserver.logroll.errors.tolerated", 2);<a name="line.181"></a>
-<span class="sourceLineNo">182</span>    TEST_UTIL.getConfiguration().setInt("hbase.rpc.timeout", 10 * 1000);<a name="line.182"></a>
-<span class="sourceLineNo">183</span><a name="line.183"></a>
-<span class="sourceLineNo">184</span>    // For less frequently updated regions flush after every 2 flushes<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.185"></a>
-<span class="sourceLineNo">186</span>        "hbase.hregion.memstore.optionalflushcount", 2);<a name="line.186"></a>
-<span class="sourceLineNo">187</span><a name="line.187"></a>
-<span class="sourceLineNo">188</span>    // We flush the cache after every 8192 bytes<a name="line.188"></a>
-<span class="sourceLineNo">189</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HREGION_MEMSTORE_FLUSH_SIZE,<a name="line.189"></a>
-<span class="sourceLineNo">190</span>        8192);<a name="line.190"></a>
-<span class="sourceLineNo">191</span><a name="line.191"></a>
-<span class="sourceLineNo">192</span>    // Increase the amount of time between client retries<a name="line.192"></a>
-<span class="sourceLineNo">193</span>    TEST_UTIL.getConfiguration().setLong("hbase.client.pause", 10 * 1000);<a name="line.193"></a>
-<span class="sourceLineNo">194</span><a name="line.194"></a>
-<span class="sourceLineNo">195</span>    // Reduce thread wake frequency so that other threads can get<a name="line.195"></a>
-<span class="sourceLineNo">196</span>    // a chance to run.<a name="line.196"></a>
-<span class="sourceLineNo">197</span>    TEST_UTIL.getConfiguration().setInt(HConstants.THREAD_WAKE_FREQUENCY,<a name="line.197"></a>
-<span class="sourceLineNo">198</span>        2 * 1000);<a name="line.198"></a>
-<span class="sourceLineNo">199</span><a name="line.199"></a>
-<span class="sourceLineNo">200</span>    /**** configuration for testLogRollOnDatanodeDeath ****/<a name="line.200"></a>
-<span class="sourceLineNo">201</span>    // lower the namenode &amp; datanode heartbeat so the namenode<a name="line.201"></a>
-<span class="sourceLineNo">202</span>    // quickly detects datanode failures<a name="line.202"></a>
-<span class="sourceLineNo">203</span>    TEST_UTIL.getConfiguration().setInt("dfs.namenode.heartbeat.recheck-interval", 5000);<a name="line.203"></a>
-<span class="sourceLineNo">204</span>    TEST_UTIL.getConfiguration().setInt("dfs.heartbeat.interval", 1);<a name="line.204"></a>
-<span class="sourceLineNo">205</span>    // the namenode might still try to choose the recently-dead datanode<a name="line.205"></a>
-<span class="sourceLineNo">206</span>    // for a pipeline, so try to a new pipeline multiple times<a name="line.206"></a>
-<span class="sourceLineNo">207</span>    TEST_UTIL.getConfiguration().setInt("dfs.client.block.write.retries", 30);<a name="line.207"></a>
-<span class="sourceLineNo">208</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.208"></a>
-<span class="sourceLineNo">209</span>        "hbase.regionserver.hlog.tolerable.lowreplication", 2);<a name="line.209"></a>
-<span class="sourceLineNo">210</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.210"></a>
-<span class="sourceLineNo">211</span>        "hbase.regionserver.hlog.lowreplication.rolllimit", 3);<a name="line.211"></a>
-<span class="sourceLineNo">212</span>  }<a name="line.212"></a>
-<span class="sourceLineNo">213</span><a name="line.213"></a>
-<span class="sourceLineNo">214</span>  private HRegionServer startAndWriteData(TableName tableName, byte[] value) throws Exception {<a name="line.214"></a>
-<span class="sourceLineNo">215</span>    createTableWithDefaultConf(tableName);<a name="line.215"></a>
-<span class="sourceLineNo">216</span>    RawAsyncTable table = ASYNC_CONN.getRawTable(tableName);<a name="line.216"></a>
-<span class="sourceLineNo">217</span>    HRegionServer regionServer = TEST_UTIL.getRSForFirstRegionInTable(tableName);<a name="line.217"></a>
-<span class="sourceLineNo">218</span>    for (int i = 1; i &lt;= 256; i++) { // 256 writes should cause 8 log rolls<a name="line.218"></a>
-<span class="sourceLineNo">219</span>      Put put = new Put(Bytes.toBytes("row" + String.format("%1$04d", i)));<a name="line.219"></a>
-<span class="sourceLineNo">220</span>      put.addColumn(FAMILY, null, value);<a name="line.220"></a>
-<span class="sourceLineNo">221</span>      table.put(put).join();<a name="line.221"></a>
-<span class="sourceLineNo">222</span>      if (i % 32 == 0) {<a name="line.222"></a>
-<span class="sourceLineNo">223</span>        // After every 32 writes sleep to let the log roller run<a name="line.223"></a>
-<span class="sourceLineNo">224</span>        try {<a name="line.224"></a>
-<span class="sourceLineNo">225</span>          Thread.sleep(2000);<a name="line.225"></a>
-<span class="sourceLineNo">226</span>        } catch (InterruptedException e) {<a name="line.226"></a>
-<span class="sourceLineNo">227</span>          // continue<a name="line.227"></a>
-<span class="sourceLineNo">228</span>        }<a name="line.228"></a>
-<span class="sourceLineNo">229</span>      }<a name="line.229"></a>
-<span class="sourceLineNo">230</span>    }<a name="line.230"></a>
-<span class="sourceLineNo">231</span>    return regionServer;<a name="line.231"></a>
-<span class="sourceLineNo">232</span>  }<a name="line.232"></a>
-<span class="sourceLineNo">233</span><a name="line.233"></a>
-<span class="sourceLineNo">234</span>  @Test<a name="line.234"></a>
-<span class="sourceLineNo">235</span>  public void testGetRegionLoads() throws Exception {<a name="line.235"></a>
-<span class="sourceLineNo">236</span>    // Turn off the balancer<a name="line.236"></a>
-<span class="sourceLineNo">237</span>    admin.setBalancerOn(false).join();<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    TableName[] tables =<a name="line.238"></a>
-<span class="sourceLineNo">239</span>        new TableName[] { TableName.valueOf(tableName.getNameAsString() + "1"),<a name="line.239"></a>
-<span class="sourceLineNo">240</span>            TableName.valueOf(tableName.getNameAsString() + "2"),<a name="line.240"></a>
-<span class="sourceLineNo">241</span>            TableName.valueOf(tableName.getNameAsString() + "3") };<a name="line.241"></a>
-<span class="sourceLineNo">242</span>    createAndLoadTable(tables);<a name="line.242"></a>
-<span class="sourceLineNo">243</span>    // Sleep to wait region server report<a name="line.243"></a>
-<span class="sourceLineNo">244</span>    Thread.sleep(TEST_UTIL.getConfiguration().getInt("hbase.regionserver.msginterval", 3 * 1000) * 2);<a name="line.244"></a>
-<span class="sourceLineNo">245</span>    // Check if regions match with the regionLoad from the server<a name="line.245"></a>
-<span class="sourceLineNo">246</span>    Collection&lt;ServerName&gt; servers = admin.getRegionServers().get();<a name="line.246"></a>
-<span class="sourceLineNo">247</span>    for (ServerName serverName : servers) {<a name="line.247"></a>
-<span class="sourceLineNo">248</span>      List&lt;RegionInfo&gt; regions = admin.getOnlineRegions(serverName).get();<a name="line.248"></a>
-<span class="sourceLineNo">249</span>      checkRegionsAndRegionLoads(regions, admin.getRegionLoads(serverName).get());<a name="line.249"></a>
-<span class="sourceLineNo">250</span>    }<a name="line.250"></a>
-<span class="sourceLineNo">251</span><a name="line.251"></a>
-<span class="sourceLineNo">252</span>    // Check if regionLoad matches the table's regions and nothing is missed<a name="line.252"></a>
-<span class="sourceLineNo">253</span>    for (TableName table : tables) {<a name="line.253"></a>
-<span class="sourceLineNo">254</span>      List&lt;RegionInfo&gt; tableRegions = admin.getTableRegions(table).get();<a name="line.254"></a>
-<span class="sourceLineNo">255</span>      List&lt;RegionLoad&gt; regionLoads = Lists.newArrayList();<a name="line.255"></a>
-<span class="sourceLineNo">256</span>      for (ServerName serverName : servers) {<a name="line.256"></a>
-<span class="sourceLineNo">257</span>        regionLoads.addAll(admin.getRegionLoads(serverName, Optional.of(table)).get());<a name="line.257"></a>
-<span class="sourceLineNo">258</span>      }<a name="line.258"></a>
-<span class="sourceLineNo">259</span>      checkRegionsAndRegionLoads(tableRegions, regionLoads);<a name="line.259"></a>
-<span class="sourceLineNo">260</span>    }<a name="line.260"></a>
-<span class="sourceLineNo">261</span><a name="line.261"></a>
-<span class="sourceLineNo">262</span>    // Check RegionLoad matches the regionLoad from ClusterStatus<a name="line.262"></a>
-<span class="sourceLineNo">263</span>    ClusterStatus clusterStatus = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).get();<a name="line.263"></a>
-<span class="sourceLineNo">264</span>    for (ServerName serverName : clusterStatus.getServers()) {<a name="line.264"></a>
-<span class="sourceLineNo">265</span>      ServerLoad serverLoad = clusterStatus.getLoad(serverName);<a name="line.265"></a>
-<span class="sourceLineNo">266</span>      compareRegionLoads(serverLoad.getRegionsLoad().values(), admin.getRegionLoads(serverName)<a name="line.266"></a>
-<span class="sourceLineNo">267</span>          .get());<a name="line.267"></a>
-<span class="sourceLineNo">268</span>    }<a name="line.268"></a>
-<span class="sourceLineNo">269</span>  }<a name="line.269"></a>
-<span class="sourceLineNo">270</span><a name="line.270"></a>
-<span class="sourceLineNo">271</span>  private void compareRegionLoads(Collection&lt;RegionLoad&gt; regionLoadCluster,<a name="line.271"></a>
-<span class="sourceLineNo">272</span>      Collection&lt;RegionLoad&gt; regionLoads) {<a name="line.272"></a>
-<span class="sourceLineNo">273</span><a name="line.273"></a>
-<span class="sourceLineNo">274</span>    assertEquals("No of regionLoads from clusterStatus and regionloads from RS doesn't match",<a name="line.274"></a>
-<span class="sourceLineNo">275</span>      regionLoadCluster.size(), regionLoads.size());<a name="line.275"></a>
-<span class="sourceLineNo">276</span><a name="line.276"></a>
-<span class="sourceLineNo">277</span>    for (RegionLoad loadCluster : regionLoadCluster) {<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      boolean matched = false;<a name="line.278"></a>
-<span class="sourceLineNo">279</span>      for (RegionLoad load : regionLoads) {<a name="line.279"></a>
-<span class="sourceLineNo">280</span>        if (Bytes.equals(loadCluster.getName(), load.getName())) {<a name="line.280"></a>
-<span class="sourceLineNo">281</span>          matched = true;<a name="line.281"></a>
-<span class="sourceLineNo">282</span>          continue;<a name="line.282"></a>
-<span class="sourceLineNo">283</span>        }<a name="line.283"></a>
-<span class="sourceLineNo">284</span>      }<a name="line.284"></a>
-<span class="sourceLineNo">285</span>      assertTrue("The contents of region load from cluster and server should match", matched);<a name="line.285"></a>
-<span class="sourceLineNo">286</span>    }<a name="line.286"></a>
-<span class="sourceLineNo">287</span>  }<a name="line.287"></a>
-<span class="sourceLineNo">288</span><a name="line.288"></a>
-<span class="sourceLineNo">289</span>  private void checkRegionsAndRegionLoads(Collection&lt;RegionInfo&gt; regions,<a name="line.289"></a>
-<span class="sourceLineNo">290</span>      Collection&lt;RegionLoad&gt; regionLoads) {<a name="line.290"></a>
-<span class="sourceLineNo">291</span><a name="line.291"></a>
-<span class="sourceLineNo">292</span>    assertEquals("No of regions and regionloads doesn't match", regions.size(), regionLoads.size());<a name="line.292"></a>
-<span class="sourceLineNo">293</span><a name="line.293"></a>
-<span class="sourceLineNo">294</span>    Map&lt;byte[], RegionLoad&gt; regionLoadMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);<a name="line.294"></a>
-<span class="sourceLineNo">295</span>    for (RegionLoad regionLoad : regionLoads) {<a name="line.295"></a>
-<span class="sourceLineNo">296</span>      regionLoadMap.put(regionLoad.getName(), regionLoad);<a name="line.296"></a>
-<span class="sourceLineNo">297</span>    }<a name="line.297"></a>
-<span class="sourceLineNo">298</span>    for (RegionInfo info : regions) {<a name="line.298"></a>
-<span class="sourceLineNo">299</span>      assertTrue("Region not in regionLoadMap region:" + info.getRegionNameAsString()<a name="line.299"></a>
-<span class="sourceLineNo">300</span>          + " regionMap: " + regionLoadMap, regionLoadMap.containsKey(info.getRegionName()));<a name="line.300"></a>
-<span class="sourceLineNo">301</span>    }<a name="line.301"></a>
-<span class="sourceLineNo">302</span>  }<a name="line.302"></a>
-<span class="sourceLineNo">303</span><a name="line.303"></a>
-<span class="sourceLineNo">304</span>  private void createAndLoadTable(TableName[] tables) {<a name="line.304"></a>
-<span class="sourceLineNo">305</span>    for (TableName table : tables) {<a name="line.305"></a>
-<span class="sourceLineNo">306</span>      TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(table);<a name="line.306"></a>
-<span class="sourceLineNo">307</span>      builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY));<a name="line.307"></a>
-<span class="sourceLineNo">308</span>      admin.createTable(builder.build(), Bytes.toBytes("aaaaa"), Bytes.toBytes("zzzzz"), 16).join();<a name="line.308"></a>
-<span class="sourceLineNo">309</span>      RawAsyncTable asyncTable = ASYNC_CONN.getRawTable(table);<a name="line.309"></a>
-<span class="sourceLineNo">310</span>      List&lt;Put&gt; puts = new ArrayList&lt;&gt;();<a name="line.310"></a>
-<span class="sourceLineNo">311</span>      for (byte[] row : HBaseTestingUtility.ROWS) {<a name="line.311"></a>
-<span class="sourceLineNo">312</span>        puts.add(new Put(row).addColumn(FAMILY, Bytes.toBytes("q"), Bytes.toBytes("v")));<a name="line.312"></a>
-<span class="sourceLineNo">313</span>      }<a name="line.313"></a>
-<span class="sourceLineNo">314</span>      asyncTable.putAll(puts).join();<a name="line.314"></a>
-<span class="sourceLineNo">315</span>    }<a name="line.315"></a>
-<span class="sourceLineNo">316</span>  }<a name="line.316"></a>
-<span class="sourceLineNo">317</span>}<a name="line.317"></a>
+<span class="sourceLineNo">034</span><a name="line.34"></a>
+<span class="sourceLineNo">035</span>import org.apache.hadoop.conf.Configuration;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import org.apache.hadoop.hbase.ClusterStatus;<a name="line.36"></a>
+<span class="sourceLineNo">037</span>import org.apache.hadoop.hbase.ClusterStatus.Option;<a name="line.37"></a>
+<span class="sourceLineNo">038</span>import org.apache.hadoop.hbase.HBaseTestingUtility;<a name="line.38"></a>
+<span class="sourceLineNo">039</span>import org.apache.hadoop.hbase.HConstants;<a name="line.39"></a>
+<span class="sourceLineNo">040</span>import org.apache.hadoop.hbase.RegionLoad;<a name="line.40"></a>
+<span class="sourceLineNo">041</span>import org.apache.hadoop.hbase.ServerLoad;<a name="line.41"></a>
+<span class="sourceLineNo">042</span>import org.apache.hadoop.hbase.ServerName;<a name="line.42"></a>
+<span class="sourceLineNo">043</span>import org.apache.hadoop.hbase.TableName;<a name="line.43"></a>
+<span class="sourceLineNo">044</span>import org.apache.hadoop.hbase.regionserver.HRegion;<a name="line.44"></a>
+<span class="sourceLineNo">045</span>import org.apache.hadoop.hbase.regionserver.HRegionServer;<a name="line.45"></a>
+<span class="sourceLineNo">046</span>import org.apache.hadoop.hbase.testclassification.ClientTests;<a name="line.46"></a>
+<span class="sourceLineNo">047</span>import org.apache.hadoop.hbase.testclassification.MediumTests;<a name="line.47"></a>
+<span class="sourceLineNo">048</span>import org.apache.hadoop.hbase.util.Bytes;<a name="line.48"></a>
+<span class="sourceLineNo">049</span>import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;<a name="line.49"></a>
+<span class="sourceLineNo">050</span>import org.junit.BeforeClass;<a name="line.50"></a>
+<span class="sourceLineNo">051</span>import org.junit.Test;<a name="line.51"></a>
+<span class="sourceLineNo">052</span>import org.junit.experimental.categories.Category;<a name="line.52"></a>
+<span class="sourceLineNo">053</span>import org.junit.runner.RunWith;<a name="line.53"></a>
+<span class="sourceLineNo">054</span>import org.junit.runners.Parameterized;<a name="line.54"></a>
+<span class="sourceLineNo">055</span><a name="line.55"></a>
+<span class="sourceLineNo">056</span>import com.google.common.collect.Lists;<a name="line.56"></a>
+<span class="sourceLineNo">057</span>import com.google.common.collect.Maps;<a name="line.57"></a>
+<span class="sourceLineNo">058</span><a name="line.58"></a>
+<span class="sourceLineNo">059</span>@RunWith(Parameterized.class)<a name="line.59"></a>
+<span class="sourceLineNo">060</span>@Category({ ClientTests.class, MediumTests.class })<a name="line.60"></a>
+<span class="sourceLineNo">061</span>public class TestAsyncClusterAdminApi extends TestAsyncAdminBase {<a name="line.61"></a>
+<span class="sourceLineNo">062</span><a name="line.62"></a>
+<span class="sourceLineNo">063</span>  private final Path cnfPath = FileSystems.getDefault().getPath("target/test-classes/hbase-site.xml");<a name="line.63"></a>
+<span class="sourceLineNo">064</span>  private final Path cnf2Path = FileSystems.getDefault().getPath("target/test-classes/hbase-site2.xml");<a name="line.64"></a>
+<span class="sourceLineNo">065</span>  private final Path cnf3Path = FileSystems.getDefault().getPath("target/test-classes/hbase-site3.xml");<a name="line.65"></a>
+<span class="sourceLineNo">066</span><a name="line.66"></a>
+<span class="sourceLineNo">067</span>  @BeforeClass<a name="line.67"></a>
+<span class="sourceLineNo">068</span>  public static void setUpBeforeClass() throws Exception {<a name="line.68"></a>
+<span class="sourceLineNo">069</span>    TEST_UTIL.getConfiguration().setInt(HConstants.MASTER_INFO_PORT, 0);<a name="line.69"></a>
+<span class="sourceLineNo">070</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 60000);<a name="line.70"></a>
+<span class="sourceLineNo">071</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_OPERATION_TIMEOUT, 120000);<a name="line.71"></a>
+<span class="sourceLineNo">072</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);<a name="line.72"></a>
+<span class="sourceLineNo">073</span>    TEST_UTIL.getConfiguration().setInt(START_LOG_ERRORS_AFTER_COUNT_KEY, 0);<a name="line.73"></a>
+<span class="sourceLineNo">074</span>    TEST_UTIL.startMiniCluster(2);<a name="line.74"></a>
+<span class="sourceLineNo">075</span>    ASYNC_CONN = ConnectionFactory.createAsyncConnection(TEST_UTIL.getConfiguration()).get();<a name="line.75"></a>
+<span class="sourceLineNo">076</span>  }<a name="line.76"></a>
+<span class="sourceLineNo">077</span><a name="line.77"></a>
+<span class="sourceLineNo">078</span>  @Test<a name="line.78"></a>
+<span class="sourceLineNo">079</span>  public void testGetMasterInfoPort() throws Exception {<a name="line.79"></a>
+<span class="sourceLineNo">080</span>    assertEquals(TEST_UTIL.getHBaseCluster().getMaster().getInfoServer().getPort(), (int) admin<a name="line.80"></a>
+<span class="sourceLineNo">081</span>        .getMasterInfoPort().get());<a name="line.81"></a>
+<span class="sourceLineNo">082</span>  }<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>  @Test<a name="line.84"></a>
+<span class="sourceLineNo">085</span>  public void testRegionServerOnlineConfigChange() throws Exception {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>    replaceHBaseSiteXML();<a name="line.86"></a>
+<span class="sourceLineNo">087</span>    admin.getRegionServers().get().forEach(server -&gt; admin.updateConfiguration(server).join());<a name="line.87"></a>
+<span class="sourceLineNo">088</span><a name="line.88"></a>
+<span class="sourceLineNo">089</span>    // Check the configuration of the RegionServers<a name="line.89"></a>
+<span class="sourceLineNo">090</span>    TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -&gt; {<a name="line.90"></a>
+<span class="sourceLineNo">091</span>      Configuration conf = thread.getRegionServer().getConfiguration();<a name="line.91"></a>
+<span class="sourceLineNo">092</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.92"></a>
+<span class="sourceLineNo">093</span>    });<a name="line.93"></a>
+<span class="sourceLineNo">094</span><a name="line.94"></a>
+<span class="sourceLineNo">095</span>    restoreHBaseSiteXML();<a name="line.95"></a>
+<span class="sourceLineNo">096</span>  }<a name="line.96"></a>
+<span class="sourceLineNo">097</span><a name="line.97"></a>
+<span class="sourceLineNo">098</span>  @Test<a name="line.98"></a>
+<span class="sourceLineNo">099</span>  public void testMasterOnlineConfigChange() throws Exception {<a name="line.99"></a>
+<span class="sourceLineNo">100</span>    replaceHBaseSiteXML();<a name="line.100"></a>
+<span class="sourceLineNo">101</span>    ServerName master = admin.getMaster().get();<a name="line.101"></a>
+<span class="sourceLineNo">102</span>    admin.updateConfiguration(master).join();<a name="line.102"></a>
+<span class="sourceLineNo">103</span>    admin.getBackupMasters().get()<a name="line.103"></a>
+<span class="sourceLineNo">104</span>        .forEach(backupMaster -&gt; admin.updateConfiguration(backupMaster).join());<a name="line.104"></a>
+<span class="sourceLineNo">105</span><a name="line.105"></a>
+<span class="sourceLineNo">106</span>    // Check the configuration of the Masters<a name="line.106"></a>
+<span class="sourceLineNo">107</span>    TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -&gt; {<a name="line.107"></a>
+<span class="sourceLineNo">108</span>      Configuration conf = thread.getMaster().getConfiguration();<a name="line.108"></a>
+<span class="sourceLineNo">109</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.109"></a>
+<span class="sourceLineNo">110</span>    });<a name="line.110"></a>
+<span class="sourceLineNo">111</span><a name="line.111"></a>
+<span class="sourceLineNo">112</span>    restoreHBaseSiteXML();<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  }<a name="line.113"></a>
+<span class="sourceLineNo">114</span><a name="line.114"></a>
+<span class="sourceLineNo">115</span>  @Test<a name="line.115"></a>
+<span class="sourceLineNo">116</span>  public void testAllClusterOnlineConfigChange() throws IOException {<a name="line.116"></a>
+<span class="sourceLineNo">117</span>    replaceHBaseSiteXML();<a name="line.117"></a>
+<span class="sourceLineNo">118</span>    admin.updateConfiguration().join();<a name="line.118"></a>
+<span class="sourceLineNo">119</span><a name="line.119"></a>
+<span class="sourceLineNo">120</span>    // Check the configuration of the Masters<a name="line.120"></a>
+<span class="sourceLineNo">121</span>    TEST_UTIL.getMiniHBaseCluster().getMasterThreads().forEach(thread -&gt; {<a name="line.121"></a>
+<span class="sourceLineNo">122</span>      Configuration conf = thread.getMaster().getConfiguration();<a name="line.122"></a>
+<span class="sourceLineNo">123</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    });<a name="line.124"></a>
+<span class="sourceLineNo">125</span><a name="line.125"></a>
+<span class="sourceLineNo">126</span>    // Check the configuration of the RegionServers<a name="line.126"></a>
+<span class="sourceLineNo">127</span>    TEST_UTIL.getMiniHBaseCluster().getRegionServerThreads().forEach(thread -&gt; {<a name="line.127"></a>
+<span class="sourceLineNo">128</span>      Configuration conf = thread.getRegionServer().getConfiguration();<a name="line.128"></a>
+<span class="sourceLineNo">129</span>      assertEquals(1000, conf.getInt("hbase.custom.config", 0));<a name="line.129"></a>
+<span class="sourceLineNo">130</span>    });<a name="line.130"></a>
+<span class="sourceLineNo">131</span><a name="line.131"></a>
+<span class="sourceLineNo">132</span>    restoreHBaseSiteXML();<a name="line.132"></a>
+<span class="sourceLineNo">133</span>  }<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span>  private void replaceHBaseSiteXML() throws IOException {<a name="line.135"></a>
+<span class="sourceLineNo">136</span>    // make a backup of hbase-site.xml<a name="line.136"></a>
+<span class="sourceLineNo">137</span>    Files.copy(cnfPath, cnf3Path, StandardCopyOption.REPLACE_EXISTING);<a name="line.137"></a>
+<span class="sourceLineNo">138</span>    // update hbase-site.xml by overwriting it<a name="line.138"></a>
+<span class="sourceLineNo">139</span>    Files.copy(cnf2Path, cnfPath, StandardCopyOption.REPLACE_EXISTING);<a name="line.139"></a>
+<span class="sourceLineNo">140</span>  }<a name="line.140"></a>
+<span class="sourceLineNo">141</span><a name="line.141"></a>
+<span class="sourceLineNo">142</span>  private void restoreHBaseSiteXML() throws IOException {<a name="line.142"></a>
+<span class="sourceLineNo">143</span>    // restore hbase-site.xml<a name="line.143"></a>
+<span class="sourceLineNo">144</span>    Files.copy(cnf3Path, cnfPath, StandardCopyOption.REPLACE_EXISTING);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>  }<a name="line.145"></a>
+<span class="sourceLineNo">146</span><a name="line.146"></a>
+<span class="sourceLineNo">147</span>  @Test<a name="line.147"></a>
+<span class="sourceLineNo">148</span>  public void testRollWALWALWriter() throws Exception {<a name="line.148"></a>
+<span class="sourceLineNo">149</span>    setUpforLogRolling();<a name="line.149"></a>
+<span class="sourceLineNo">150</span>    String className = this.getClass().getName();<a name="line.150"></a>
+<span class="sourceLineNo">151</span>    StringBuilder v = new StringBuilder(className);<a name="line.151"></a>
+<span class="sourceLineNo">152</span>    while (v.length() &lt; 1000) {<a name="line.152"></a>
+<span class="sourceLineNo">153</span>      v.append(className);<a name="line.153"></a>
+<span class="sourceLineNo">154</span>    }<a name="line.154"></a>
+<span class="sourceLineNo">155</span>    byte[] value = Bytes.toBytes(v.toString());<a name="line.155"></a>
+<span class="sourceLineNo">156</span>    HRegionServer regionServer = startAndWriteData(tableName, value);<a name="line.156"></a>
+<span class="sourceLineNo">157</span>    LOG.info("after writing there are "<a name="line.157"></a>
+<span class="sourceLineNo">158</span>        + AbstractFSWALProvider.getNumRolledLogFiles(regionServer.getWAL(null)) + " log files");<a name="line.158"></a>
+<span class="sourceLineNo">159</span><a name="line.159"></a>
+<span class="sourceLineNo">160</span>    // flush all regions<a name="line.160"></a>
+<span class="sourceLineNo">161</span>    for (HRegion r : regionServer.getOnlineRegionsLocalContext()) {<a name="line.161"></a>
+<span class="sourceLineNo">162</span>      r.flush(true);<a name="line.162"></a>
+<span class="sourceLineNo">163</span>    }<a name="line.163"></a>
+<span class="sourceLineNo">164</span>    admin.rollWALWriter(regionServer.getServerName()).join();<a name="line.164"></a>
+<span class="sourceLineNo">165</span>    int count = AbstractFSWALProvider.getNumRolledLogFiles(regionServer.getWAL(null));<a name="line.165"></a>
+<span class="sourceLineNo">166</span>    LOG.info("after flushing all regions and rolling logs there are " +<a name="line.166"></a>
+<span class="sourceLineNo">167</span>        count + " log files");<a name="line.167"></a>
+<span class="sourceLineNo">168</span>    assertTrue(("actual count: " + count), count &lt;= 2);<a name="line.168"></a>
+<span class="sourceLineNo">169</span>  }<a name="line.169"></a>
+<span class="sourceLineNo">170</span><a name="line.170"></a>
+<span class="sourceLineNo">171</span>  private void setUpforLogRolling() {<a name="line.171"></a>
+<span class="sourceLineNo">172</span>    // Force a region split after every 768KB<a name="line.172"></a>
+<span class="sourceLineNo">173</span>    TEST_UTIL.getConfiguration().setLong(HConstants.HREGION_MAX_FILESIZE,<a name="line.173"></a>
+<span class="sourceLineNo">174</span>        768L * 1024L);<a name="line.174"></a>
+<span class="sourceLineNo">175</span><a name="line.175"></a>
+<span class="sourceLineNo">176</span>    // We roll the log after every 32 writes<a name="line.176"></a>
+<span class="sourceLineNo">177</span>    TEST_UTIL.getConfiguration().setInt("hbase.regionserver.maxlogentries", 32);<a name="line.177"></a>
+<span class="sourceLineNo">178</span><a name="line.178"></a>
+<span class="sourceLineNo">179</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.179"></a>
+<span class="sourceLineNo">180</span>        "hbase.regionserver.logroll.errors.tolerated", 2);<a name="line.180"></a>
+<span class="sourceLineNo">181</span>    TEST_UTIL.getConfiguration().setInt("hbase.rpc.timeout", 10 * 1000);<a name="line.181"></a>
+<span class="sourceLineNo">182</span><a name="line.182"></a>
+<span class="sourceLineNo">183</span>    // For less frequently updated regions flush after every 2 flushes<a name="line.183"></a>
+<span class="sourceLineNo">184</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.184"></a>
+<span class="sourceLineNo">185</span>        "hbase.hregion.memstore.optionalflushcount", 2);<a name="line.185"></a>
+<span class="sourceLineNo">186</span><a name="line.186"></a>
+<span class="sourceLineNo">187</span>    // We flush the cache after every 8192 bytes<a name="line.187"></a>
+<span class="sourceLineNo">188</span>    TEST_UTIL.getConfiguration().setInt(HConstants.HREGION_MEMSTORE_FLUSH_SIZE,<a name="line.188"></a>
+<span class="sourceLineNo">189</span>        8192);<a name="line.189"></a>
+<span class="sourceLineNo">190</span><a name="line.190"></a>
+<span class="sourceLineNo">191</span>    // Increase the amount of time between client retries<a name="line.191"></a>
+<span class="sourceLineNo">192</span>    TEST_UTIL.getConfiguration().setLong("hbase.client.pause", 10 * 1000);<a name="line.192"></a>
+<span class="sourceLineNo">193</span><a name="line.193"></a>
+<span class="sourceLineNo">194</span>    // Reduce thread wake frequency so that other threads can get<a name="line.194"></a>
+<span class="sourceLineNo">195</span>    // a chance to run.<a name="line.195"></a>
+<span class="sourceLineNo">196</span>    TEST_UTIL.getConfiguration().setInt(HConstants.THREAD_WAKE_FREQUENCY,<a name="line.196"></a>
+<span class="sourceLineNo">197</span>        2 * 1000);<a name="line.197"></a>
+<span class="sourceLineNo">198</span><a name="line.198"></a>
+<span class="sourceLineNo">199</span>    /**** configuration for testLogRollOnDatanodeDeath ****/<a name="line.199"></a>
+<span class="sourceLineNo">200</span>    // lower the namenode &amp; datanode heartbeat so the namenode<a name="line.200"></a>
+<span class="sourceLineNo">201</span>    // quickly detects datanode failures<a name="line.201"></a>
+<span class="sourceLineNo">202</span>    TEST_UTIL.getConfiguration().setInt("dfs.namenode.heartbeat.recheck-interval", 5000);<a name="line.202"></a>
+<span class="sourceLineNo">203</span>    TEST_UTIL.getConfiguration().setInt("dfs.heartbeat.interval", 1);<a name="line.203"></a>
+<span class="sourceLineNo">204</span>    // the namenode might still try to choose the recently-dead datanode<a name="line.204"></a>
+<span class="sourceLineNo">205</span>    // for a pipeline, so try to a new pipeline multiple times<a name="line.205"></a>
+<span class="sourceLineNo">206</span>    TEST_UTIL.getConfiguration().setInt("dfs.client.block.write.retries", 30);<a name="line.206"></a>
+<span class="sourceLineNo">207</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.207"></a>
+<span class="sourceLineNo">208</span>        "hbase.regionserver.hlog.tolerable.lowreplication", 2);<a name="line.208"></a>
+<span class="sourceLineNo">209</span>    TEST_UTIL.getConfiguration().setInt(<a name="line.209"></a>
+<span class="sourceLineNo">210</span>        "hbase.regionserver.hlog.lowreplication.rolllimit", 3);<a name="line.210"></a>
+<span class="sourceLineNo">211</span>  }<a name="line.211"></a>
+<span class="sourceLineNo">212</span><a name="line.212"></a>
+<span class="sourceLineNo">213</span>  private HRegionServer startAndWriteData(TableName tableName, byte[] value) throws Exception {<a name="line.213"></a>
+<span class="sourceLineNo">214</span>    createTableWithDefaultConf(tableName);<a name="line.214"></a>
+<span class="sourceLineNo">215</span>    RawAsyncTable table = ASYNC_CONN.getRawTable(tableName);<a name="line.215"></a>
+<span class="sourceLineNo">216</span>    HRegionServer regionServer = TEST_UTIL.getRSForFirstRegionInTable(tableName);<a name="line.216"></a>
+<span class="sourceLineNo">217</span>    for (int i = 1; i &lt;= 256; i++) { // 256 writes should cause 8 log rolls<a name="line.217"></a>
+<span class="sourceLineNo">218</span>      Put put = new Put(Bytes.toBytes("row" + String.format("%1$04d", i)));<a name="line.218"></a>
+<span class="sourceLineNo">219</span>      put.addColumn(FAMILY, null, value);<a name="line.219"></a>
+<span class="sourceLineNo">220</span>      table.put(put).join();<a name="line.220"></a>
+<span class="sourceLineNo">221</span>      if (i % 32 == 0) {<a name="line.221"></a>
+<span class="sourceLineNo">222</span>        // After every 32 writes sleep to let the log roller run<a name="line.222"></a>
+<span class="sourceLineNo">223</span>        try {<a name="line.223"></a>
+<span class="sourceLineNo">224</span>          Thread.sleep(2000);<a name="line.224"></a>
+<span class="sourceLineNo">225</span>        } catch (InterruptedException e) {<a name="line.225"></a>
+<span class="sourceLineNo">226</span>          // continue<a name="line.226"></a>
+<span class="sourceLineNo">227</span>        }<a name="line.227"></a>
+<span class="sourceLineNo">228</span>      }<a name="line.228"></a>
+<span class="sourceLineNo">229</span>    }<a name="line.229"></a>
+<span class="sourceLineNo">230</span>    return regionServer;<a name="line.230"></a>
+<span class="sourceLineNo">231</span>  }<a name="line.231"></a>
+<span class="sourceLineNo">232</span><a name="line.232"></a>
+<span class="sourceLineNo">233</span>  @Test<a name="line.233"></a>
+<span class="sourceLineNo">234</span>  public void testGetRegionLoads() throws Exception {<a name="line.234"></a>
+<span class="sourceLineNo">235</span>    // Turn off the balancer<a name="line.235"></a>
+<span class="sourceLineNo">236</span>    admin.setBalancerOn(false).join();<a name="line.236"></a>
+<span class="sourceLineNo">237</span>    TableName[] tables =<a name="line.237"></a>
+<span class="sourceLineNo">238</span>        new TableName[] { TableName.valueOf(tableName.getNameAsString() + "1"),<a name="line.238"></a>
+<span class="sourceLineNo">239</span>            TableName.valueOf(tableName.getNameAsString() + "2"),<a name="line.239"></a>
+<span class="sourceLineNo">240</span>            TableName.valueOf(tableName.getNameAsString() + "3") };<a name="line.240"></a>
+<span class="sourceLineNo">241</span>    createAndLoadTable(tables);<a name="line.241"></a>
+<span class="sourceLineNo">242</span>    // Sleep to wait region server report<a name="line.242"></a>
+<span class="sourceLineNo">243</span>    Thread.sleep(TEST_UTIL.getConfiguration().getInt("hbase.regionserver.msginterval", 3 * 1000) * 2);<a name="line.243"></a>
+<span class="sourceLineNo">244</span>    // Check if regions match with the regionLoad from the server<a name="line.244"></a>
+<span class="sourceLineNo">245</span>    Collection&lt;ServerName&gt; servers = admin.getRegionServers().get();<a name="line.245"></a>
+<span class="sourceLineNo">246</span>    for (ServerName serverName : servers) {<a name="line.246"></a>
+<span class="sourceLineNo">247</span>      List&lt;RegionInfo&gt; regions = admin.getOnlineRegions(serverName).get();<a name="line.247"></a>
+<span class="sourceLineNo">248</span>      checkRegionsAndRegionLoads(regions, admin.getRegionLoads(serverName).get());<a name="line.248"></a>
+<span class="sourceLineNo">249</span>    }<a name="line.249"></a>
+<span class="sourceLineNo">250</span><a name="line.250"></a>
+<span class="sourceLineNo">251</span>    // Check if regionLoad matches the table's regions and nothing is missed<a name="line.251"></a>
+<span class="sourceLineNo">252</span>    for (TableName table : tables) {<a name="line.252"></a>
+<span class="sourceLineNo">253</span>      List&lt;RegionInfo&gt; tableRegions = admin.getTableRegions(table).get();<a name="line.253"></a>
+<span class="sourceLineNo">254</span>      List&lt;RegionLoad&gt; regionLoads = Lists.newArrayList();<a name="line.254"></a>
+<span class="sourceLineNo">255</span>      for (ServerName serverName : servers) {<a name="line.255"></a>
+<span class="sourceLineNo">256</span>        regionLoads.addAll(admin.getRegionLoads(serverName, table).get());<a name="line.256"></a>
+<span class="sourceLineNo">257</span>      }<a name="line.257"></a>
+<span class="sourceLineNo">258</span>      checkRegionsAndRegionLoads(tableRegions, regionLoads);<a name="line.258"></a>
+<span class="sourceLineNo">259</span>    }<a name="line.259"></a>
+<span class="sourceLineNo">260</span><a name="line.260"></a>
+<span class="sourceLineNo">261</span>    // Check RegionLoad matches the regionLoad from ClusterStatus<a name="line.261"></a>
+<span class="sourceLineNo">262</span>    ClusterStatus clusterStatus = admin.getClusterStatus(EnumSet.of(Option.LIVE_SERVERS)).get();<a name="line.262"></a>
+<span class="sourceLineNo">263</span>    for (ServerName serverName : clusterStatus.getServers()) {<a name="line.263"></a>
+<span class="sourceLineNo">264</span>      ServerLoad serverLoad = clusterStatus.getLoad(serverName);<a name="line.264"></a>
+<span class="sourceLineNo">265</span>      compareRegionLoads(serverLoad.getRegionsLoad().values(), admin.getRegionLoads(serverName)<a name="line.265"></a>
+<span class="sourceLineNo">266</span>          .get());<a name="line.266"></a>
+<span class="sourceLineNo">267</span>    }<a name="line.267"></a>
+<span class="sourceLineNo">268</span>  }<a name="line.268"></a>
+<span class="sourceLineNo">269</span><a name="line.269"></a>
+<span class="sourceLineNo">270</span>  private void compareRegionLoads(Collection&lt;RegionLoad&gt; regionLoadCluster,<a name="line.270"></a>
+<span class="sourceLineNo">271</span>      Collection&lt;RegionLoad&gt; regionLoads) {<a name="line.271"></a>
+<span class="sourceLineNo">272</span><a name="line.272"></a>
+<span class="sourceLineNo">273</span>    assertEquals("No of regionLoads from clusterStatus and regionloads from RS doesn't match",<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      regionLoadCluster.size(), regionLoads.size());<a name="line.274"></a>
+<span class="sourceLineNo">275</span><a name="line.275"></a>
+<span class="sourceLineNo">276</span>    for (RegionLoad loadCluster : regionLoadCluster) {<a name="line.276"></a>
+<span class="sourceLineNo">277</span>      boolean matched = false;<a name="line.277"></a>
+<span class="sourceLineNo">278</span>      for (RegionLoad load : regionLoads) {<a name="line.278"></a>
+<span class="sourceLineNo">279</span>        if (Bytes.equals(loadCluster.getName(), load.getName())) {<a name="line.279"></a>
+<span class="sourceLineNo">280</span>          matched = true;<a name="line.280"></a>
+<span class="sourceLineNo">281</span>          continue;<a name="line.281"></a>
+<span class="sourceLineNo">282</span>        }<a name="line.282"></a>
+<span class="sourceLineNo">283</span>      }<a name="line.283"></a>
+<span class="sourceLineNo">284</span>      assertTrue("The contents of region load from cluster and server should match", matched);<a name="line.284"></a>
+<span class="sourceLineNo">285</span>    }<a name="line.285"></a>
+<span class="sourceLineNo">286</span>  }<a name="line.286"></a>
+<span class="sourceLineNo">287</span><a name="line.287"></a>
+<span class="sourceLineNo">288</span>  private void checkRegionsAndRegionLoads(Collection&lt;RegionInfo&gt; regions,<a name="line.288"></a>
+<span class="sourceLineNo">289</span>      Collection&lt;RegionLoad&gt; regionLoads) {<a name="line.289"></a>
+<span class="sourceLineNo">290</span><a name="line.290"></a>
+<span class="sourceLineNo">291</span>    assertEquals("No of regions and regionloads doesn't match", regions.size(), regionLoads.size());<a name="line.291"></a>
+<span class="sourceLineNo">292</span><a name="line.292"></a>
+<span class="sourceLineNo">293</span>    Map&lt;byte[], RegionLoad&gt; regionLoadMap = Maps.newTreeMap(Bytes.BYTES_COMPARATOR);<a name="line.293"></a>
+<span class="sourceLineNo">294</span>    for (RegionLoad regionLoad : regionLoads) {<a name="line.294"></a>
+<span class="sourceLineNo">295</span>      regionLoadMap.put(regionLoad.getName(), regionLoad);<a name="line.295"></a>
+<span class="sourceLineNo">296</span>    }<a name="line.296"></a>
+<span class="sourceLineNo">297</span>    for (RegionInfo info : regions) {<a name="line.297"></a>
+<span class="sourceLineNo">298</span>      assertTrue("Region not in regionLoadMap region:" + info.getRegionNameAsString()<a name="line.298"></a>
+<span class="sourceLineNo">299</span>          + " regionMap: " + regionLoadMap, regionLoadMap.containsKey(info.getRegionName()));<a name="line.299"></a>
+<span class="sourceLineNo">300</span>    }<a name="line.300"></a>
+<span class="sourceLineNo">301</span>  }<a name="line.301"></a>
+<span class="sourceLineNo">302</span><a name="line.302"></a>
+<span class="sourceLineNo">303</span>  private void createAndLoadTable(TableName[] tables) {<a name="line.303"></a>
+<span class="sourceLineNo">304</span>    for (TableName table : tables) {<a name="line.304"></a>
+<span class="sourceLineNo">305</span>      TableDescriptorBuilder builder = TableDescriptorBuilder.newBuilder(table);<a name="line.305"></a>
+<span class="sourceLineNo">306</span>      builder.addColumnFamily(ColumnFamilyDescriptorBuilder.of(FAMILY));<a name="line.306"></a>
+<span class="sourceLineNo">307</span>      admin.createTable(builder.build(), Bytes.toBytes("aaaaa"), Bytes.toBytes("zzzzz"), 16).join();<a name="line.307"></a>
+<span class="sourceLineNo">308</span>      RawAsyncTable asyncTable = ASYNC_CONN.getRawTable(table);<a name="line.308"></a>
+<span class="sourceLineNo">309</span>      List&lt;Put&gt; puts = new ArrayList&lt;&gt;();<a name="line.309"></a>
+<span class="sourceLineNo">310</span>      for (byte[] row : HBaseTestingUtility.ROWS) {<a name="line.310"></a>
+<span class="sourceLineNo">311</span>        puts.add(new Put(row).addColumn(FAMILY, Bytes.toBytes("q"), Bytes.toBytes("v")));<a name="line.311"></a>
+<span class="sourceLineNo">312</span>      }<a name="line.312"></a>
+<span class="sourceLineNo">313</span>      asyncTable.putAll(puts).join();<a name="line.313"></a>
+<span class="sourceLineNo">314</span>    }<a name="line.314"></a>
+<span class="sourceLineNo">315</span>  }<a name="line.315"></a>
+<span class="sourceLineNo">316</span>}<a name="line.316"></a>
 
 
 


Mime
View raw message