http://git-wip-us.apache.org/repos/asf/hbase-site/blob/a610f23a/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.html
----------------------------------------------------------------------
diff --git
a/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.html
b/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.html
index 3cead14..f01b6d1 100644
---
a/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.html
+++
b/testdevapidocs/src-html/org/apache/hadoop/hbase/replication/TestReplicationDroppedTables.html
@@ -127,178 +127,184 @@
<span class="sourceLineNo">119</span>
admin2.createNamespace(NamespaceDescriptor.create("NS").build());<a
name="line.119"></a>
<span class="sourceLineNo">120</span> }<a name="line.120"></a>
<span class="sourceLineNo">121</span> testEditsBehindDroppedTable(true,
"NS:test_dropped");<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> private void
testEditsBehindDroppedTable(boolean allowProceeding, String tName) throws
Exception {<a name="line.124"></a>
-<span class="sourceLineNo">125</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY,
allowProceeding);<a name="line.125"></a>
-<span class="sourceLineNo">126</span>
conf1.setInt(HConstants.REPLICATION_SOURCE_MAXTHREADS_KEY, 1);<a
name="line.126"></a>
-<span class="sourceLineNo">127</span><a name="line.127"></a>
-<span class="sourceLineNo">128</span> // make sure we have a single region
server only, so that all<a name="line.128"></a>
-<span class="sourceLineNo">129</span> // edits for all tables go there<a
name="line.129"></a>
-<span class="sourceLineNo">130</span>
utility1.shutdownMiniHBaseCluster();<a name="line.130"></a>
-<span class="sourceLineNo">131</span> utility1.startMiniHBaseCluster(1,
1);<a name="line.131"></a>
-<span class="sourceLineNo">132</span><a name="line.132"></a>
-<span class="sourceLineNo">133</span> TableName tablename =
TableName.valueOf(tName);<a name="line.133"></a>
-<span class="sourceLineNo">134</span> byte[] familyname =
Bytes.toBytes("fam");<a name="line.134"></a>
-<span class="sourceLineNo">135</span> byte[] row = Bytes.toBytes("row");<a
name="line.135"></a>
-<span class="sourceLineNo">136</span><a name="line.136"></a>
-<span class="sourceLineNo">137</span> HTableDescriptor table = new
HTableDescriptor(tablename);<a name="line.137"></a>
-<span class="sourceLineNo">138</span> HColumnDescriptor fam = new
HColumnDescriptor(familyname);<a name="line.138"></a>
-<span class="sourceLineNo">139</span>
fam.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);<a name="line.139"></a>
-<span class="sourceLineNo">140</span> table.addFamily(fam);<a
name="line.140"></a>
-<span class="sourceLineNo">141</span><a name="line.141"></a>
-<span class="sourceLineNo">142</span> Connection connection1 =
ConnectionFactory.createConnection(conf1);<a name="line.142"></a>
-<span class="sourceLineNo">143</span> Connection connection2 =
ConnectionFactory.createConnection(conf2);<a name="line.143"></a>
-<span class="sourceLineNo">144</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.144"></a>
-<span class="sourceLineNo">145</span> admin1.createTable(table);<a
name="line.145"></a>
-<span class="sourceLineNo">146</span> }<a name="line.146"></a>
-<span class="sourceLineNo">147</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.147"></a>
-<span class="sourceLineNo">148</span> admin2.createTable(table);<a
name="line.148"></a>
-<span class="sourceLineNo">149</span> }<a name="line.149"></a>
-<span class="sourceLineNo">150</span>
utility1.waitUntilAllRegionsAssigned(tablename);<a name="line.150"></a>
-<span class="sourceLineNo">151</span>
utility2.waitUntilAllRegionsAssigned(tablename);<a name="line.151"></a>
-<span class="sourceLineNo">152</span><a name="line.152"></a>
-<span class="sourceLineNo">153</span> Table lHtable1 =
utility1.getConnection().getTable(tablename);<a name="line.153"></a>
-<span class="sourceLineNo">154</span><a name="line.154"></a>
-<span class="sourceLineNo">155</span> // now suspend replication<a
name="line.155"></a>
-<span class="sourceLineNo">156</span> admin.disablePeer("2");<a
name="line.156"></a>
-<span class="sourceLineNo">157</span><a name="line.157"></a>
-<span class="sourceLineNo">158</span> // put some data (lead with 0 so the
edit gets sorted before the other table's edits<a name="line.158"></a>
-<span class="sourceLineNo">159</span> // in the replication batch)<a
name="line.159"></a>
-<span class="sourceLineNo">160</span> // write a bunch of edits, making
sure we fill a batch<a name="line.160"></a>
-<span class="sourceLineNo">161</span> byte[] rowkey = Bytes.toBytes(0+" put
on table to be dropped");<a name="line.161"></a>
-<span class="sourceLineNo">162</span> Put put = new Put(rowkey);<a
name="line.162"></a>
-<span class="sourceLineNo">163</span> put.addColumn(familyname, row,
row);<a name="line.163"></a>
-<span class="sourceLineNo">164</span> lHtable1.put(put);<a
name="line.164"></a>
-<span class="sourceLineNo">165</span><a name="line.165"></a>
-<span class="sourceLineNo">166</span> rowkey = Bytes.toBytes("normal
put");<a name="line.166"></a>
-<span class="sourceLineNo">167</span> put = new Put(rowkey);<a
name="line.167"></a>
-<span class="sourceLineNo">168</span> put.addColumn(famName, row, row);<a
name="line.168"></a>
-<span class="sourceLineNo">169</span> htable1.put(put);<a
name="line.169"></a>
-<span class="sourceLineNo">170</span><a name="line.170"></a>
-<span class="sourceLineNo">171</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.171"></a>
-<span class="sourceLineNo">172</span> admin1.disableTable(tablename);<a
name="line.172"></a>
-<span class="sourceLineNo">173</span> admin1.deleteTable(tablename);<a
name="line.173"></a>
-<span class="sourceLineNo">174</span> }<a name="line.174"></a>
-<span class="sourceLineNo">175</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.175"></a>
-<span class="sourceLineNo">176</span> admin2.disableTable(tablename);<a
name="line.176"></a>
-<span class="sourceLineNo">177</span> admin2.deleteTable(tablename);<a
name="line.177"></a>
-<span class="sourceLineNo">178</span> }<a name="line.178"></a>
-<span class="sourceLineNo">179</span><a name="line.179"></a>
-<span class="sourceLineNo">180</span> admin.enablePeer("2");<a
name="line.180"></a>
-<span class="sourceLineNo">181</span> if (allowProceeding) {<a
name="line.181"></a>
-<span class="sourceLineNo">182</span> // in this we'd expect the key to
make it over<a name="line.182"></a>
-<span class="sourceLineNo">183</span>
verifyReplicationProceeded(rowkey);<a name="line.183"></a>
-<span class="sourceLineNo">184</span> } else {<a name="line.184"></a>
-<span class="sourceLineNo">185</span> verifyReplicationStuck(rowkey);<a
name="line.185"></a>
-<span class="sourceLineNo">186</span> }<a name="line.186"></a>
-<span class="sourceLineNo">187</span> // just to be safe<a
name="line.187"></a>
-<span class="sourceLineNo">188</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY, false);<a
name="line.188"></a>
-<span class="sourceLineNo">189</span> }<a name="line.189"></a>
-<span class="sourceLineNo">190</span><a name="line.190"></a>
-<span class="sourceLineNo">191</span> @Test<a name="line.191"></a>
-<span class="sourceLineNo">192</span> public void
testEditsBehindDroppedTableTiming() throws Exception {<a name="line.192"></a>
-<span class="sourceLineNo">193</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY, true);<a
name="line.193"></a>
-<span class="sourceLineNo">194</span>
conf1.setInt(HConstants.REPLICATION_SOURCE_MAXTHREADS_KEY, 1);<a
name="line.194"></a>
-<span class="sourceLineNo">195</span><a name="line.195"></a>
-<span class="sourceLineNo">196</span> // make sure we have a single region
server only, so that all<a name="line.196"></a>
-<span class="sourceLineNo">197</span> // edits for all tables go there<a
name="line.197"></a>
-<span class="sourceLineNo">198</span>
utility1.shutdownMiniHBaseCluster();<a name="line.198"></a>
-<span class="sourceLineNo">199</span> utility1.startMiniHBaseCluster(1,
1);<a name="line.199"></a>
-<span class="sourceLineNo">200</span><a name="line.200"></a>
-<span class="sourceLineNo">201</span> TableName tablename =
TableName.valueOf("testdroppedtimed");<a name="line.201"></a>
-<span class="sourceLineNo">202</span> byte[] familyname =
Bytes.toBytes("fam");<a name="line.202"></a>
-<span class="sourceLineNo">203</span> byte[] row = Bytes.toBytes("row");<a
name="line.203"></a>
-<span class="sourceLineNo">204</span><a name="line.204"></a>
-<span class="sourceLineNo">205</span> HTableDescriptor table = new
HTableDescriptor(tablename);<a name="line.205"></a>
-<span class="sourceLineNo">206</span> HColumnDescriptor fam = new
HColumnDescriptor(familyname);<a name="line.206"></a>
-<span class="sourceLineNo">207</span>
fam.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);<a name="line.207"></a>
-<span class="sourceLineNo">208</span> table.addFamily(fam);<a
name="line.208"></a>
-<span class="sourceLineNo">209</span><a name="line.209"></a>
-<span class="sourceLineNo">210</span> Connection connection1 =
ConnectionFactory.createConnection(conf1);<a name="line.210"></a>
-<span class="sourceLineNo">211</span> Connection connection2 =
ConnectionFactory.createConnection(conf2);<a name="line.211"></a>
-<span class="sourceLineNo">212</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.212"></a>
-<span class="sourceLineNo">213</span> admin1.createTable(table);<a
name="line.213"></a>
-<span class="sourceLineNo">214</span> }<a name="line.214"></a>
-<span class="sourceLineNo">215</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.215"></a>
-<span class="sourceLineNo">216</span> admin2.createTable(table);<a
name="line.216"></a>
-<span class="sourceLineNo">217</span> }<a name="line.217"></a>
-<span class="sourceLineNo">218</span>
utility1.waitUntilAllRegionsAssigned(tablename);<a name="line.218"></a>
-<span class="sourceLineNo">219</span>
utility2.waitUntilAllRegionsAssigned(tablename);<a name="line.219"></a>
-<span class="sourceLineNo">220</span><a name="line.220"></a>
-<span class="sourceLineNo">221</span> Table lHtable1 =
utility1.getConnection().getTable(tablename);<a name="line.221"></a>
-<span class="sourceLineNo">222</span><a name="line.222"></a>
-<span class="sourceLineNo">223</span> // now suspend replication<a
name="line.223"></a>
-<span class="sourceLineNo">224</span> admin.disablePeer("2");<a
name="line.224"></a>
-<span class="sourceLineNo">225</span><a name="line.225"></a>
-<span class="sourceLineNo">226</span> // put some data (lead with 0 so the
edit gets sorted before the other table's edits<a name="line.226"></a>
-<span class="sourceLineNo">227</span> // in the replication batch)<a
name="line.227"></a>
-<span class="sourceLineNo">228</span> // write a bunch of edits, making
sure we fill a batch<a name="line.228"></a>
-<span class="sourceLineNo">229</span> byte[] rowkey = Bytes.toBytes(0+" put
on table to be dropped");<a name="line.229"></a>
-<span class="sourceLineNo">230</span> Put put = new Put(rowkey);<a
name="line.230"></a>
-<span class="sourceLineNo">231</span> put.addColumn(familyname, row,
row);<a name="line.231"></a>
-<span class="sourceLineNo">232</span> lHtable1.put(put);<a
name="line.232"></a>
-<span class="sourceLineNo">233</span><a name="line.233"></a>
-<span class="sourceLineNo">234</span> rowkey = Bytes.toBytes("normal
put");<a name="line.234"></a>
-<span class="sourceLineNo">235</span> put = new Put(rowkey);<a
name="line.235"></a>
-<span class="sourceLineNo">236</span> put.addColumn(famName, row, row);<a
name="line.236"></a>
-<span class="sourceLineNo">237</span> htable1.put(put);<a
name="line.237"></a>
-<span class="sourceLineNo">238</span><a name="line.238"></a>
-<span class="sourceLineNo">239</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.239"></a>
-<span class="sourceLineNo">240</span> admin2.disableTable(tablename);<a
name="line.240"></a>
-<span class="sourceLineNo">241</span> admin2.deleteTable(tablename);<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> admin.enablePeer("2");<a
name="line.244"></a>
-<span class="sourceLineNo">245</span> // edit should still be stuck<a
name="line.245"></a>
-<span class="sourceLineNo">246</span><a name="line.246"></a>
-<span class="sourceLineNo">247</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.247"></a>
-<span class="sourceLineNo">248</span> // the source table still exists,
replication should be stalled<a name="line.248"></a>
-<span class="sourceLineNo">249</span> verifyReplicationStuck(rowkey);<a
name="line.249"></a>
-<span class="sourceLineNo">250</span><a name="line.250"></a>
-<span class="sourceLineNo">251</span> admin1.disableTable(tablename);<a
name="line.251"></a>
-<span class="sourceLineNo">252</span> // still stuck, source table still
exists<a name="line.252"></a>
-<span class="sourceLineNo">253</span> verifyReplicationStuck(rowkey);<a
name="line.253"></a>
-<span class="sourceLineNo">254</span><a name="line.254"></a>
-<span class="sourceLineNo">255</span> admin1.deleteTable(tablename);<a
name="line.255"></a>
-<span class="sourceLineNo">256</span> // now the source table is gone,
replication should proceed, the<a name="line.256"></a>
-<span class="sourceLineNo">257</span> // offending edits be dropped<a
name="line.257"></a>
-<span class="sourceLineNo">258</span>
verifyReplicationProceeded(rowkey);<a name="line.258"></a>
-<span class="sourceLineNo">259</span> }<a name="line.259"></a>
-<span class="sourceLineNo">260</span> // just to be safe<a
name="line.260"></a>
-<span class="sourceLineNo">261</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY, false);<a
name="line.261"></a>
-<span class="sourceLineNo">262</span> }<a name="line.262"></a>
-<span class="sourceLineNo">263</span><a name="line.263"></a>
-<span class="sourceLineNo">264</span> private void
verifyReplicationProceeded(byte[] rowkey) throws Exception {<a
name="line.264"></a>
-<span class="sourceLineNo">265</span> Get get = new Get(rowkey);<a
name="line.265"></a>
-<span class="sourceLineNo">266</span> for (int i = 0; i < NB_RETRIES;
i++) {<a name="line.266"></a>
-<span class="sourceLineNo">267</span> if (i==NB_RETRIES-1) {<a
name="line.267"></a>
-<span class="sourceLineNo">268</span> fail("Waited too much time for
put replication");<a name="line.268"></a>
-<span class="sourceLineNo">269</span> }<a name="line.269"></a>
-<span class="sourceLineNo">270</span> Result res = htable2.get(get);<a
name="line.270"></a>
-<span class="sourceLineNo">271</span> if (res.size() == 0) {<a
name="line.271"></a>
-<span class="sourceLineNo">272</span> LOG.info("Row not available");<a
name="line.272"></a>
-<span class="sourceLineNo">273</span> Thread.sleep(SLEEP_TIME);<a
name="line.273"></a>
-<span class="sourceLineNo">274</span> } else {<a name="line.274"></a>
-<span class="sourceLineNo">275</span> assertArrayEquals(res.getRow(),
rowkey);<a name="line.275"></a>
-<span class="sourceLineNo">276</span> break;<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> }<a name="line.279"></a>
-<span class="sourceLineNo">280</span><a name="line.280"></a>
-<span class="sourceLineNo">281</span> private void
verifyReplicationStuck(byte[] rowkey) throws Exception {<a name="line.281"></a>
-<span class="sourceLineNo">282</span> Get get = new Get(rowkey);<a
name="line.282"></a>
-<span class="sourceLineNo">283</span> for (int i = 0; i < NB_RETRIES;
i++) {<a name="line.283"></a>
-<span class="sourceLineNo">284</span> Result res = htable2.get(get);<a
name="line.284"></a>
-<span class="sourceLineNo">285</span> if (res.size() >= 1) {<a
name="line.285"></a>
-<span class="sourceLineNo">286</span> fail("Edit should have been stuck
behind dropped tables");<a name="line.286"></a>
-<span class="sourceLineNo">287</span> } else {<a name="line.287"></a>
-<span class="sourceLineNo">288</span> LOG.info("Row not replicated,
let's wait a bit more...");<a name="line.288"></a>
-<span class="sourceLineNo">289</span> Thread.sleep(SLEEP_TIME);<a
name="line.289"></a>
-<span class="sourceLineNo">290</span> }<a name="line.290"></a>
-<span class="sourceLineNo">291</span> }<a name="line.291"></a>
-<span class="sourceLineNo">292</span> }<a name="line.292"></a>
-<span class="sourceLineNo">293</span>}<a name="line.293"></a>
+<span class="sourceLineNo">122</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.122"></a>
+<span class="sourceLineNo">123</span> admin1.deleteNamespace("NS");<a
name="line.123"></a>
+<span class="sourceLineNo">124</span> }<a name="line.124"></a>
+<span class="sourceLineNo">125</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.125"></a>
+<span class="sourceLineNo">126</span> admin2.deleteNamespace("NS");<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><a name="line.129"></a>
+<span class="sourceLineNo">130</span> private void
testEditsBehindDroppedTable(boolean allowProceeding, String tName) throws
Exception {<a name="line.130"></a>
+<span class="sourceLineNo">131</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY,
allowProceeding);<a name="line.131"></a>
+<span class="sourceLineNo">132</span>
conf1.setInt(HConstants.REPLICATION_SOURCE_MAXTHREADS_KEY, 1);<a
name="line.132"></a>
+<span class="sourceLineNo">133</span><a name="line.133"></a>
+<span class="sourceLineNo">134</span> // make sure we have a single region
server only, so that all<a name="line.134"></a>
+<span class="sourceLineNo">135</span> // edits for all tables go there<a
name="line.135"></a>
+<span class="sourceLineNo">136</span>
utility1.shutdownMiniHBaseCluster();<a name="line.136"></a>
+<span class="sourceLineNo">137</span> utility1.startMiniHBaseCluster(1,
1);<a name="line.137"></a>
+<span class="sourceLineNo">138</span><a name="line.138"></a>
+<span class="sourceLineNo">139</span> TableName tablename =
TableName.valueOf(tName);<a name="line.139"></a>
+<span class="sourceLineNo">140</span> byte[] familyname =
Bytes.toBytes("fam");<a name="line.140"></a>
+<span class="sourceLineNo">141</span> byte[] row = Bytes.toBytes("row");<a
name="line.141"></a>
+<span class="sourceLineNo">142</span><a name="line.142"></a>
+<span class="sourceLineNo">143</span> HTableDescriptor table = new
HTableDescriptor(tablename);<a name="line.143"></a>
+<span class="sourceLineNo">144</span> HColumnDescriptor fam = new
HColumnDescriptor(familyname);<a name="line.144"></a>
+<span class="sourceLineNo">145</span>
fam.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);<a name="line.145"></a>
+<span class="sourceLineNo">146</span> table.addFamily(fam);<a
name="line.146"></a>
+<span class="sourceLineNo">147</span><a name="line.147"></a>
+<span class="sourceLineNo">148</span> Connection connection1 =
ConnectionFactory.createConnection(conf1);<a name="line.148"></a>
+<span class="sourceLineNo">149</span> Connection connection2 =
ConnectionFactory.createConnection(conf2);<a name="line.149"></a>
+<span class="sourceLineNo">150</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.150"></a>
+<span class="sourceLineNo">151</span> admin1.createTable(table);<a
name="line.151"></a>
+<span class="sourceLineNo">152</span> }<a name="line.152"></a>
+<span class="sourceLineNo">153</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.153"></a>
+<span class="sourceLineNo">154</span> admin2.createTable(table);<a
name="line.154"></a>
+<span class="sourceLineNo">155</span> }<a name="line.155"></a>
+<span class="sourceLineNo">156</span>
utility1.waitUntilAllRegionsAssigned(tablename);<a name="line.156"></a>
+<span class="sourceLineNo">157</span>
utility2.waitUntilAllRegionsAssigned(tablename);<a name="line.157"></a>
+<span class="sourceLineNo">158</span><a name="line.158"></a>
+<span class="sourceLineNo">159</span> Table lHtable1 =
utility1.getConnection().getTable(tablename);<a name="line.159"></a>
+<span class="sourceLineNo">160</span><a name="line.160"></a>
+<span class="sourceLineNo">161</span> // now suspend replication<a
name="line.161"></a>
+<span class="sourceLineNo">162</span> admin.disablePeer("2");<a
name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span> // put some data (lead with 0 so the
edit gets sorted before the other table's edits<a name="line.164"></a>
+<span class="sourceLineNo">165</span> // in the replication batch)<a
name="line.165"></a>
+<span class="sourceLineNo">166</span> // write a bunch of edits, making
sure we fill a batch<a name="line.166"></a>
+<span class="sourceLineNo">167</span> byte[] rowkey = Bytes.toBytes(0+" put
on table to be dropped");<a name="line.167"></a>
+<span class="sourceLineNo">168</span> Put put = new Put(rowkey);<a
name="line.168"></a>
+<span class="sourceLineNo">169</span> put.addColumn(familyname, row,
row);<a name="line.169"></a>
+<span class="sourceLineNo">170</span> lHtable1.put(put);<a
name="line.170"></a>
+<span class="sourceLineNo">171</span><a name="line.171"></a>
+<span class="sourceLineNo">172</span> rowkey = Bytes.toBytes("normal
put");<a name="line.172"></a>
+<span class="sourceLineNo">173</span> put = new Put(rowkey);<a
name="line.173"></a>
+<span class="sourceLineNo">174</span> put.addColumn(famName, row, row);<a
name="line.174"></a>
+<span class="sourceLineNo">175</span> htable1.put(put);<a
name="line.175"></a>
+<span class="sourceLineNo">176</span><a name="line.176"></a>
+<span class="sourceLineNo">177</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.177"></a>
+<span class="sourceLineNo">178</span> admin1.disableTable(tablename);<a
name="line.178"></a>
+<span class="sourceLineNo">179</span> admin1.deleteTable(tablename);<a
name="line.179"></a>
+<span class="sourceLineNo">180</span> }<a name="line.180"></a>
+<span class="sourceLineNo">181</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.181"></a>
+<span class="sourceLineNo">182</span> admin2.disableTable(tablename);<a
name="line.182"></a>
+<span class="sourceLineNo">183</span> admin2.deleteTable(tablename);<a
name="line.183"></a>
+<span class="sourceLineNo">184</span> }<a name="line.184"></a>
+<span class="sourceLineNo">185</span><a name="line.185"></a>
+<span class="sourceLineNo">186</span> admin.enablePeer("2");<a
name="line.186"></a>
+<span class="sourceLineNo">187</span> if (allowProceeding) {<a
name="line.187"></a>
+<span class="sourceLineNo">188</span> // in this we'd expect the key to
make it over<a name="line.188"></a>
+<span class="sourceLineNo">189</span>
verifyReplicationProceeded(rowkey);<a name="line.189"></a>
+<span class="sourceLineNo">190</span> } else {<a name="line.190"></a>
+<span class="sourceLineNo">191</span> verifyReplicationStuck(rowkey);<a
name="line.191"></a>
+<span class="sourceLineNo">192</span> }<a name="line.192"></a>
+<span class="sourceLineNo">193</span> // just to be safe<a
name="line.193"></a>
+<span class="sourceLineNo">194</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY, false);<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> @Test<a name="line.197"></a>
+<span class="sourceLineNo">198</span> public void
testEditsBehindDroppedTableTiming() throws Exception {<a name="line.198"></a>
+<span class="sourceLineNo">199</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY, true);<a
name="line.199"></a>
+<span class="sourceLineNo">200</span>
conf1.setInt(HConstants.REPLICATION_SOURCE_MAXTHREADS_KEY, 1);<a
name="line.200"></a>
+<span class="sourceLineNo">201</span><a name="line.201"></a>
+<span class="sourceLineNo">202</span> // make sure we have a single region
server only, so that all<a name="line.202"></a>
+<span class="sourceLineNo">203</span> // edits for all tables go there<a
name="line.203"></a>
+<span class="sourceLineNo">204</span>
utility1.shutdownMiniHBaseCluster();<a name="line.204"></a>
+<span class="sourceLineNo">205</span> utility1.startMiniHBaseCluster(1,
1);<a name="line.205"></a>
+<span class="sourceLineNo">206</span><a name="line.206"></a>
+<span class="sourceLineNo">207</span> TableName tablename =
TableName.valueOf("testdroppedtimed");<a name="line.207"></a>
+<span class="sourceLineNo">208</span> byte[] familyname =
Bytes.toBytes("fam");<a name="line.208"></a>
+<span class="sourceLineNo">209</span> byte[] row = Bytes.toBytes("row");<a
name="line.209"></a>
+<span class="sourceLineNo">210</span><a name="line.210"></a>
+<span class="sourceLineNo">211</span> HTableDescriptor table = new
HTableDescriptor(tablename);<a name="line.211"></a>
+<span class="sourceLineNo">212</span> HColumnDescriptor fam = new
HColumnDescriptor(familyname);<a name="line.212"></a>
+<span class="sourceLineNo">213</span>
fam.setScope(HConstants.REPLICATION_SCOPE_GLOBAL);<a name="line.213"></a>
+<span class="sourceLineNo">214</span> table.addFamily(fam);<a
name="line.214"></a>
+<span class="sourceLineNo">215</span><a name="line.215"></a>
+<span class="sourceLineNo">216</span> Connection connection1 =
ConnectionFactory.createConnection(conf1);<a name="line.216"></a>
+<span class="sourceLineNo">217</span> Connection connection2 =
ConnectionFactory.createConnection(conf2);<a name="line.217"></a>
+<span class="sourceLineNo">218</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.218"></a>
+<span class="sourceLineNo">219</span> admin1.createTable(table);<a
name="line.219"></a>
+<span class="sourceLineNo">220</span> }<a name="line.220"></a>
+<span class="sourceLineNo">221</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.221"></a>
+<span class="sourceLineNo">222</span> admin2.createTable(table);<a
name="line.222"></a>
+<span class="sourceLineNo">223</span> }<a name="line.223"></a>
+<span class="sourceLineNo">224</span>
utility1.waitUntilAllRegionsAssigned(tablename);<a name="line.224"></a>
+<span class="sourceLineNo">225</span>
utility2.waitUntilAllRegionsAssigned(tablename);<a name="line.225"></a>
+<span class="sourceLineNo">226</span><a name="line.226"></a>
+<span class="sourceLineNo">227</span> Table lHtable1 =
utility1.getConnection().getTable(tablename);<a name="line.227"></a>
+<span class="sourceLineNo">228</span><a name="line.228"></a>
+<span class="sourceLineNo">229</span> // now suspend replication<a
name="line.229"></a>
+<span class="sourceLineNo">230</span> admin.disablePeer("2");<a
name="line.230"></a>
+<span class="sourceLineNo">231</span><a name="line.231"></a>
+<span class="sourceLineNo">232</span> // put some data (lead with 0 so the
edit gets sorted before the other table's edits<a name="line.232"></a>
+<span class="sourceLineNo">233</span> // in the replication batch)<a
name="line.233"></a>
+<span class="sourceLineNo">234</span> // write a bunch of edits, making
sure we fill a batch<a name="line.234"></a>
+<span class="sourceLineNo">235</span> byte[] rowkey = Bytes.toBytes(0+" put
on table to be dropped");<a name="line.235"></a>
+<span class="sourceLineNo">236</span> Put put = new Put(rowkey);<a
name="line.236"></a>
+<span class="sourceLineNo">237</span> put.addColumn(familyname, row,
row);<a name="line.237"></a>
+<span class="sourceLineNo">238</span> lHtable1.put(put);<a
name="line.238"></a>
+<span class="sourceLineNo">239</span><a name="line.239"></a>
+<span class="sourceLineNo">240</span> rowkey = Bytes.toBytes("normal
put");<a name="line.240"></a>
+<span class="sourceLineNo">241</span> put = new Put(rowkey);<a
name="line.241"></a>
+<span class="sourceLineNo">242</span> put.addColumn(famName, row, row);<a
name="line.242"></a>
+<span class="sourceLineNo">243</span> htable1.put(put);<a
name="line.243"></a>
+<span class="sourceLineNo">244</span><a name="line.244"></a>
+<span class="sourceLineNo">245</span> try (Admin admin2 =
connection2.getAdmin()) {<a name="line.245"></a>
+<span class="sourceLineNo">246</span> admin2.disableTable(tablename);<a
name="line.246"></a>
+<span class="sourceLineNo">247</span> admin2.deleteTable(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> admin.enablePeer("2");<a
name="line.250"></a>
+<span class="sourceLineNo">251</span> // edit should still be stuck<a
name="line.251"></a>
+<span class="sourceLineNo">252</span><a name="line.252"></a>
+<span class="sourceLineNo">253</span> try (Admin admin1 =
connection1.getAdmin()) {<a name="line.253"></a>
+<span class="sourceLineNo">254</span> // the source table still exists,
replication should be stalled<a name="line.254"></a>
+<span class="sourceLineNo">255</span> verifyReplicationStuck(rowkey);<a
name="line.255"></a>
+<span class="sourceLineNo">256</span><a name="line.256"></a>
+<span class="sourceLineNo">257</span> admin1.disableTable(tablename);<a
name="line.257"></a>
+<span class="sourceLineNo">258</span> // still stuck, source table still
exists<a name="line.258"></a>
+<span class="sourceLineNo">259</span> verifyReplicationStuck(rowkey);<a
name="line.259"></a>
+<span class="sourceLineNo">260</span><a name="line.260"></a>
+<span class="sourceLineNo">261</span> admin1.deleteTable(tablename);<a
name="line.261"></a>
+<span class="sourceLineNo">262</span> // now the source table is gone,
replication should proceed, the<a name="line.262"></a>
+<span class="sourceLineNo">263</span> // offending edits be dropped<a
name="line.263"></a>
+<span class="sourceLineNo">264</span>
verifyReplicationProceeded(rowkey);<a name="line.264"></a>
+<span class="sourceLineNo">265</span> }<a name="line.265"></a>
+<span class="sourceLineNo">266</span> // just to be safe<a
name="line.266"></a>
+<span class="sourceLineNo">267</span>
conf1.setBoolean(HConstants.REPLICATION_DROP_ON_DELETED_TABLE_KEY, false);<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
verifyReplicationProceeded(byte[] rowkey) throws Exception {<a
name="line.270"></a>
+<span class="sourceLineNo">271</span> Get get = new Get(rowkey);<a
name="line.271"></a>
+<span class="sourceLineNo">272</span> for (int i = 0; i < NB_RETRIES;
i++) {<a name="line.272"></a>
+<span class="sourceLineNo">273</span> if (i==NB_RETRIES-1) {<a
name="line.273"></a>
+<span class="sourceLineNo">274</span> fail("Waited too much time for
put replication");<a name="line.274"></a>
+<span class="sourceLineNo">275</span> }<a name="line.275"></a>
+<span class="sourceLineNo">276</span> Result res = htable2.get(get);<a
name="line.276"></a>
+<span class="sourceLineNo">277</span> if (res.size() == 0) {<a
name="line.277"></a>
+<span class="sourceLineNo">278</span> LOG.info("Row not available");<a
name="line.278"></a>
+<span class="sourceLineNo">279</span> Thread.sleep(SLEEP_TIME);<a
name="line.279"></a>
+<span class="sourceLineNo">280</span> } else {<a name="line.280"></a>
+<span class="sourceLineNo">281</span> assertArrayEquals(res.getRow(),
rowkey);<a name="line.281"></a>
+<span class="sourceLineNo">282</span> break;<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> }<a name="line.285"></a>
+<span class="sourceLineNo">286</span><a name="line.286"></a>
+<span class="sourceLineNo">287</span> private void
verifyReplicationStuck(byte[] rowkey) throws Exception {<a name="line.287"></a>
+<span class="sourceLineNo">288</span> Get get = new Get(rowkey);<a
name="line.288"></a>
+<span class="sourceLineNo">289</span> for (int i = 0; i < NB_RETRIES;
i++) {<a name="line.289"></a>
+<span class="sourceLineNo">290</span> Result res = htable2.get(get);<a
name="line.290"></a>
+<span class="sourceLineNo">291</span> if (res.size() >= 1) {<a
name="line.291"></a>
+<span class="sourceLineNo">292</span> fail("Edit should have been stuck
behind dropped tables");<a name="line.292"></a>
+<span class="sourceLineNo">293</span> } else {<a name="line.293"></a>
+<span class="sourceLineNo">294</span> LOG.info("Row not replicated,
let's wait a bit more...");<a name="line.294"></a>
+<span class="sourceLineNo">295</span> Thread.sleep(SLEEP_TIME);<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>