http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a610f23a/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.ReplicationEndpointWithWALEntryFilter.html
----------------------------------------------------------------------
diff --git
a/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.ReplicationEndpointWithWALEntryFilter.html
b/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.ReplicationEndpointWithWALEntryFilter.html
index bee8222..7a938de 100644
---
a/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.ReplicationEndpointWithWALEntryFilter.html
+++
b/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationEndpoint.ReplicationEndpointWithWALEntryFilter.html
@@ -72,7 +72,7 @@
<span class="sourceLineNo">064</span>/**<a name="line.64"></a>
<span class="sourceLineNo">065</span> * Tests ReplicationSource and
ReplicationEndpoint interactions<a name="line.65"></a>
<span class="sourceLineNo">066</span> */<a name="line.66"></a>
-<span class="sourceLineNo">067</span>@Category({ReplicationTests.class,
MediumTests.class})<a name="line.67"></a>
+<span class="sourceLineNo">067</span>@Category({ ReplicationTests.class,
MediumTests.class })<a name="line.67"></a>
<span class="sourceLineNo">068</span>public class TestReplicationEndpoint
extends TestReplicationBase {<a name="line.68"></a>
<span class="sourceLineNo">069</span><a name="line.69"></a>
<span class="sourceLineNo">070</span> @ClassRule<a name="line.70"></a>
@@ -86,317 +86,317 @@
<span class="sourceLineNo">078</span> @BeforeClass<a name="line.78"></a>
<span class="sourceLineNo">079</span> public static void setUpBeforeClass()
throws Exception {<a name="line.79"></a>
<span class="sourceLineNo">080</span>
TestReplicationBase.setUpBeforeClass();<a name="line.80"></a>
-<span class="sourceLineNo">081</span> admin.removePeer("2");<a
name="line.81"></a>
-<span class="sourceLineNo">082</span> numRegionServers =
utility1.getHBaseCluster().getRegionServerThreads().size();<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> @AfterClass<a name="line.85"></a>
-<span class="sourceLineNo">086</span> public static void tearDownAfterClass()
throws Exception {<a name="line.86"></a>
-<span class="sourceLineNo">087</span>
TestReplicationBase.tearDownAfterClass();<a name="line.87"></a>
-<span class="sourceLineNo">088</span> // check stop is called<a
name="line.88"></a>
-<span class="sourceLineNo">089</span>
Assert.assertTrue(ReplicationEndpointForTest.stoppedCount.get() > 0);<a
name="line.89"></a>
-<span class="sourceLineNo">090</span> }<a name="line.90"></a>
-<span class="sourceLineNo">091</span><a name="line.91"></a>
-<span class="sourceLineNo">092</span> @Before<a name="line.92"></a>
-<span class="sourceLineNo">093</span> public void setup() throws Exception
{<a name="line.93"></a>
-<span class="sourceLineNo">094</span>
ReplicationEndpointForTest.contructedCount.set(0);<a name="line.94"></a>
-<span class="sourceLineNo">095</span>
ReplicationEndpointForTest.startedCount.set(0);<a name="line.95"></a>
-<span class="sourceLineNo">096</span>
ReplicationEndpointForTest.replicateCount.set(0);<a name="line.96"></a>
-<span class="sourceLineNo">097</span>
ReplicationEndpointReturningFalse.replicated.set(false);<a name="line.97"></a>
-<span class="sourceLineNo">098</span>
ReplicationEndpointForTest.lastEntries = null;<a name="line.98"></a>
-<span class="sourceLineNo">099</span> final List<RegionServerThread>
rsThreads =<a name="line.99"></a>
-<span class="sourceLineNo">100</span>
utility1.getMiniHBaseCluster().getRegionServerThreads();<a name="line.100"></a>
-<span class="sourceLineNo">101</span> for (RegionServerThread rs :
rsThreads) {<a name="line.101"></a>
-<span class="sourceLineNo">102</span>
utility1.getAdmin().rollWALWriter(rs.getRegionServer().getServerName());<a
name="line.102"></a>
-<span class="sourceLineNo">103</span> }<a name="line.103"></a>
-<span class="sourceLineNo">104</span> // Wait for all log roll to finish<a
name="line.104"></a>
-<span class="sourceLineNo">105</span> utility1.waitFor(3000, new
Waiter.ExplainingPredicate<Exception>() {<a name="line.105"></a>
-<span class="sourceLineNo">106</span> @Override<a name="line.106"></a>
-<span class="sourceLineNo">107</span> public boolean evaluate() throws
Exception {<a name="line.107"></a>
-<span class="sourceLineNo">108</span> for (RegionServerThread rs :
rsThreads) {<a name="line.108"></a>
-<span class="sourceLineNo">109</span> if
(!rs.getRegionServer().walRollRequestFinished()) {<a name="line.109"></a>
-<span class="sourceLineNo">110</span> return false;<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> return true;<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> @Override<a name="line.116"></a>
-<span class="sourceLineNo">117</span> public String explainFailure()
throws Exception {<a name="line.117"></a>
-<span class="sourceLineNo">118</span> List<String>
logRollInProgressRsList = new ArrayList<>();<a name="line.118"></a>
-<span class="sourceLineNo">119</span> for (RegionServerThread rs :
rsThreads) {<a name="line.119"></a>
-<span class="sourceLineNo">120</span> if
(!rs.getRegionServer().walRollRequestFinished()) {<a name="line.120"></a>
-<span class="sourceLineNo">121</span>
logRollInProgressRsList.add(rs.getRegionServer().toString());<a
name="line.121"></a>
-<span class="sourceLineNo">122</span> }<a name="line.122"></a>
-<span class="sourceLineNo">123</span> }<a name="line.123"></a>
-<span class="sourceLineNo">124</span> return "Still waiting for log
roll on regionservers: " + logRollInProgressRsList;<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> }<a name="line.127"></a>
-<span class="sourceLineNo">128</span><a name="line.128"></a>
-<span class="sourceLineNo">129</span> @Test<a name="line.129"></a>
-<span class="sourceLineNo">130</span> public void
testCustomReplicationEndpoint() throws Exception {<a name="line.130"></a>
-<span class="sourceLineNo">131</span> // test installing a custom
replication endpoint other than the default one.<a name="line.131"></a>
-<span class="sourceLineNo">132</span>
admin.addPeer("testCustomReplicationEndpoint",<a name="line.132"></a>
-<span class="sourceLineNo">133</span> new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.133"></a>
-<span class="sourceLineNo">134</span>
.setReplicationEndpointImpl(ReplicationEndpointForTest.class.getName()),
null);<a name="line.134"></a>
-<span class="sourceLineNo">135</span><a name="line.135"></a>
-<span class="sourceLineNo">136</span> // check whether the class has been
constructed and started<a name="line.136"></a>
-<span class="sourceLineNo">137</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.137"></a>
-<span class="sourceLineNo">138</span> @Override<a name="line.138"></a>
-<span class="sourceLineNo">139</span> public boolean evaluate() throws
Exception {<a name="line.139"></a>
-<span class="sourceLineNo">140</span> return
ReplicationEndpointForTest.contructedCount.get() >= numRegionServers;<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><a name="line.143"></a>
-<span class="sourceLineNo">144</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.144"></a>
-<span class="sourceLineNo">145</span> @Override<a name="line.145"></a>
-<span class="sourceLineNo">146</span> public boolean evaluate() throws
Exception {<a name="line.146"></a>
-<span class="sourceLineNo">147</span> return
ReplicationEndpointForTest.startedCount.get() >= numRegionServers;<a
name="line.147"></a>
-<span class="sourceLineNo">148</span> }<a name="line.148"></a>
-<span class="sourceLineNo">149</span> });<a name="line.149"></a>
-<span class="sourceLineNo">150</span><a name="line.150"></a>
-<span class="sourceLineNo">151</span> Assert.assertEquals(0,
ReplicationEndpointForTest.replicateCount.get());<a name="line.151"></a>
-<span class="sourceLineNo">152</span><a name="line.152"></a>
-<span class="sourceLineNo">153</span> // now replicate some data.<a
name="line.153"></a>
-<span class="sourceLineNo">154</span> doPut(Bytes.toBytes("row42"));<a
name="line.154"></a>
-<span class="sourceLineNo">155</span><a name="line.155"></a>
-<span class="sourceLineNo">156</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.156"></a>
-<span class="sourceLineNo">157</span> @Override<a name="line.157"></a>
-<span class="sourceLineNo">158</span> public boolean evaluate() throws
Exception {<a name="line.158"></a>
-<span class="sourceLineNo">159</span> return
ReplicationEndpointForTest.replicateCount.get() >= 1;<a name="line.159"></a>
-<span class="sourceLineNo">160</span> }<a name="line.160"></a>
-<span class="sourceLineNo">161</span> });<a name="line.161"></a>
-<span class="sourceLineNo">162</span><a name="line.162"></a>
-<span class="sourceLineNo">163</span> doAssert(Bytes.toBytes("row42"));<a
name="line.163"></a>
-<span class="sourceLineNo">164</span><a name="line.164"></a>
-<span class="sourceLineNo">165</span>
admin.removePeer("testCustomReplicationEndpoint");<a name="line.165"></a>
-<span class="sourceLineNo">166</span> }<a name="line.166"></a>
-<span class="sourceLineNo">167</span><a name="line.167"></a>
-<span class="sourceLineNo">168</span> @Test<a name="line.168"></a>
-<span class="sourceLineNo">169</span> public void
testReplicationEndpointReturnsFalseOnReplicate() throws Exception {<a
name="line.169"></a>
-<span class="sourceLineNo">170</span> Assert.assertEquals(0,
ReplicationEndpointForTest.replicateCount.get());<a name="line.170"></a>
-<span class="sourceLineNo">171</span>
Assert.assertTrue(!ReplicationEndpointReturningFalse.replicated.get());<a
name="line.171"></a>
-<span class="sourceLineNo">172</span> int peerCount =
admin.getPeersCount();<a name="line.172"></a>
-<span class="sourceLineNo">173</span> final String id =
"testReplicationEndpointReturnsFalseOnReplicate";<a name="line.173"></a>
-<span class="sourceLineNo">174</span> admin.addPeer(id,<a
name="line.174"></a>
-<span class="sourceLineNo">175</span> new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.175"></a>
-<span class="sourceLineNo">176</span>
.setReplicationEndpointImpl(ReplicationEndpointReturningFalse.class.getName()),
null);<a name="line.176"></a>
-<span class="sourceLineNo">177</span> // This test is flakey and then there
is so much stuff flying around in here its, hard to<a name="line.177"></a>
-<span class="sourceLineNo">178</span> // debug. Peer needs to be up for
the edit to make it across. This wait on<a name="line.178"></a>
-<span class="sourceLineNo">179</span> // peer count seems to be a hack that
has us not progress till peer is up.<a name="line.179"></a>
-<span class="sourceLineNo">180</span> if (admin.getPeersCount() <=
peerCount) {<a name="line.180"></a>
-<span class="sourceLineNo">181</span> LOG.info("Waiting on peercount to
go up from " + peerCount);<a name="line.181"></a>
-<span class="sourceLineNo">182</span> Threads.sleep(100);<a
name="line.182"></a>
-<span class="sourceLineNo">183</span> }<a name="line.183"></a>
-<span class="sourceLineNo">184</span> // now replicate some data<a
name="line.184"></a>
-<span class="sourceLineNo">185</span> doPut(row);<a name="line.185"></a>
-<span class="sourceLineNo">186</span><a name="line.186"></a>
-<span class="sourceLineNo">187</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.187"></a>
-<span class="sourceLineNo">188</span> @Override<a name="line.188"></a>
-<span class="sourceLineNo">189</span> public boolean evaluate() throws
Exception {<a name="line.189"></a>
-<span class="sourceLineNo">190</span> // Looks like replication
endpoint returns false unless we put more than 10 edits. We<a
name="line.190"></a>
-<span class="sourceLineNo">191</span> // only send over one edit.<a
name="line.191"></a>
-<span class="sourceLineNo">192</span> int count =
ReplicationEndpointForTest.replicateCount.get();<a name="line.192"></a>
-<span class="sourceLineNo">193</span> LOG.info("count=" + count);<a
name="line.193"></a>
-<span class="sourceLineNo">194</span> return
ReplicationEndpointReturningFalse.replicated.get();<a name="line.194"></a>
-<span class="sourceLineNo">195</span> }<a name="line.195"></a>
-<span class="sourceLineNo">196</span> });<a name="line.196"></a>
-<span class="sourceLineNo">197</span> if
(ReplicationEndpointReturningFalse.ex.get() != null) {<a name="line.197"></a>
-<span class="sourceLineNo">198</span> throw
ReplicationEndpointReturningFalse.ex.get();<a name="line.198"></a>
-<span class="sourceLineNo">199</span> }<a name="line.199"></a>
-<span class="sourceLineNo">200</span><a name="line.200"></a>
-<span class="sourceLineNo">201</span>
admin.removePeer("testReplicationEndpointReturnsFalseOnReplicate");<a
name="line.201"></a>
-<span class="sourceLineNo">202</span> }<a name="line.202"></a>
-<span class="sourceLineNo">203</span><a name="line.203"></a>
-<span class="sourceLineNo">204</span> @Test<a name="line.204"></a>
-<span class="sourceLineNo">205</span> public void
testInterClusterReplication() throws Exception {<a name="line.205"></a>
-<span class="sourceLineNo">206</span> final String id =
"testInterClusterReplication";<a name="line.206"></a>
-<span class="sourceLineNo">207</span><a name="line.207"></a>
-<span class="sourceLineNo">208</span> List<HRegion> regions =
utility1.getHBaseCluster().getRegions(tableName);<a name="line.208"></a>
-<span class="sourceLineNo">209</span> int totEdits = 0;<a
name="line.209"></a>
-<span class="sourceLineNo">210</span><a name="line.210"></a>
-<span class="sourceLineNo">211</span> // Make sure edits are spread across
regions because we do region based batching<a name="line.211"></a>
-<span class="sourceLineNo">212</span> // before shipping edits.<a
name="line.212"></a>
-<span class="sourceLineNo">213</span> for(HRegion region: regions) {<a
name="line.213"></a>
-<span class="sourceLineNo">214</span> RegionInfo hri =
region.getRegionInfo();<a name="line.214"></a>
-<span class="sourceLineNo">215</span> byte[] row = hri.getStartKey();<a
name="line.215"></a>
-<span class="sourceLineNo">216</span> for (int i = 0; i < 100; i++)
{<a name="line.216"></a>
-<span class="sourceLineNo">217</span> if (row.length > 0) {<a
name="line.217"></a>
-<span class="sourceLineNo">218</span> Put put = new Put(row);<a
name="line.218"></a>
-<span class="sourceLineNo">219</span> put.addColumn(famName, row,
row);<a name="line.219"></a>
-<span class="sourceLineNo">220</span> region.put(put);<a
name="line.220"></a>
-<span class="sourceLineNo">221</span> totEdits++;<a
name="line.221"></a>
-<span class="sourceLineNo">222</span> }<a name="line.222"></a>
-<span class="sourceLineNo">223</span> }<a name="line.223"></a>
-<span class="sourceLineNo">224</span> }<a name="line.224"></a>
-<span class="sourceLineNo">225</span><a name="line.225"></a>
-<span class="sourceLineNo">226</span> admin.addPeer(id,<a
name="line.226"></a>
-<span class="sourceLineNo">227</span> new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf2))<a
name="line.227"></a>
-<span class="sourceLineNo">228</span>
.setReplicationEndpointImpl(InterClusterReplicationEndpointForTest.class.getName()),<a
name="line.228"></a>
-<span class="sourceLineNo">229</span> null);<a name="line.229"></a>
-<span class="sourceLineNo">230</span><a name="line.230"></a>
-<span class="sourceLineNo">231</span> final int numEdits = totEdits;<a
name="line.231"></a>
-<span class="sourceLineNo">232</span> Waiter.waitFor(conf1, 30000, new
Waiter.ExplainingPredicate<Exception>() {<a name="line.232"></a>
-<span class="sourceLineNo">233</span> @Override<a name="line.233"></a>
-<span class="sourceLineNo">234</span> public boolean evaluate() throws
Exception {<a name="line.234"></a>
-<span class="sourceLineNo">235</span> return
InterClusterReplicationEndpointForTest.replicateCount.get() == numEdits;<a
name="line.235"></a>
-<span class="sourceLineNo">236</span> }<a name="line.236"></a>
-<span class="sourceLineNo">237</span><a name="line.237"></a>
-<span class="sourceLineNo">238</span> @Override<a name="line.238"></a>
-<span class="sourceLineNo">239</span> public String explainFailure()
throws Exception {<a name="line.239"></a>
-<span class="sourceLineNo">240</span> String failure = "Failed to
replicate all edits, expected = " + numEdits<a name="line.240"></a>
-<span class="sourceLineNo">241</span> + " replicated = " +
InterClusterReplicationEndpointForTest.replicateCount.get();<a
name="line.241"></a>
-<span class="sourceLineNo">242</span> return failure;<a
name="line.242"></a>
-<span class="sourceLineNo">243</span> }<a name="line.243"></a>
-<span class="sourceLineNo">244</span> });<a name="line.244"></a>
-<span class="sourceLineNo">245</span><a name="line.245"></a>
-<span class="sourceLineNo">246</span>
admin.removePeer("testInterClusterReplication");<a name="line.246"></a>
-<span class="sourceLineNo">247</span>
utility1.deleteTableData(tableName);<a name="line.247"></a>
-<span class="sourceLineNo">248</span> }<a name="line.248"></a>
-<span class="sourceLineNo">249</span><a name="line.249"></a>
-<span class="sourceLineNo">250</span> @Test<a name="line.250"></a>
-<span class="sourceLineNo">251</span> public void
testWALEntryFilterFromReplicationEndpoint() throws Exception {<a
name="line.251"></a>
-<span class="sourceLineNo">252</span> ReplicationPeerConfig rpc = new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.252"></a>
-<span class="sourceLineNo">253</span>
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());<a
name="line.253"></a>
-<span class="sourceLineNo">254</span> //test that we can create mutliple
WALFilters reflectively<a name="line.254"></a>
-<span class="sourceLineNo">255</span>
rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,<a
name="line.255"></a>
-<span class="sourceLineNo">256</span>
EverythingPassesWALEntryFilter.class.getName() +<a name="line.256"></a>
-<span class="sourceLineNo">257</span> "," +
EverythingPassesWALEntryFilterSubclass.class.getName());<a name="line.257"></a>
-<span class="sourceLineNo">258</span>
admin.addPeer("testWALEntryFilterFromReplicationEndpoint", rpc);<a
name="line.258"></a>
-<span class="sourceLineNo">259</span> // now replicate some data.<a
name="line.259"></a>
-<span class="sourceLineNo">260</span> try (Connection connection =
ConnectionFactory.createConnection(conf1)) {<a name="line.260"></a>
-<span class="sourceLineNo">261</span> doPut(connection,
Bytes.toBytes("row1"));<a name="line.261"></a>
-<span class="sourceLineNo">262</span> doPut(connection, row);<a
name="line.262"></a>
-<span class="sourceLineNo">263</span> doPut(connection,
Bytes.toBytes("row2"));<a name="line.263"></a>
-<span class="sourceLineNo">264</span> }<a name="line.264"></a>
-<span class="sourceLineNo">265</span><a name="line.265"></a>
-<span class="sourceLineNo">266</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.266"></a>
-<span class="sourceLineNo">267</span> @Override<a name="line.267"></a>
-<span class="sourceLineNo">268</span> public boolean evaluate() throws
Exception {<a name="line.268"></a>
-<span class="sourceLineNo">269</span> return
ReplicationEndpointForTest.replicateCount.get() >= 1;<a name="line.269"></a>
-<span class="sourceLineNo">270</span> }<a name="line.270"></a>
-<span class="sourceLineNo">271</span> });<a name="line.271"></a>
-<span class="sourceLineNo">272</span><a name="line.272"></a>
-<span class="sourceLineNo">273</span>
Assert.assertNull(ReplicationEndpointWithWALEntryFilter.ex.get());<a
name="line.273"></a>
-<span class="sourceLineNo">274</span> //make sure our reflectively created
filter is in the filter chain<a name="line.274"></a>
-<span class="sourceLineNo">275</span>
Assert.assertTrue(EverythingPassesWALEntryFilter.hasPassedAnEntry());<a
name="line.275"></a>
-<span class="sourceLineNo">276</span>
admin.removePeer("testWALEntryFilterFromReplicationEndpoint");<a
name="line.276"></a>
-<span class="sourceLineNo">277</span> }<a name="line.277"></a>
-<span class="sourceLineNo">278</span><a name="line.278"></a>
-<span class="sourceLineNo">279</span> @Test (expected=IOException.class)<a
name="line.279"></a>
-<span class="sourceLineNo">280</span> public void
testWALEntryFilterAddValidation() throws Exception {<a name="line.280"></a>
-<span class="sourceLineNo">281</span> ReplicationPeerConfig rpc = new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.281"></a>
-<span class="sourceLineNo">282</span>
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());<a
name="line.282"></a>
-<span class="sourceLineNo">283</span> //test that we can create mutliple
WALFilters reflectively<a name="line.283"></a>
-<span class="sourceLineNo">284</span>
rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,<a
name="line.284"></a>
-<span class="sourceLineNo">285</span> "IAmNotARealWalEntryFilter");<a
name="line.285"></a>
-<span class="sourceLineNo">286</span>
admin.addPeer("testWALEntryFilterAddValidation", rpc);<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> @Test (expected=IOException.class)<a
name="line.289"></a>
-<span class="sourceLineNo">290</span> public void
testWALEntryFilterUpdateValidation() throws Exception {<a name="line.290"></a>
-<span class="sourceLineNo">291</span> ReplicationPeerConfig rpc = new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.291"></a>
-<span class="sourceLineNo">292</span>
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());<a
name="line.292"></a>
-<span class="sourceLineNo">293</span> //test that we can create mutliple
WALFilters reflectively<a name="line.293"></a>
-<span class="sourceLineNo">294</span>
rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,<a
name="line.294"></a>
-<span class="sourceLineNo">295</span> "IAmNotARealWalEntryFilter");<a
name="line.295"></a>
-<span class="sourceLineNo">296</span>
admin.updatePeerConfig("testWALEntryFilterUpdateValidation", rpc);<a
name="line.296"></a>
-<span class="sourceLineNo">297</span> }<a name="line.297"></a>
+<span class="sourceLineNo">081</span> numRegionServers =
utility1.getHBaseCluster().getRegionServerThreads().size();<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> @AfterClass<a name="line.84"></a>
+<span class="sourceLineNo">085</span> public static void tearDownAfterClass()
throws Exception {<a name="line.85"></a>
+<span class="sourceLineNo">086</span>
TestReplicationBase.tearDownAfterClass();<a name="line.86"></a>
+<span class="sourceLineNo">087</span> // check stop is called<a
name="line.87"></a>
+<span class="sourceLineNo">088</span>
Assert.assertTrue(ReplicationEndpointForTest.stoppedCount.get() > 0);<a
name="line.88"></a>
+<span class="sourceLineNo">089</span> }<a name="line.89"></a>
+<span class="sourceLineNo">090</span><a name="line.90"></a>
+<span class="sourceLineNo">091</span> @Before<a name="line.91"></a>
+<span class="sourceLineNo">092</span> public void setup() throws Exception
{<a name="line.92"></a>
+<span class="sourceLineNo">093</span>
ReplicationEndpointForTest.contructedCount.set(0);<a name="line.93"></a>
+<span class="sourceLineNo">094</span>
ReplicationEndpointForTest.startedCount.set(0);<a name="line.94"></a>
+<span class="sourceLineNo">095</span>
ReplicationEndpointForTest.replicateCount.set(0);<a name="line.95"></a>
+<span class="sourceLineNo">096</span>
ReplicationEndpointReturningFalse.replicated.set(false);<a name="line.96"></a>
+<span class="sourceLineNo">097</span>
ReplicationEndpointForTest.lastEntries = null;<a name="line.97"></a>
+<span class="sourceLineNo">098</span> final List<RegionServerThread>
rsThreads =<a name="line.98"></a>
+<span class="sourceLineNo">099</span>
utility1.getMiniHBaseCluster().getRegionServerThreads();<a name="line.99"></a>
+<span class="sourceLineNo">100</span> for (RegionServerThread rs :
rsThreads) {<a name="line.100"></a>
+<span class="sourceLineNo">101</span>
utility1.getAdmin().rollWALWriter(rs.getRegionServer().getServerName());<a
name="line.101"></a>
+<span class="sourceLineNo">102</span> }<a name="line.102"></a>
+<span class="sourceLineNo">103</span> // Wait for all log roll to finish<a
name="line.103"></a>
+<span class="sourceLineNo">104</span> utility1.waitFor(3000, new
Waiter.ExplainingPredicate<Exception>() {<a name="line.104"></a>
+<span class="sourceLineNo">105</span> @Override<a name="line.105"></a>
+<span class="sourceLineNo">106</span> public boolean evaluate() throws
Exception {<a name="line.106"></a>
+<span class="sourceLineNo">107</span> for (RegionServerThread rs :
rsThreads) {<a name="line.107"></a>
+<span class="sourceLineNo">108</span> if
(!rs.getRegionServer().walRollRequestFinished()) {<a name="line.108"></a>
+<span class="sourceLineNo">109</span> return false;<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> return true;<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> @Override<a name="line.115"></a>
+<span class="sourceLineNo">116</span> public String explainFailure()
throws Exception {<a name="line.116"></a>
+<span class="sourceLineNo">117</span> List<String>
logRollInProgressRsList = new ArrayList<>();<a name="line.117"></a>
+<span class="sourceLineNo">118</span> for (RegionServerThread rs :
rsThreads) {<a name="line.118"></a>
+<span class="sourceLineNo">119</span> if
(!rs.getRegionServer().walRollRequestFinished()) {<a name="line.119"></a>
+<span class="sourceLineNo">120</span>
logRollInProgressRsList.add(rs.getRegionServer().toString());<a
name="line.120"></a>
+<span class="sourceLineNo">121</span> }<a name="line.121"></a>
+<span class="sourceLineNo">122</span> }<a name="line.122"></a>
+<span class="sourceLineNo">123</span> return "Still waiting for log
roll on regionservers: " + logRollInProgressRsList;<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> }<a name="line.126"></a>
+<span class="sourceLineNo">127</span><a name="line.127"></a>
+<span class="sourceLineNo">128</span> @Test<a name="line.128"></a>
+<span class="sourceLineNo">129</span> public void
testCustomReplicationEndpoint() throws Exception {<a name="line.129"></a>
+<span class="sourceLineNo">130</span> // test installing a custom
replication endpoint other than the default one.<a name="line.130"></a>
+<span class="sourceLineNo">131</span>
admin.addPeer("testCustomReplicationEndpoint",<a name="line.131"></a>
+<span class="sourceLineNo">132</span> new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.132"></a>
+<span class="sourceLineNo">133</span>
.setReplicationEndpointImpl(ReplicationEndpointForTest.class.getName()),
null);<a name="line.133"></a>
+<span class="sourceLineNo">134</span><a name="line.134"></a>
+<span class="sourceLineNo">135</span> // check whether the class has been
constructed and started<a name="line.135"></a>
+<span class="sourceLineNo">136</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.136"></a>
+<span class="sourceLineNo">137</span> @Override<a name="line.137"></a>
+<span class="sourceLineNo">138</span> public boolean evaluate() throws
Exception {<a name="line.138"></a>
+<span class="sourceLineNo">139</span> return
ReplicationEndpointForTest.contructedCount.get() >= numRegionServers;<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><a name="line.142"></a>
+<span class="sourceLineNo">143</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.143"></a>
+<span class="sourceLineNo">144</span> @Override<a name="line.144"></a>
+<span class="sourceLineNo">145</span> public boolean evaluate() throws
Exception {<a name="line.145"></a>
+<span class="sourceLineNo">146</span> return
ReplicationEndpointForTest.startedCount.get() >= numRegionServers;<a
name="line.146"></a>
+<span class="sourceLineNo">147</span> }<a name="line.147"></a>
+<span class="sourceLineNo">148</span> });<a name="line.148"></a>
+<span class="sourceLineNo">149</span><a name="line.149"></a>
+<span class="sourceLineNo">150</span> Assert.assertEquals(0,
ReplicationEndpointForTest.replicateCount.get());<a name="line.150"></a>
+<span class="sourceLineNo">151</span><a name="line.151"></a>
+<span class="sourceLineNo">152</span> // now replicate some data.<a
name="line.152"></a>
+<span class="sourceLineNo">153</span> doPut(Bytes.toBytes("row42"));<a
name="line.153"></a>
+<span class="sourceLineNo">154</span><a name="line.154"></a>
+<span class="sourceLineNo">155</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.155"></a>
+<span class="sourceLineNo">156</span> @Override<a name="line.156"></a>
+<span class="sourceLineNo">157</span> public boolean evaluate() throws
Exception {<a name="line.157"></a>
+<span class="sourceLineNo">158</span> return
ReplicationEndpointForTest.replicateCount.get() >= 1;<a name="line.158"></a>
+<span class="sourceLineNo">159</span> }<a name="line.159"></a>
+<span class="sourceLineNo">160</span> });<a name="line.160"></a>
+<span class="sourceLineNo">161</span><a name="line.161"></a>
+<span class="sourceLineNo">162</span> doAssert(Bytes.toBytes("row42"));<a
name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span>
admin.removePeer("testCustomReplicationEndpoint");<a name="line.164"></a>
+<span class="sourceLineNo">165</span> }<a name="line.165"></a>
+<span class="sourceLineNo">166</span><a name="line.166"></a>
+<span class="sourceLineNo">167</span> @Test<a name="line.167"></a>
+<span class="sourceLineNo">168</span> public void
testReplicationEndpointReturnsFalseOnReplicate() throws Exception {<a
name="line.168"></a>
+<span class="sourceLineNo">169</span> Assert.assertEquals(0,
ReplicationEndpointForTest.replicateCount.get());<a name="line.169"></a>
+<span class="sourceLineNo">170</span>
Assert.assertTrue(!ReplicationEndpointReturningFalse.replicated.get());<a
name="line.170"></a>
+<span class="sourceLineNo">171</span> int peerCount =
admin.getPeersCount();<a name="line.171"></a>
+<span class="sourceLineNo">172</span> final String id =
"testReplicationEndpointReturnsFalseOnReplicate";<a name="line.172"></a>
+<span class="sourceLineNo">173</span> admin.addPeer(id,<a
name="line.173"></a>
+<span class="sourceLineNo">174</span> new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.174"></a>
+<span class="sourceLineNo">175</span>
.setReplicationEndpointImpl(ReplicationEndpointReturningFalse.class.getName()),
null);<a name="line.175"></a>
+<span class="sourceLineNo">176</span> // This test is flakey and then there
is so much stuff flying around in here its, hard to<a name="line.176"></a>
+<span class="sourceLineNo">177</span> // debug. Peer needs to be up for
the edit to make it across. This wait on<a name="line.177"></a>
+<span class="sourceLineNo">178</span> // peer count seems to be a hack that
has us not progress till peer is up.<a name="line.178"></a>
+<span class="sourceLineNo">179</span> if (admin.getPeersCount() <=
peerCount) {<a name="line.179"></a>
+<span class="sourceLineNo">180</span> LOG.info("Waiting on peercount to
go up from " + peerCount);<a name="line.180"></a>
+<span class="sourceLineNo">181</span> Threads.sleep(100);<a
name="line.181"></a>
+<span class="sourceLineNo">182</span> }<a name="line.182"></a>
+<span class="sourceLineNo">183</span> // now replicate some data<a
name="line.183"></a>
+<span class="sourceLineNo">184</span> doPut(row);<a name="line.184"></a>
+<span class="sourceLineNo">185</span><a name="line.185"></a>
+<span class="sourceLineNo">186</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.186"></a>
+<span class="sourceLineNo">187</span> @Override<a name="line.187"></a>
+<span class="sourceLineNo">188</span> public boolean evaluate() throws
Exception {<a name="line.188"></a>
+<span class="sourceLineNo">189</span> // Looks like replication
endpoint returns false unless we put more than 10 edits. We<a
name="line.189"></a>
+<span class="sourceLineNo">190</span> // only send over one edit.<a
name="line.190"></a>
+<span class="sourceLineNo">191</span> int count =
ReplicationEndpointForTest.replicateCount.get();<a name="line.191"></a>
+<span class="sourceLineNo">192</span> LOG.info("count=" + count);<a
name="line.192"></a>
+<span class="sourceLineNo">193</span> return
ReplicationEndpointReturningFalse.replicated.get();<a name="line.193"></a>
+<span class="sourceLineNo">194</span> }<a name="line.194"></a>
+<span class="sourceLineNo">195</span> });<a name="line.195"></a>
+<span class="sourceLineNo">196</span> if
(ReplicationEndpointReturningFalse.ex.get() != null) {<a name="line.196"></a>
+<span class="sourceLineNo">197</span> throw
ReplicationEndpointReturningFalse.ex.get();<a name="line.197"></a>
+<span class="sourceLineNo">198</span> }<a name="line.198"></a>
+<span class="sourceLineNo">199</span><a name="line.199"></a>
+<span class="sourceLineNo">200</span>
admin.removePeer("testReplicationEndpointReturnsFalseOnReplicate");<a
name="line.200"></a>
+<span class="sourceLineNo">201</span> }<a name="line.201"></a>
+<span class="sourceLineNo">202</span><a name="line.202"></a>
+<span class="sourceLineNo">203</span> @Test<a name="line.203"></a>
+<span class="sourceLineNo">204</span> public void
testInterClusterReplication() throws Exception {<a name="line.204"></a>
+<span class="sourceLineNo">205</span> final String id =
"testInterClusterReplication";<a name="line.205"></a>
+<span class="sourceLineNo">206</span><a name="line.206"></a>
+<span class="sourceLineNo">207</span> List<HRegion> regions =
utility1.getHBaseCluster().getRegions(tableName);<a name="line.207"></a>
+<span class="sourceLineNo">208</span> int totEdits = 0;<a
name="line.208"></a>
+<span class="sourceLineNo">209</span><a name="line.209"></a>
+<span class="sourceLineNo">210</span> // Make sure edits are spread across
regions because we do region based batching<a name="line.210"></a>
+<span class="sourceLineNo">211</span> // before shipping edits.<a
name="line.211"></a>
+<span class="sourceLineNo">212</span> for(HRegion region: regions) {<a
name="line.212"></a>
+<span class="sourceLineNo">213</span> RegionInfo hri =
region.getRegionInfo();<a name="line.213"></a>
+<span class="sourceLineNo">214</span> byte[] row = hri.getStartKey();<a
name="line.214"></a>
+<span class="sourceLineNo">215</span> for (int i = 0; i < 100; i++)
{<a name="line.215"></a>
+<span class="sourceLineNo">216</span> if (row.length > 0) {<a
name="line.216"></a>
+<span class="sourceLineNo">217</span> Put put = new Put(row);<a
name="line.217"></a>
+<span class="sourceLineNo">218</span> put.addColumn(famName, row,
row);<a name="line.218"></a>
+<span class="sourceLineNo">219</span> region.put(put);<a
name="line.219"></a>
+<span class="sourceLineNo">220</span> totEdits++;<a
name="line.220"></a>
+<span class="sourceLineNo">221</span> }<a name="line.221"></a>
+<span class="sourceLineNo">222</span> }<a name="line.222"></a>
+<span class="sourceLineNo">223</span> }<a name="line.223"></a>
+<span class="sourceLineNo">224</span><a name="line.224"></a>
+<span class="sourceLineNo">225</span> admin.addPeer(id,<a
name="line.225"></a>
+<span class="sourceLineNo">226</span> new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf2))<a
name="line.226"></a>
+<span class="sourceLineNo">227</span>
.setReplicationEndpointImpl(InterClusterReplicationEndpointForTest.class.getName()),<a
name="line.227"></a>
+<span class="sourceLineNo">228</span> null);<a name="line.228"></a>
+<span class="sourceLineNo">229</span><a name="line.229"></a>
+<span class="sourceLineNo">230</span> final int numEdits = totEdits;<a
name="line.230"></a>
+<span class="sourceLineNo">231</span> Waiter.waitFor(conf1, 30000, new
Waiter.ExplainingPredicate<Exception>() {<a name="line.231"></a>
+<span class="sourceLineNo">232</span> @Override<a name="line.232"></a>
+<span class="sourceLineNo">233</span> public boolean evaluate() throws
Exception {<a name="line.233"></a>
+<span class="sourceLineNo">234</span> return
InterClusterReplicationEndpointForTest.replicateCount.get() == numEdits;<a
name="line.234"></a>
+<span class="sourceLineNo">235</span> }<a name="line.235"></a>
+<span class="sourceLineNo">236</span><a name="line.236"></a>
+<span class="sourceLineNo">237</span> @Override<a name="line.237"></a>
+<span class="sourceLineNo">238</span> public String explainFailure()
throws Exception {<a name="line.238"></a>
+<span class="sourceLineNo">239</span> String failure = "Failed to
replicate all edits, expected = " + numEdits<a name="line.239"></a>
+<span class="sourceLineNo">240</span> + " replicated = " +
InterClusterReplicationEndpointForTest.replicateCount.get();<a
name="line.240"></a>
+<span class="sourceLineNo">241</span> return failure;<a
name="line.241"></a>
+<span class="sourceLineNo">242</span> }<a name="line.242"></a>
+<span class="sourceLineNo">243</span> });<a name="line.243"></a>
+<span class="sourceLineNo">244</span><a name="line.244"></a>
+<span class="sourceLineNo">245</span>
admin.removePeer("testInterClusterReplication");<a name="line.245"></a>
+<span class="sourceLineNo">246</span>
utility1.deleteTableData(tableName);<a name="line.246"></a>
+<span class="sourceLineNo">247</span> }<a name="line.247"></a>
+<span class="sourceLineNo">248</span><a name="line.248"></a>
+<span class="sourceLineNo">249</span> @Test<a name="line.249"></a>
+<span class="sourceLineNo">250</span> public void
testWALEntryFilterFromReplicationEndpoint() throws Exception {<a
name="line.250"></a>
+<span class="sourceLineNo">251</span> ReplicationPeerConfig rpc = new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.251"></a>
+<span class="sourceLineNo">252</span>
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());<a
name="line.252"></a>
+<span class="sourceLineNo">253</span> //test that we can create mutliple
WALFilters reflectively<a name="line.253"></a>
+<span class="sourceLineNo">254</span>
rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,<a
name="line.254"></a>
+<span class="sourceLineNo">255</span>
EverythingPassesWALEntryFilter.class.getName() +<a name="line.255"></a>
+<span class="sourceLineNo">256</span> "," +
EverythingPassesWALEntryFilterSubclass.class.getName());<a name="line.256"></a>
+<span class="sourceLineNo">257</span>
admin.addPeer("testWALEntryFilterFromReplicationEndpoint", rpc);<a
name="line.257"></a>
+<span class="sourceLineNo">258</span> // now replicate some data.<a
name="line.258"></a>
+<span class="sourceLineNo">259</span> try (Connection connection =
ConnectionFactory.createConnection(conf1)) {<a name="line.259"></a>
+<span class="sourceLineNo">260</span> doPut(connection,
Bytes.toBytes("row1"));<a name="line.260"></a>
+<span class="sourceLineNo">261</span> doPut(connection, row);<a
name="line.261"></a>
+<span class="sourceLineNo">262</span> doPut(connection,
Bytes.toBytes("row2"));<a name="line.262"></a>
+<span class="sourceLineNo">263</span> }<a name="line.263"></a>
+<span class="sourceLineNo">264</span><a name="line.264"></a>
+<span class="sourceLineNo">265</span> Waiter.waitFor(conf1, 60000, new
Waiter.Predicate<Exception>() {<a name="line.265"></a>
+<span class="sourceLineNo">266</span> @Override<a name="line.266"></a>
+<span class="sourceLineNo">267</span> public boolean evaluate() throws
Exception {<a name="line.267"></a>
+<span class="sourceLineNo">268</span> return
ReplicationEndpointForTest.replicateCount.get() >= 1;<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><a name="line.271"></a>
+<span class="sourceLineNo">272</span>
Assert.assertNull(ReplicationEndpointWithWALEntryFilter.ex.get());<a
name="line.272"></a>
+<span class="sourceLineNo">273</span> //make sure our reflectively created
filter is in the filter chain<a name="line.273"></a>
+<span class="sourceLineNo">274</span>
Assert.assertTrue(EverythingPassesWALEntryFilter.hasPassedAnEntry());<a
name="line.274"></a>
+<span class="sourceLineNo">275</span>
admin.removePeer("testWALEntryFilterFromReplicationEndpoint");<a
name="line.275"></a>
+<span class="sourceLineNo">276</span> }<a name="line.276"></a>
+<span class="sourceLineNo">277</span><a name="line.277"></a>
+<span class="sourceLineNo">278</span> @Test (expected=IOException.class)<a
name="line.278"></a>
+<span class="sourceLineNo">279</span> public void
testWALEntryFilterAddValidation() throws Exception {<a name="line.279"></a>
+<span class="sourceLineNo">280</span> ReplicationPeerConfig rpc = new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.280"></a>
+<span class="sourceLineNo">281</span>
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());<a
name="line.281"></a>
+<span class="sourceLineNo">282</span> //test that we can create mutliple
WALFilters reflectively<a name="line.282"></a>
+<span class="sourceLineNo">283</span>
rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,<a
name="line.283"></a>
+<span class="sourceLineNo">284</span> "IAmNotARealWalEntryFilter");<a
name="line.284"></a>
+<span class="sourceLineNo">285</span>
admin.addPeer("testWALEntryFilterAddValidation", rpc);<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> @Test (expected=IOException.class)<a
name="line.288"></a>
+<span class="sourceLineNo">289</span> public void
testWALEntryFilterUpdateValidation() throws Exception {<a name="line.289"></a>
+<span class="sourceLineNo">290</span> ReplicationPeerConfig rpc = new
ReplicationPeerConfig().setClusterKey(ZKConfig.getZooKeeperClusterKey(conf1))<a
name="line.290"></a>
+<span class="sourceLineNo">291</span>
.setReplicationEndpointImpl(ReplicationEndpointWithWALEntryFilter.class.getName());<a
name="line.291"></a>
+<span class="sourceLineNo">292</span> //test that we can create mutliple
WALFilters reflectively<a name="line.292"></a>
+<span class="sourceLineNo">293</span>
rpc.getConfiguration().put(BaseReplicationEndpoint.REPLICATION_WALENTRYFILTER_CONFIG_KEY,<a
name="line.293"></a>
+<span class="sourceLineNo">294</span> "IAmNotARealWalEntryFilter");<a
name="line.294"></a>
+<span class="sourceLineNo">295</span>
admin.updatePeerConfig("testWALEntryFilterUpdateValidation", rpc);<a
name="line.295"></a>
+<span class="sourceLineNo">296</span> }<a name="line.296"></a>
+<span class="sourceLineNo">297</span><a name="line.297"></a>
<span class="sourceLineNo">298</span><a name="line.298"></a>
-<span class="sourceLineNo">299</span><a name="line.299"></a>
-<span class="sourceLineNo">300</span> @Test<a name="line.300"></a>
-<span class="sourceLineNo">301</span> public void
testMetricsSourceBaseSourcePassthrough(){<a name="line.301"></a>
-<span class="sourceLineNo">302</span> /*<a name="line.302"></a>
-<span class="sourceLineNo">303</span> The replication MetricsSource wraps a
MetricsReplicationSourceSourceImpl<a name="line.303"></a>
-<span class="sourceLineNo">304</span> and a
MetricsReplicationGlobalSourceSource, so that metrics get written to both
namespaces.<a name="line.304"></a>
-<span class="sourceLineNo">305</span> Both of those classes wrap a
MetricsReplicationSourceImpl that implements BaseSource, which<a
name="line.305"></a>
-<span class="sourceLineNo">306</span> allows for custom JMX metrics.<a
name="line.306"></a>
-<span class="sourceLineNo">307</span> This test checks to make sure the
BaseSource decorator logic on MetricsSource actually calls down through<a
name="line.307"></a>
-<span class="sourceLineNo">308</span> the two layers of wrapping to the
actual BaseSource.<a name="line.308"></a>
-<span class="sourceLineNo">309</span> */<a name="line.309"></a>
-<span class="sourceLineNo">310</span> String id = "id";<a
name="line.310"></a>
-<span class="sourceLineNo">311</span> DynamicMetricsRegistry mockRegistry =
mock(DynamicMetricsRegistry.class);<a name="line.311"></a>
-<span class="sourceLineNo">312</span> MetricsReplicationSourceImpl
singleRms = mock(MetricsReplicationSourceImpl.class);<a name="line.312"></a>
-<span class="sourceLineNo">313</span>
when(singleRms.getMetricsRegistry()).thenReturn(mockRegistry);<a
name="line.313"></a>
-<span class="sourceLineNo">314</span> MetricsReplicationSourceImpl
globalRms = mock(MetricsReplicationSourceImpl.class);<a name="line.314"></a>
-<span class="sourceLineNo">315</span>
when(globalRms.getMetricsRegistry()).thenReturn(mockRegistry);<a
name="line.315"></a>
-<span class="sourceLineNo">316</span><a name="line.316"></a>
-<span class="sourceLineNo">317</span> MetricsReplicationSourceSource
singleSourceSource = new MetricsReplicationSourceSourceImpl(singleRms, id);<a
name="line.317"></a>
-<span class="sourceLineNo">318</span> MetricsReplicationSourceSource
globalSourceSource = new MetricsReplicationGlobalSourceSource(globalRms);<a
name="line.318"></a>
-<span class="sourceLineNo">319</span> MetricsSource source = new
MetricsSource(id, singleSourceSource, globalSourceSource);<a
name="line.319"></a>
-<span class="sourceLineNo">320</span> String gaugeName = "gauge";<a
name="line.320"></a>
-<span class="sourceLineNo">321</span> String singleGaugeName = "source.id."
+ gaugeName;<a name="line.321"></a>
-<span class="sourceLineNo">322</span> String globalGaugeName = "source." +
gaugeName;<a name="line.322"></a>
-<span class="sourceLineNo">323</span> long delta = 1;<a name="line.323"></a>
-<span class="sourceLineNo">324</span> String counterName = "counter";<a
name="line.324"></a>
-<span class="sourceLineNo">325</span> String singleCounterName =
"source.id." + counterName;<a name="line.325"></a>
-<span class="sourceLineNo">326</span> String globalCounterName = "source."
+ counterName;<a name="line.326"></a>
-<span class="sourceLineNo">327</span> long count = 2;<a name="line.327"></a>
-<span class="sourceLineNo">328</span> source.decGauge(gaugeName, delta);<a
name="line.328"></a>
-<span class="sourceLineNo">329</span> source.getMetricsContext();<a
name="line.329"></a>
-<span class="sourceLineNo">330</span> source.getMetricsDescription();<a
name="line.330"></a>
-<span class="sourceLineNo">331</span> source.getMetricsJmxContext();<a
name="line.331"></a>
-<span class="sourceLineNo">332</span> source.getMetricsName();<a
name="line.332"></a>
-<span class="sourceLineNo">333</span> source.incCounters(counterName,
count);<a name="line.333"></a>
-<span class="sourceLineNo">334</span> source.incGauge(gaugeName, delta);<a
name="line.334"></a>
-<span class="sourceLineNo">335</span> source.init();<a name="line.335"></a>
-<span class="sourceLineNo">336</span> source.removeMetric(gaugeName);<a
name="line.336"></a>
-<span class="sourceLineNo">337</span> source.setGauge(gaugeName, delta);<a
name="line.337"></a>
-<span class="sourceLineNo">338</span> source.updateHistogram(counterName,
count);<a name="line.338"></a>
-<span class="sourceLineNo">339</span><a name="line.339"></a>
-<span class="sourceLineNo">340</span>
verify(singleRms).decGauge(singleGaugeName, delta);<a name="line.340"></a>
-<span class="sourceLineNo">341</span>
verify(globalRms).decGauge(globalGaugeName, delta);<a name="line.341"></a>
-<span class="sourceLineNo">342</span>
verify(globalRms).getMetricsContext();<a name="line.342"></a>
-<span class="sourceLineNo">343</span>
verify(globalRms).getMetricsJmxContext();<a name="line.343"></a>
-<span class="sourceLineNo">344</span> verify(globalRms).getMetricsName();<a
name="line.344"></a>
-<span class="sourceLineNo">345</span>
verify(singleRms).incCounters(singleCounterName, count);<a name="line.345"></a>
-<span class="sourceLineNo">346</span>
verify(globalRms).incCounters(globalCounterName, count);<a name="line.346"></a>
-<span class="sourceLineNo">347</span>
verify(singleRms).incGauge(singleGaugeName, delta);<a name="line.347"></a>
-<span class="sourceLineNo">348</span>
verify(globalRms).incGauge(globalGaugeName, delta);<a name="line.348"></a>
-<span class="sourceLineNo">349</span> verify(globalRms).init();<a
name="line.349"></a>
-<span class="sourceLineNo">350</span>
verify(singleRms).removeMetric(singleGaugeName);<a name="line.350"></a>
-<span class="sourceLineNo">351</span>
verify(globalRms).removeMetric(globalGaugeName);<a name="line.351"></a>
-<span class="sourceLineNo">352</span>
verify(singleRms).setGauge(singleGaugeName, delta);<a name="line.352"></a>
-<span class="sourceLineNo">353</span>
verify(globalRms).setGauge(globalGaugeName, delta);<a name="line.353"></a>
-<span class="sourceLineNo">354</span>
verify(singleRms).updateHistogram(singleCounterName, count);<a
name="line.354"></a>
-<span class="sourceLineNo">355</span>
verify(globalRms).updateHistogram(globalCounterName, count);<a
name="line.355"></a>
-<span class="sourceLineNo">356</span> }<a name="line.356"></a>
-<span class="sourceLineNo">357</span><a name="line.357"></a>
-<span class="sourceLineNo">358</span> private void doPut(byte[] row) throws
IOException {<a name="line.358"></a>
-<span class="sourceLineNo">359</span> try (Connection connection =
ConnectionFactory.createConnection(conf1)) {<a name="line.359"></a>
-<span class="sourceLineNo">360</span> doPut(connection, row);<a
name="line.360"></a>
-<span class="sourceLineNo">361</span> }<a name="line.361"></a>
-<span class="sourceLineNo">362</span> }<a name="line.362"></a>
-<span class="sourceLineNo">363</span><a name="line.363"></a>
-<span class="sourceLineNo">364</span> private void doPut(final Connection
connection, final byte [] row) throws IOException {<a name="line.364"></a>
-<span class="sourceLineNo">365</span> try (Table t =
connection.getTable(tableName)) {<a name="line.365"></a>
-<span class="sourceLineNo">366</span> Put put = new Put(row);<a
name="line.366"></a>
-<span class="sourceLineNo">367</span> put.addColumn(famName, row, row);<a
name="line.367"></a>
-<span class="sourceLineNo">368</span> t.put(put);<a name="line.368"></a>
-<span class="sourceLineNo">369</span> }<a name="line.369"></a>
-<span class="sourceLineNo">370</span> }<a name="line.370"></a>
-<span class="sourceLineNo">371</span><a name="line.371"></a>
-<span class="sourceLineNo">372</span> private static void doAssert(byte[]
row) throws Exception {<a name="line.372"></a>
-<span class="sourceLineNo">373</span> if
(ReplicationEndpointForTest.lastEntries == null) {<a name="line.373"></a>
-<span class="sourceLineNo">374</span> return; // first call<a
name="line.374"></a>
-<span class="sourceLineNo">375</span> }<a name="line.375"></a>
-<span class="sourceLineNo">376</span> Assert.assertEquals(1,
ReplicationEndpointForTest.lastEntries.size());<a name="line.376"></a>
-<span class="sourceLineNo">377</span> List<Cell> cells =
ReplicationEndpointForTest.lastEntries.get(0).getEdit().getCells();<a
name="line.377"></a>
-<span class="sourceLineNo">378</span> Assert.assertEquals(1,
cells.size());<a name="line.378"></a>
-<span class="sourceLineNo">379</span>
Assert.assertTrue(Bytes.equals(cells.get(0).getRowArray(),
cells.get(0).getRowOffset(),<a name="line.379"></a>
-<span class="sourceLineNo">380</span> cells.get(0).getRowLength(), row,
0, row.length));<a name="line.380"></a>
-<span class="sourceLineNo">381</span> }<a name="line.381"></a>
-<span class="sourceLineNo">382</span><a name="line.382"></a>
-<span class="sourceLineNo">383</span> public static class
ReplicationEndpointForTest extends BaseReplicationEndpoint {<a
name="line.383"></a>
-<span class="sourceLineNo">384</span> static UUID uuid =
UUID.randomUUID();<a name="line.384"></a>
-<span class="sourceLineNo">385</span> static AtomicInteger contructedCount
= new AtomicInteger();<a name="line.385"></a>
-<span class="sourceLineNo">386</span> static AtomicInteger startedCount =
new AtomicInteger();<a name="line.386"></a>
-<span class="sourceLineNo">387</span> static AtomicInteger stoppedCount =
new AtomicInteger();<a name="line.387"></a>
-<span class="sourceLineNo">388</span> static AtomicInteger replicateCount =
new AtomicInteger();<a name="line.388"></a>
-<span class="sourceLineNo">389</span> static volatile List<Entry>
lastEntries = null;<a name="line.389"></a>
-<span class="sourceLineNo">390</span><a name="line.390"></a>
-<span class="sourceLineNo">391</span> public ReplicationEndpointForTest()
{<a name="line.391"></a>
+<span class="sourceLineNo">299</span> @Test<a name="line.299"></a>
+<span class="sourceLineNo">300</span> public void
testMetricsSourceBaseSourcePassthrough(){<a name="line.300"></a>
+<span class="sourceLineNo">301</span> /*<a name="line.301"></a>
+<span class="sourceLineNo">302</span> The replication MetricsSource wraps a
MetricsReplicationSourceSourceImpl<a name="line.302"></a>
+<span class="sourceLineNo">303</span> and a
MetricsReplicationGlobalSourceSource, so that metrics get written to both
namespaces.<a name="line.303"></a>
+<span class="sourceLineNo">304</span> Both of those classes wrap a
MetricsReplicationSourceImpl that implements BaseSource, which<a
name="line.304"></a>
+<span class="sourceLineNo">305</span> allows for custom JMX metrics.<a
name="line.305"></a>
+<span class="sourceLineNo">306</span> This test checks to make sure the
BaseSource decorator logic on MetricsSource actually calls down through<a
name="line.306"></a>
+<span class="sourceLineNo">307</span> the two layers of wrapping to the
actual BaseSource.<a name="line.307"></a>
+<span class="sourceLineNo">308</span> */<a name="line.308"></a>
+<span class="sourceLineNo">309</span> String id = "id";<a
name="line.309"></a>
+<span class="sourceLineNo">310</span> DynamicMetricsRegistry mockRegistry =
mock(DynamicMetricsRegistry.class);<a name="line.310"></a>
+<span class="sourceLineNo">311</span> MetricsReplicationSourceImpl
singleRms = mock(MetricsReplicationSourceImpl.class);<a name="line.311"></a>
+<span class="sourceLineNo">312</span>
when(singleRms.getMetricsRegistry()).thenReturn(mockRegistry);<a
name="line.312"></a>
+<span class="sourceLineNo">313</span> MetricsReplicationSourceImpl
globalRms = mock(MetricsReplicationSourceImpl.class);<a name="line.313"></a>
+<span class="sourceLineNo">314</span>
when(globalRms.getMetricsRegistry()).thenReturn(mockRegistry);<a
name="line.314"></a>
+<span class="sourceLineNo">315</span><a name="line.315"></a>
+<span class="sourceLineNo">316</span> MetricsReplicationSourceSource
singleSourceSource = new MetricsReplicationSourceSourceImpl(singleRms, id);<a
name="line.316"></a>
+<span class="sourceLineNo">317</span> MetricsReplicationSourceSource
globalSourceSource = new MetricsReplicationGlobalSourceSource(globalRms);<a
name="line.317"></a>
+<span class="sourceLineNo">318</span> MetricsSource source = new
MetricsSource(id, singleSourceSource, globalSourceSource);<a
name="line.318"></a>
+<span class="sourceLineNo">319</span> String gaugeName = "gauge";<a
name="line.319"></a>
+<span class="sourceLineNo">320</span> String singleGaugeName = "source.id."
+ gaugeName;<a name="line.320"></a>
+<span class="sourceLineNo">321</span> String globalGaugeName = "source." +
gaugeName;<a name="line.321"></a>
+<span class="sourceLineNo">322</span> long delta = 1;<a name="line.322"></a>
+<span class="sourceLineNo">323</span> String counterName = "counter";<a
name="line.323"></a>
+<span class="sourceLineNo">324</span> String singleCounterName =
"source.id." + counterName;<a name="line.324"></a>
+<span class="sourceLineNo">325</span> String globalCounterName = "source."
+ counterName;<a name="line.325"></a>
+<span class="sourceLineNo">326</span> long count = 2;<a name="line.326"></a>
+<span class="sourceLineNo">327</span> source.decGauge(gaugeName, delta);<a
name="line.327"></a>
+<span class="sourceLineNo">328</span> source.getMetricsContext();<a
name="line.328"></a>
+<span class="sourceLineNo">329</span> source.getMetricsDescription();<a
name="line.329"></a>
+<span class="sourceLineNo">330</span> source.getMetricsJmxContext();<a
name="line.330"></a>
+<span class="sourceLineNo">331</span> source.getMetricsName();<a
name="line.331"></a>
+<span class="sourceLineNo">332</span> source.incCounters(counterName,
count);<a name="line.332"></a>
+<span class="sourceLineNo">333</span> source.incGauge(gaugeName, delta);<a
name="line.333"></a>
+<span class="sourceLineNo">334</span> source.init();<a name="line.334"></a>
+<span class="sourceLineNo">335</span> source.removeMetric(gaugeName);<a
name="line.335"></a>
+<span class="sourceLineNo">336</span> source.setGauge(gaugeName, delta);<a
name="line.336"></a>
+<span class="sourceLineNo">337</span> source.updateHistogram(counterName,
count);<a name="line.337"></a>
+<span class="sourceLineNo">338</span><a name="line.338"></a>
+<span class="sourceLineNo">339</span>
verify(singleRms).decGauge(singleGaugeName, delta);<a name="line.339"></a>
+<span class="sourceLineNo">340</span>
verify(globalRms).decGauge(globalGaugeName, delta);<a name="line.340"></a>
+<span class="sourceLineNo">341</span>
verify(globalRms).getMetricsContext();<a name="line.341"></a>
+<span class="sourceLineNo">342</span>
verify(globalRms).getMetricsJmxContext();<a name="line.342"></a>
+<span class="sourceLineNo">343</span> verify(globalRms).getMetricsName();<a
name="line.343"></a>
+<span class="sourceLineNo">344</span>
verify(singleRms).incCounters(singleCounterName, count);<a name="line.344"></a>
+<span class="sourceLineNo">345</span>
verify(globalRms).incCounters(globalCounterName, count);<a name="line.345"></a>
+<span class="sourceLineNo">346</span>
verify(singleRms).incGauge(singleGaugeName, delta);<a name="line.346"></a>
+<span class="sourceLineNo">347</span>
verify(globalRms).incGauge(globalGaugeName, delta);<a name="line.347"></a>
+<span class="sourceLineNo">348</span> verify(globalRms).init();<a
name="line.348"></a>
+<span class="sourceLineNo">349</span>
verify(singleRms).removeMetric(singleGaugeName);<a name="line.349"></a>
+<span class="sourceLineNo">350</span>
verify(globalRms).removeMetric(globalGaugeName);<a name="line.350"></a>
+<span class="sourceLineNo">351</span>
verify(singleRms).setGauge(singleGaugeName, delta);<a name="line.351"></a>
+<span class="sourceLineNo">352</span>
verify(globalRms).setGauge(globalGaugeName, delta);<a name="line.352"></a>
+<span class="sourceLineNo">353</span>
verify(singleRms).updateHistogram(singleCounterName, count);<a
name="line.353"></a>
+<span class="sourceLineNo">354</span>
verify(globalRms).updateHistogram(globalCounterName, count);<a
name="line.354"></a>
+<span class="sourceLineNo">355</span> }<a name="line.355"></a>
+<span class="sourceLineNo">356</span><a name="line.356"></a>
+<span class="sourceLineNo">357</span> private void doPut(byte[] row) throws
IOException {<a name="line.357"></a>
+<span class="sourceLineNo">358</span> try (Connection connection =
ConnectionFactory.createConnection(conf1)) {<a name="line.358"></a>
+<span class="sourceLineNo">359</span> doPut(connection, row);<a
name="line.359"></a>
+<span class="sourceLineNo">360</span> }<a name="line.360"></a>
+<span class="sourceLineNo">361</span> }<a name="line.361"></a>
+<span class="sourceLineNo">362</span><a name="line.362"></a>
+<span class="sourceLineNo">363</span> private void doPut(final Connection
connection, final byte [] row) throws IOException {<a name="line.363"></a>
+<span class="sourceLineNo">364</span> try (Table t =
connection.getTable(tableName)) {<a name="line.364"></a>
+<span class="sourceLineNo">365</span> Put put = new Put(row);<a
name="line.365"></a>
+<span class="sourceLineNo">366</span> put.addColumn(famName, row, row);<a
name="line.366"></a>
+<span class="sourceLineNo">367</span> t.put(put);<a name="line.367"></a>
+<span class="sourceLineNo">368</span> }<a name="line.368"></a>
+<span class="sourceLineNo">369</span> }<a name="line.369"></a>
+<span class="sourceLineNo">370</span><a name="line.370"></a>
+<span class="sourceLineNo">371</span> private static void doAssert(byte[]
row) throws Exception {<a name="line.371"></a>
+<span class="sourceLineNo">372</span> if
(ReplicationEndpointForTest.lastEntries == null) {<a name="line.372"></a>
+<span class="sourceLineNo">373</span> return; // first call<a
name="line.373"></a>
+<span class="sourceLineNo">374</span> }<a name="line.374"></a>
+<span class="sourceLineNo">375</span> Assert.assertEquals(1,
ReplicationEndpointForTest.lastEntries.size());<a name="line.375"></a>
+<span class="sourceLineNo">376</span> List<Cell> cells =
ReplicationEndpointForTest.lastEntries.get(0).getEdit().getCells();<a
name="line.376"></a>
+<span class="sourceLineNo">377</span> Assert.assertEquals(1,
cells.size());<a name="line.377"></a>
+<span class="sourceLineNo">378</span>
Assert.assertTrue(Bytes.equals(cells.get(0).getRowArray(),
cells.get(0).getRowOffset(),<a name="line.378"></a>
+<span class="sourceLineNo">379</span> cells.get(0).getRowLength(), row,
0, row.length));<a name="line.379"></a>
+<span class="sourceLineNo">380</span> }<a name="line.380"></a>
+<span class="sourceLineNo">381</span><a name="line.381"></a>
+<span class="sourceLineNo">382</span> public static class
ReplicationEndpointForTest extends BaseReplicationEndpoint {<a
name="line.382"></a>
+<span class="sourceLineNo">383</span> static UUID uuid =
UUID.randomUUID();<a name="line.383"></a>
+<span class="sourceLineNo">384</span> static AtomicInteger contructedCount
= new AtomicInteger();<a name="line.384"></a>
+<span class="sourceLineNo">385</span> static AtomicInteger startedCount =
new AtomicInteger();<a name="line.385"></a>
+<span class="sourceLineNo">386</span> static AtomicInteger stoppedCount =
new AtomicInteger();<a name="line.386"></a>
+<span class="sourceLineNo">387</span> static AtomicInteger replicateCount =
new AtomicInteger();<a name="line.387"></a>
+<span class="sourceLineNo">388</span> static volatile List<Entry>
lastEntries = null;<a name="line.388"></a>
+<span class="sourceLineNo">389</span><a name="line.389"></a>
+<span class="sourceLineNo">390</span> public ReplicationEndpointForTest()
{<a name="line.390"></a>
+<span class="sourceLineNo">391</span> replicateCount.set(0);<a
name="line.391"></a>
<span class="sourceLineNo">392</span>
contructedCount.incrementAndGet();<a name="line.392"></a>
<span class="sourceLineNo">393</span> }<a name="line.393"></a>
<span class="sourceLineNo">394</span><a name="line.394"></a>
@@ -441,127 +441,131 @@
<span class="sourceLineNo">433</span> static AtomicInteger replicateCount =
new AtomicInteger();<a name="line.433"></a>
<span class="sourceLineNo">434</span> static boolean failedOnce;<a
name="line.434"></a>
<span class="sourceLineNo">435</span><a name="line.435"></a>
-<span class="sourceLineNo">436</span> @Override<a name="line.436"></a>
-<span class="sourceLineNo">437</span> public boolean
replicate(ReplicateContext replicateContext) {<a name="line.437"></a>
-<span class="sourceLineNo">438</span> boolean success =
super.replicate(replicateContext);<a name="line.438"></a>
-<span class="sourceLineNo">439</span> if (success) {<a
name="line.439"></a>
-<span class="sourceLineNo">440</span>
replicateCount.addAndGet(replicateContext.entries.size());<a
name="line.440"></a>
-<span class="sourceLineNo">441</span> }<a name="line.441"></a>
-<span class="sourceLineNo">442</span> return success;<a
name="line.442"></a>
-<span class="sourceLineNo">443</span> }<a name="line.443"></a>
-<span class="sourceLineNo">444</span><a name="line.444"></a>
-<span class="sourceLineNo">445</span> @Override<a name="line.445"></a>
-<span class="sourceLineNo">446</span> protected Replicator
createReplicator(List<Entry> entries, int ordinal) {<a
name="line.446"></a>
-<span class="sourceLineNo">447</span> // Fail only once, we don't want to
slow down the test.<a name="line.447"></a>
-<span class="sourceLineNo">448</span> if (failedOnce) {<a
name="line.448"></a>
-<span class="sourceLineNo">449</span> return new
DummyReplicator(entries, ordinal);<a name="line.449"></a>
-<span class="sourceLineNo">450</span> } else {<a name="line.450"></a>
-<span class="sourceLineNo">451</span> failedOnce = true;<a
name="line.451"></a>
-<span class="sourceLineNo">452</span> return new
FailingDummyReplicator(entries, ordinal);<a name="line.452"></a>
-<span class="sourceLineNo">453</span> }<a name="line.453"></a>
-<span class="sourceLineNo">454</span> }<a name="line.454"></a>
-<span class="sourceLineNo">455</span><a name="line.455"></a>
-<span class="sourceLineNo">456</span> protected class DummyReplicator
extends Replicator {<a name="line.456"></a>
-<span class="sourceLineNo">457</span><a name="line.457"></a>
-<span class="sourceLineNo">458</span> private int ordinal;<a
name="line.458"></a>
+<span class="sourceLineNo">436</span> public
InterClusterReplicationEndpointForTest() {<a name="line.436"></a>
+<span class="sourceLineNo">437</span> replicateCount.set(0);<a
name="line.437"></a>
+<span class="sourceLineNo">438</span> }<a name="line.438"></a>
+<span class="sourceLineNo">439</span><a name="line.439"></a>
+<span class="sourceLineNo">440</span> @Override<a name="line.440"></a>
+<span class="sourceLineNo">441</span> public boolean
replicate(ReplicateContext replicateContext) {<a name="line.441"></a>
+<span class="sourceLineNo">442</span> boolean success =
super.replicate(replicateContext);<a name="line.442"></a>
+<span class="sourceLineNo">443</span> if (success) {<a
name="line.443"></a>
+<span class="sourceLineNo">444</span>
replicateCount.addAndGet(replicateContext.entries.size());<a
name="line.444"></a>
+<span class="sourceLineNo">445</span> }<a name="line.445"></a>
+<span class="sourceLineNo">446</span> return success;<a
name="line.446"></a>
+<span class="sourceLineNo">447</span> }<a name="line.447"></a>
+<span class="sourceLineNo">448</span><a name="line.448"></a>
+<span class="sourceLineNo">449</span> @Override<a name="line.449"></a>
+<span class="sourceLineNo">450</span> protected Replicator
createReplicator(List<Entry> entries, int ordinal) {<a
name="line.450"></a>
+<span class="sourceLineNo">451</span> // Fail only once, we don't want to
slow down the test.<a name="line.451"></a>
+<span class="sourceLineNo">452</span> if (failedOnce) {<a
name="line.452"></a>
+<span class="sourceLineNo">453</span> return new
DummyReplicator(entries, ordinal);<a name="line.453"></a>
+<span class="sourceLineNo">454</span> } else {<a name="line.454"></a>
+<span class="sourceLineNo">455</span> failedOnce = true;<a
name="line.455"></a>
+<span class="sourceLineNo">456</span> return new
FailingDummyReplicator(entries, ordinal);<a name="line.456"></a>
+<span class="sourceLineNo">457</span> }<a name="line.457"></a>
+<span class="sourceLineNo">458</span> }<a name="line.458"></a>
<span class="sourceLineNo">459</span><a name="line.459"></a>
-<span class="sourceLineNo">460</span> public
DummyReplicator(List<Entry> entries, int ordinal) {<a name="line.460"></a>
-<span class="sourceLineNo">461</span> super(entries, ordinal);<a
name="line.461"></a>
-<span class="sourceLineNo">462</span> this.ordinal = ordinal;<a
name="line.462"></a>
-<span class="sourceLineNo">463</span> }<a name="line.463"></a>
-<span class="sourceLineNo">464</span><a name="line.464"></a>
-<span class="sourceLineNo">465</span> @Override<a name="line.465"></a>
-<span class="sourceLineNo">466</span> public Integer call() throws
IOException {<a name="line.466"></a>
-<span class="sourceLineNo">467</span> return ordinal;<a
name="line.467"></a>
-<span class="sourceLineNo">468</span> }<a name="line.468"></a>
-<span class="sourceLineNo">469</span> }<a name="line.469"></a>
-<span class="sourceLineNo">470</span><a name="line.470"></a>
-<span class="sourceLineNo">471</span> protected class
FailingDummyReplicator extends DummyReplicator {<a name="line.471"></a>
-<span class="sourceLineNo">472</span><a name="line.472"></a>
-<span class="sourceLineNo">473</span> public
FailingDummyReplicator(List<Entry> entries, int ordinal) {<a
name="line.473"></a>
-<span class="sourceLineNo">474</span> super(entries, ordinal);<a
name="line.474"></a>
-<span class="sourceLineNo">475</span> }<a name="line.475"></a>
+<span class="sourceLineNo">460</span> protected class DummyReplicator
extends Replicator {<a name="line.460"></a>
+<span class="sourceLineNo">461</span><a name="line.461"></a>
+<span class="sourceLineNo">462</span> private int ordinal;<a
name="line.462"></a>
+<span class="sourceLineNo">463</span><a name="line.463"></a>
+<span class="sourceLineNo">464</span> public
DummyReplicator(List<Entry> entries, int ordinal) {<a name="line.464"></a>
+<span class="sourceLineNo">465</span> super(entries, ordinal);<a
name="line.465"></a>
+<span class="sourceLineNo">466</span> this.ordinal = ordinal;<a
name="line.466"></a>
+<span class="sourceLineNo">467</span> }<a name="line.467"></a>
+<span class="sourceLineNo">468</span><a name="line.468"></a>
+<span class="sourceLineNo">469</span> @Override<a name="line.469"></a>
+<span class="sourceLineNo">470</span> public Integer call() throws
IOException {<a name="line.470"></a>
+<span class="sourceLineNo">471</span> return ordinal;<a
name="line.471"></a>
+<span class="sourceLineNo">472</span> }<a name="line.472"></a>
+<span class="sourceLineNo">473</span> }<a name="line.473"></a>
+<span class="sourceLineNo">474</span><a name="line.474"></a>
+<span class="sourceLineNo">475</span> protected class
FailingDummyReplicator extends DummyReplicator {<a name="line.475"></a>
<span class="sourceLineNo">476</span><a name="line.476"></a>
-<span class="sourceLineNo">477</span> @Override<a name="line.477"></a>
-<span class="sourceLineNo">478</span> public Integer call() throws
IOException {<a name="line.478"></a>
-<span class="sourceLineNo">479</span> throw new IOException("Sample
Exception: Failed to replicate.");<a name="line.479"></a>
-<span class="sourceLineNo">480</span> }<a name="line.480"></a>
-<span class="sourceLineNo">481</span> }<a name="line.481"></a>
-<span class="sourceLineNo">482</span> }<a name="line.482"></a>
-<span class="sourceLineNo">483</span><a name="line.483"></a>
-<span class="sourceLineNo">484</span> public static class
ReplicationEndpointReturningFalse extends ReplicationEndpointForTest {<a
name="line.484"></a>
-<span class="sourceLineNo">485</span> static int COUNT = 10;<a
name="line.485"></a>
-<span class="sourceLineNo">486</span> static
AtomicReference<Exception> ex = new AtomicReference<>(null);<a
name="line.486"></a>
-<span class="sourceLineNo">487</span> static AtomicBoolean replicated = new
AtomicBoolean(false);<a name="line.487"></a>
-<span class="sourceLineNo">488</span> @Override<a name="line.488"></a>
-<span class="sourceLineNo">489</span> public boolean
replicate(ReplicateContext replicateContext) {<a name="line.489"></a>
-<span class="sourceLineNo">490</span> try {<a name="line.490"></a>
-<span class="sourceLineNo">491</span> // check row<a
name="line.491"></a>
-<span class="sourceLineNo">492</span> doAssert(row);<a
name="line.492"></a>
-<span class="sourceLineNo">493</span> } catch (Exception e) {<a
name="line.493"></a>
-<span class="sourceLineNo">494</span> ex.set(e);<a name="line.494"></a>
-<span class="sourceLineNo">495</span> }<a name="line.495"></a>
-<span class="sourceLineNo">496</span><a name="line.496"></a>
-<span class="sourceLineNo">497</span>
super.replicate(replicateContext);<a name="line.497"></a>
-<span class="sourceLineNo">498</span> LOG.info("Replicated " +
Bytes.toString(row) + ", count=" + replicateCount.get());<a name="line.498"></a>
-<span class="sourceLineNo">499</span><a name="line.499"></a>
-<span class="sourceLineNo">500</span> replicated.set(replicateCount.get()
> COUNT); // first 10 times, we return false<a name="line.500"></a>
-<span class="sourceLineNo">501</span> return replicated.get();<a
name="line.501"></a>
-<span class="sourceLineNo">502</span> }<a name="line.502"></a>
-<span class="sourceLineNo">503</span> }<a name="line.503"></a>
-<span class="sourceLineNo">504</span><a name="line.504"></a>
-<span class="sourceLineNo">505</span> // return a WALEntry filter which only
accepts "row", but not other rows<a name="line.505"></a>
-<span class="sourceLineNo">506</span> public static class
ReplicationEndpointWithWALEntryFilter extends ReplicationEndpointForTest {<a
name="line.506"></a>
-<span class="sourceLineNo">507</span> static
AtomicReference<Exception> ex = new AtomicReference<>(null);<a
name="line.507"></a>
+<span class="sourceLineNo">477</span> public
FailingDummyReplicator(List<Entry> entries, int ordinal) {<a
name="line.477"></a>
+<span class="sourceLineNo">478</span> super(entries, ordinal);<a
name="line.478"></a>
+<span class="sourceLineNo">479</span> }<a name="line.479"></a>
+<span class="sourceLineNo">480</span><a name="line.480"></a>
+<span class="sourceLineNo">481</span> @Override<a name="line.481"></a>
+<span class="sourceLineNo">482</span> public Integer call() throws
IOException {<a name="line.482"></a>
+<span class="sourceLineNo">483</span> throw new IOException("Sample
Exception: Failed to replicate.");<a name="line.483"></a>
+<span class="sourceLineNo">484</span> }<a name="line.484"></a>
+<span class="sourceLineNo">485</span> }<a name="line.485"></a>
+<span class="sourceLineNo">486</span> }<a name="line.486"></a>
+<span class="sourceLineNo">487</span><a name="line.487"></a>
+<span class="sourceLineNo">488</span> public static class
ReplicationEndpointReturningFalse extends ReplicationEndpointForTest {<a
name="line.488"></a>
+<span class="sourceLineNo">489</span> static int COUNT = 10;<a
name="line.489"></a>
+<span class="sourceLineNo">490</span> static
AtomicReference<Exception> ex = new AtomicReference<>(null);<a
name="line.490"></a>
+<span class="sourceLineNo">491</span> static AtomicBoolean replicated = new
AtomicBoolean(false);<a name="line.491"></a>
+<span class="sourceLineNo">492</span> @Override<a name="line.492"></a>
+<span class="sourceLineNo">493</span> public boolean
replicate(ReplicateContext replicateContext) {<a name="line.493"></a>
+<span class="sourceLineNo">494</span> try {<a name="line.494"></a>
+<span class="sourceLineNo">495</span> // check row<a
name="line.495"></a>
+<span class="sourceLineNo">496</span> doAssert(row);<a
name="line.496"></a>
+<span class="sourceLineNo">497</span> } catch (Exception e) {<a
name="line.497"></a>
+<span class="sourceLineNo">498</span> ex.set(e);<a name="line.498"></a>
+<span class="sourceLineNo">499</span> }<a name="line.499"></a>
+<span class="sourceLineNo">500</span><a name="line.500"></a>
+<span class="sourceLineNo">501</span>
super.replicate(replicateContext);<a name="line.501"></a>
+<span class="sourceLineNo">502</span> LOG.info("Replicated " +
Bytes.toString(row) + ", count=" + replicateCount.get());<a name="line.502"></a>
+<span class="sourceLineNo">503</span><a name="line.503"></a>
+<span class="sourceLineNo">504</span> replicated.set(replicateCount.get()
> COUNT); // first 10 times, we return false<a name="line.504"></a>
+<span class="sourceLineNo">505</span> return replicated.get();<a
name="line.505"></a>
+<span class="sourceLineNo">506</span> }<a name="line.506"></a>
+<span class="sourceLineNo">507</span> }<a name="line.507"></a>
<span class="sourceLineNo">508</span><a name="line.508"></a>
-<span class="sourceLineNo">509</span> @Override<a name="line.509"></a>
-<span class="sourceLineNo">510</span> public boolean
replicate(ReplicateContext replicateContext) {<a name="line.510"></a>
-<span class="sourceLineNo">511</span> try {<a name="line.511"></a>
-<span class="sourceLineNo">512</span>
super.replicate(replicateContext);<a name="line.512"></a>
-<span class="sourceLineNo">513</span> doAssert(row);<a
name="line.513"></a>
-<span class="sourceLineNo">514</span> } catch (Exception e) {<a
name="line.514"></a>
-<span class="sourceLineNo">515</span> ex.set(e);<a name="line.515"></a>
-<span class="sourceLineNo">516</span> }<a name="line.516"></a>
-<span class="sourceLineNo">517</span> return true;<a name="line.517"></a>
-<span class="sourceLineNo">518</span> }<a name="line.518"></a>
-<span class="sourceLineNo">519</span><a name="line.519"></a>
-<span class="sourceLineNo">520</span> @Override<a name="line.520"></a>
-<span class="sourceLineNo">521</span> public WALEntryFilter
getWALEntryfilter() {<a name="line.521"></a>
-<span class="sourceLineNo">522</span> return new
ChainWALEntryFilter(super.getWALEntryfilter(), new WALEntryFilter() {<a
name="line.522"></a>
-<span class="sourceLineNo">523</span> @Override<a name="line.523"></a>
-<span class="sourceLineNo">524</span> public Entry filter(Entry entry)
{<a name="line.524"></a>
-<span class="sourceLineNo">525</span> ArrayList<Cell> cells =
entry.getEdit().getCells();<a name="line.525"></a>
-<span class="sourceLineNo">526</span> int size = cells.size();<a
name="line.526"></a>
-<span class="sourceLineNo">527</span> for (int i = size-1; i >= 0;
i--) {<a name="line.527"></a>
-<span class="sourceLineNo">528</span> Cell cell = cells.get(i);<a
name="line.528"></a>
-<span class="sourceLineNo">529</span> if
(!Bytes.equals(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),<a
name="line.529"></a>
-<span class="sourceLineNo">530</span> row, 0, row.length)) {<a
name="line.530"></a>
-<span class="sourceLineNo">531</span> cells.remove(i);<a
name="line.531"></a>
-<span class="sourceLineNo">532</span> }<a name="line.532"></a>
-<span class="sourceLineNo">533</span> }<a name="line.533"></a>
-<span class="sourceLineNo">534</span> return entry;<a
name="line.534"></a>
-<span class="sourceLineNo">535</span> }<a name="line.535"></a>
-<span class="sourceLineNo">536</span> });<a name="line.536"></a>
-<span class="sourceLineNo">537</span> }<a name="line.537"></a>
-<span class="sourceLineNo">538</span> }<a name="line.538"></a>
-<span class="sourceLineNo">539</span><a name="line.539"></a>
-<span class="sourceLineNo">540</span> public static class
EverythingPassesWALEntryFilter implements WALEntryFilter {<a
name="line.540"></a>
-<span class="sourceLineNo">541</span> private static boolean passedEntry =
false;<a name="line.541"></a>
-<span class="sourceLineNo">542</span> @Override<a name="line.542"></a>
-<span class="sourceLineNo">543</span> public Entry filter(Entry entry) {<a
name="line.543"></a>
-<span class="sourceLineNo">544</span> passedEntry = true;<a
name="line.544"></a>
-<span class="sourceLineNo">545</span> return entry;<a name="line.545"></a>
-<span class="sourceLineNo">546</span> }<a name="line.546"></a>
-<span class="sourceLineNo">547</span><a name="line.547"></a>
-<span class="sourceLineNo">548</span> public static boolean
hasPassedAnEntry(){<a name="line.548"></a>
-<span class="sourceLineNo">549</span> return passedEntry;<a
name="line.549"></a>
+<span class="sourceLineNo">509</span> // return a WALEntry filter which only
accepts "row", but not other rows<a name="line.509"></a>
+<span class="sourceLineNo">510</span> public static class
ReplicationEndpointWithWALEntryFilter extends ReplicationEndpointForTest {<a
name="line.510"></a>
+<span class="sourceLineNo">511</span> static
AtomicReference<Exception> ex = new AtomicReference<>(null);<a
name="line.511"></a>
+<span class="sourceLineNo">512</span><a name="line.512"></a>
+<span class="sourceLineNo">513</span> @Override<a name="line.513"></a>
+<span class="sourceLineNo">514</span> public boolean
replicate(ReplicateContext replicateContext) {<a name="line.514"></a>
+<span class="sourceLineNo">515</span> try {<a name="line.515"></a>
+<span class="sourceLineNo">516</span>
super.replicate(replicateContext);<a name="line.516"></a>
+<span class="sourceLineNo">517</span> doAssert(row);<a
name="line.517"></a>
+<span class="sourceLineNo">518</span> } catch (Exception e) {<a
name="line.518"></a>
+<span class="sourceLineNo">519</span> ex.set(e);<a name="line.519"></a>
+<span class="sourceLineNo">520</span> }<a name="line.520"></a>
+<span class="sourceLineNo">521</span> return true;<a name="line.521"></a>
+<span class="sourceLineNo">522</span> }<a name="line.522"></a>
+<span class="sourceLineNo">523</span><a name="line.523"></a>
+<span class="sourceLineNo">524</span> @Override<a name="line.524"></a>
+<span class="sourceLineNo">525</span> public WALEntryFilter
getWALEntryfilter() {<a name="line.525"></a>
+<span class="sourceLineNo">526</span> return new
ChainWALEntryFilter(super.getWALEntryfilter(), new WALEntryFilter() {<a
name="line.526"></a>
+<span class="sourceLineNo">527</span> @Override<a name="line.527"></a>
+<span class="sourceLineNo">528</span> public Entry filter(Entry entry)
{<a name="line.528"></a>
+<span class="sourceLineNo">529</span> ArrayList<Cell> cells =
entry.getEdit().getCells();<a name="line.529"></a>
+<span class="sourceLineNo">530</span> int size = cells.size();<a
name="line.530"></a>
+<span class="sourceLineNo">531</span> for (int i = size-1; i >= 0;
i--) {<a name="line.531"></a>
+<span class="sourceLineNo">532</span> Cell cell = cells.get(i);<a
name="line.532"></a>
+<span class="sourceLineNo">533</span> if
(!Bytes.equals(cell.getRowArray(), cell.getRowOffset(), cell.getRowLength(),<a
name="line.533"></a>
+<span class="sourceLineNo">534</span> row, 0, row.length)) {<a
name="line.534"></a>
+<span class="sourceLineNo">535</span> cells.remove(i);<a
name="line.535"></a>
+<span class="sourceLineNo">536</span> }<a name="line.536"></a>
+<span class="sourceLineNo">537</span> }<a name="line.537"></a>
+<span class="sourceLineNo">538</span> return entry;<a
name="line.538"></a>
+<span class="sourceLineNo">539</span> }<a name="line.539"></a>
+<span class="sourceLineNo">540</span> });<a name="line.540"></a>
+<span class="sourceLineNo">541</span> }<a name="line.541"></a>
+<span class="sourceLineNo">542</span> }<a name="line.542"></a>
+<span class="sourceLineNo">543</span><a name="line.543"></a>
+<span class="sourceLineNo">544</span> public static class
EverythingPassesWALEntryFilter implements WALEntryFilter {<a
name="line.544"></a>
+<span class="sourceLineNo">545</span> private static boolean passedEntry =
false;<a name="line.545"></a>
+<span class="sourceLineNo">546</span> @Override<a name="line.546"></a>
+<span class="sourceLineNo">547</span> public Entry filter(Entry entry) {<a
name="line.547"></a>
+<span class="sourceLineNo">548</span> passedEntry = true;<a
name="line.548"></a>
+<span class="sourceLineNo">549</span> return entry;<a name="line.549"></a>
<span class="sourceLineNo">550</span> }<a name="line.550"></a>
-<span class="sourceLineNo">551</span> }<a name="line.551"></a>
-<span class="sourceLineNo">552</span><a name="line.552"></a>
-<span class="sourceLineNo">553</span> public static class
EverythingPassesWALEntryFilterSubclass extends EverythingPassesWALEntryFilter
{<a name="line.553"></a>
-<span class="sourceLineNo">554</span><a name="line.554"></a>
+<span class="sourceLineNo">551</span><a name="line.551"></a>
+<span class="sourceLineNo">552</span> public static boolean
hasPassedAnEntry(){<a name="line.552"></a>
+<span class="sourceLineNo">553</span> return passedEntry;<a
name="line.553"></a>
+<span class="sourceLineNo">554</span> }<a name="line.554"></a>
<span class="sourceLineNo">555</span> }<a name="line.555"></a>
-<span class="sourceLineNo">556</span>}<a name="line.556"></a>
+<span class="sourceLineNo">556</span><a name="line.556"></a>
+<span class="sourceLineNo">557</span> public static class
EverythingPassesWALEntryFilterSubclass extends EverythingPassesWALEntryFilter
{<a name="line.557"></a>
+<span class="sourceLineNo">558</span><a name="line.558"></a>
+<span class="sourceLineNo">559</span> }<a name="line.559"></a>
+<span class="sourceLineNo">560</span>}<a name="line.560"></a>