hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From git-site-r...@apache.org
Subject [13/51] [partial] hbase-site git commit: Published site at .
Date Tue, 15 Aug 2017 15:06:29 GMT
http://git-wip-us.apache.org/repos/asf/hbase-site/blob/07e68d46/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestFromClientSide3.WatiingForScanObserver.html
----------------------------------------------------------------------
diff --git a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestFromClientSide3.WatiingForScanObserver.html b/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestFromClientSide3.WatiingForScanObserver.html
index 528a384..401b413 100644
--- a/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestFromClientSide3.WatiingForScanObserver.html
+++ b/testdevapidocs/src-html/org/apache/hadoop/hbase/client/TestFromClientSide3.WatiingForScanObserver.html
@@ -318,558 +318,604 @@
 <span class="sourceLineNo">310</span>  }<a name="line.310"></a>
 <span class="sourceLineNo">311</span><a name="line.311"></a>
 <span class="sourceLineNo">312</span>  @Test<a name="line.312"></a>
-<span class="sourceLineNo">313</span>  public void testHTableExistsMethodSingleRegionSingleGet() throws Exception {<a name="line.313"></a>
-<span class="sourceLineNo">314</span>      // Test with a single region table.<a name="line.314"></a>
-<span class="sourceLineNo">315</span>      Table table = TEST_UTIL.createTable(<a name="line.315"></a>
-<span class="sourceLineNo">316</span>          TableName.valueOf(name.getMethodName()),<a name="line.316"></a>
-<span class="sourceLineNo">317</span>          new byte[][] { FAMILY });<a name="line.317"></a>
-<span class="sourceLineNo">318</span><a name="line.318"></a>
-<span class="sourceLineNo">319</span>    Put put = new Put(ROW);<a name="line.319"></a>
-<span class="sourceLineNo">320</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.320"></a>
-<span class="sourceLineNo">321</span><a name="line.321"></a>
-<span class="sourceLineNo">322</span>    Get get = new Get(ROW);<a name="line.322"></a>
-<span class="sourceLineNo">323</span><a name="line.323"></a>
-<span class="sourceLineNo">324</span>    boolean exist = table.exists(get);<a name="line.324"></a>
-<span class="sourceLineNo">325</span>    assertEquals(exist, false);<a name="line.325"></a>
+<span class="sourceLineNo">313</span>  public void testBatchWithRowMutation() throws Exception {<a name="line.313"></a>
+<span class="sourceLineNo">314</span>    LOG.info("Starting testBatchWithRowMutation");<a name="line.314"></a>
+<span class="sourceLineNo">315</span>    final TableName TABLENAME = TableName.valueOf("testBatchWithRowMutation");<a name="line.315"></a>
+<span class="sourceLineNo">316</span>    try (Table t = TEST_UTIL.createTable(TABLENAME, FAMILY)) {<a name="line.316"></a>
+<span class="sourceLineNo">317</span>      byte [][] QUALIFIERS = new byte [][] {<a name="line.317"></a>
+<span class="sourceLineNo">318</span>        Bytes.toBytes("a"), Bytes.toBytes("b")<a name="line.318"></a>
+<span class="sourceLineNo">319</span>      };<a name="line.319"></a>
+<span class="sourceLineNo">320</span>      RowMutations arm = new RowMutations(ROW);<a name="line.320"></a>
+<span class="sourceLineNo">321</span>      Put p = new Put(ROW);<a name="line.321"></a>
+<span class="sourceLineNo">322</span>      p.addColumn(FAMILY, QUALIFIERS[0], VALUE);<a name="line.322"></a>
+<span class="sourceLineNo">323</span>      arm.add(p);<a name="line.323"></a>
+<span class="sourceLineNo">324</span>      Object[] batchResult = new Object[1];<a name="line.324"></a>
+<span class="sourceLineNo">325</span>      t.batch(Arrays.asList(arm), batchResult);<a name="line.325"></a>
 <span class="sourceLineNo">326</span><a name="line.326"></a>
-<span class="sourceLineNo">327</span>    table.put(put);<a name="line.327"></a>
-<span class="sourceLineNo">328</span><a name="line.328"></a>
-<span class="sourceLineNo">329</span>    exist = table.exists(get);<a name="line.329"></a>
-<span class="sourceLineNo">330</span>    assertEquals(exist, true);<a name="line.330"></a>
-<span class="sourceLineNo">331</span>  }<a name="line.331"></a>
-<span class="sourceLineNo">332</span><a name="line.332"></a>
-<span class="sourceLineNo">333</span>  public void testHTableExistsMethodSingleRegionMultipleGets() throws Exception {<a name="line.333"></a>
-<span class="sourceLineNo">334</span>    Table table = TEST_UTIL.createTable(TableName.valueOf(<a name="line.334"></a>
-<span class="sourceLineNo">335</span>        name.getMethodName()), new byte[][] { FAMILY });<a name="line.335"></a>
-<span class="sourceLineNo">336</span><a name="line.336"></a>
-<span class="sourceLineNo">337</span>    Put put = new Put(ROW);<a name="line.337"></a>
-<span class="sourceLineNo">338</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.338"></a>
-<span class="sourceLineNo">339</span>    table.put(put);<a name="line.339"></a>
-<span class="sourceLineNo">340</span><a name="line.340"></a>
-<span class="sourceLineNo">341</span>    List&lt;Get&gt; gets = new ArrayList&lt;&gt;();<a name="line.341"></a>
-<span class="sourceLineNo">342</span>    gets.add(new Get(ROW));<a name="line.342"></a>
-<span class="sourceLineNo">343</span>    gets.add(null);<a name="line.343"></a>
-<span class="sourceLineNo">344</span>    gets.add(new Get(ANOTHERROW));<a name="line.344"></a>
-<span class="sourceLineNo">345</span><a name="line.345"></a>
-<span class="sourceLineNo">346</span>    boolean[] results = table.existsAll(gets);<a name="line.346"></a>
-<span class="sourceLineNo">347</span>    assertEquals(results[0], true);<a name="line.347"></a>
-<span class="sourceLineNo">348</span>    assertEquals(results[1], false);<a name="line.348"></a>
-<span class="sourceLineNo">349</span>    assertEquals(results[2], false);<a name="line.349"></a>
-<span class="sourceLineNo">350</span>  }<a name="line.350"></a>
-<span class="sourceLineNo">351</span><a name="line.351"></a>
-<span class="sourceLineNo">352</span>  @Test<a name="line.352"></a>
-<span class="sourceLineNo">353</span>  public void testHTableExistsBeforeGet() throws Exception {<a name="line.353"></a>
-<span class="sourceLineNo">354</span>    Table table = TEST_UTIL.createTable(TableName.valueOf(name.getMethodName()),<a name="line.354"></a>
-<span class="sourceLineNo">355</span>        new byte[][] { FAMILY });<a name="line.355"></a>
-<span class="sourceLineNo">356</span>    try {<a name="line.356"></a>
-<span class="sourceLineNo">357</span>      Put put = new Put(ROW);<a name="line.357"></a>
-<span class="sourceLineNo">358</span>      put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.358"></a>
-<span class="sourceLineNo">359</span>      table.put(put);<a name="line.359"></a>
-<span class="sourceLineNo">360</span><a name="line.360"></a>
-<span class="sourceLineNo">361</span>      Get get = new Get(ROW);<a name="line.361"></a>
-<span class="sourceLineNo">362</span><a name="line.362"></a>
-<span class="sourceLineNo">363</span>      boolean exist = table.exists(get);<a name="line.363"></a>
-<span class="sourceLineNo">364</span>      assertEquals(true, exist);<a name="line.364"></a>
-<span class="sourceLineNo">365</span><a name="line.365"></a>
-<span class="sourceLineNo">366</span>      Result result = table.get(get);<a name="line.366"></a>
-<span class="sourceLineNo">367</span>      assertEquals(false, result.isEmpty());<a name="line.367"></a>
-<span class="sourceLineNo">368</span>      assertTrue(Bytes.equals(VALUE, result.getValue(FAMILY, QUALIFIER)));<a name="line.368"></a>
-<span class="sourceLineNo">369</span>    } finally {<a name="line.369"></a>
-<span class="sourceLineNo">370</span>      table.close();<a name="line.370"></a>
-<span class="sourceLineNo">371</span>    }<a name="line.371"></a>
-<span class="sourceLineNo">372</span>  }<a name="line.372"></a>
-<span class="sourceLineNo">373</span><a name="line.373"></a>
-<span class="sourceLineNo">374</span>  @Test<a name="line.374"></a>
-<span class="sourceLineNo">375</span>  public void testHTableExistsAllBeforeGet() throws Exception {<a name="line.375"></a>
-<span class="sourceLineNo">376</span>    final byte[] ROW2 = Bytes.add(ROW, Bytes.toBytes("2"));<a name="line.376"></a>
-<span class="sourceLineNo">377</span>    Table table = TEST_UTIL.createTable(<a name="line.377"></a>
-<span class="sourceLineNo">378</span>        TableName.valueOf(name.getMethodName()), new byte[][] { FAMILY });<a name="line.378"></a>
-<span class="sourceLineNo">379</span>    try {<a name="line.379"></a>
-<span class="sourceLineNo">380</span>      Put put = new Put(ROW);<a name="line.380"></a>
-<span class="sourceLineNo">381</span>      put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.381"></a>
-<span class="sourceLineNo">382</span>      table.put(put);<a name="line.382"></a>
-<span class="sourceLineNo">383</span>      put = new Put(ROW2);<a name="line.383"></a>
-<span class="sourceLineNo">384</span>      put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.384"></a>
-<span class="sourceLineNo">385</span>      table.put(put);<a name="line.385"></a>
+<span class="sourceLineNo">327</span>      Get g = new Get(ROW);<a name="line.327"></a>
+<span class="sourceLineNo">328</span>      Result r = t.get(g);<a name="line.328"></a>
+<span class="sourceLineNo">329</span>      assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIERS[0])));<a name="line.329"></a>
+<span class="sourceLineNo">330</span><a name="line.330"></a>
+<span class="sourceLineNo">331</span>      arm = new RowMutations(ROW);<a name="line.331"></a>
+<span class="sourceLineNo">332</span>      p = new Put(ROW);<a name="line.332"></a>
+<span class="sourceLineNo">333</span>      p.addColumn(FAMILY, QUALIFIERS[1], VALUE);<a name="line.333"></a>
+<span class="sourceLineNo">334</span>      arm.add(p);<a name="line.334"></a>
+<span class="sourceLineNo">335</span>      Delete d = new Delete(ROW);<a name="line.335"></a>
+<span class="sourceLineNo">336</span>      d.addColumns(FAMILY, QUALIFIERS[0]);<a name="line.336"></a>
+<span class="sourceLineNo">337</span>      arm.add(d);<a name="line.337"></a>
+<span class="sourceLineNo">338</span>      t.batch(Arrays.asList(arm), batchResult);<a name="line.338"></a>
+<span class="sourceLineNo">339</span>      r = t.get(g);<a name="line.339"></a>
+<span class="sourceLineNo">340</span>      assertEquals(0, Bytes.compareTo(VALUE, r.getValue(FAMILY, QUALIFIERS[1])));<a name="line.340"></a>
+<span class="sourceLineNo">341</span>      assertNull(r.getValue(FAMILY, QUALIFIERS[0]));<a name="line.341"></a>
+<span class="sourceLineNo">342</span><a name="line.342"></a>
+<span class="sourceLineNo">343</span>      // Test that we get the correct remote exception for RowMutations from batch()<a name="line.343"></a>
+<span class="sourceLineNo">344</span>      try {<a name="line.344"></a>
+<span class="sourceLineNo">345</span>        arm = new RowMutations(ROW);<a name="line.345"></a>
+<span class="sourceLineNo">346</span>        p = new Put(ROW);<a name="line.346"></a>
+<span class="sourceLineNo">347</span>        p.addColumn(new byte[]{'b', 'o', 'g', 'u', 's'}, QUALIFIERS[0], VALUE);<a name="line.347"></a>
+<span class="sourceLineNo">348</span>        arm.add(p);<a name="line.348"></a>
+<span class="sourceLineNo">349</span>        t.batch(Arrays.asList(arm), batchResult);<a name="line.349"></a>
+<span class="sourceLineNo">350</span>        fail("Expected RetriesExhaustedWithDetailsException with NoSuchColumnFamilyException");<a name="line.350"></a>
+<span class="sourceLineNo">351</span>      } catch(RetriesExhaustedWithDetailsException e) {<a name="line.351"></a>
+<span class="sourceLineNo">352</span>        String msg = e.getMessage();<a name="line.352"></a>
+<span class="sourceLineNo">353</span>        assertTrue(msg.contains("NoSuchColumnFamilyException"));<a name="line.353"></a>
+<span class="sourceLineNo">354</span>      }<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><a name="line.357"></a>
+<span class="sourceLineNo">358</span>  @Test<a name="line.358"></a>
+<span class="sourceLineNo">359</span>  public void testHTableExistsMethodSingleRegionSingleGet() throws Exception {<a name="line.359"></a>
+<span class="sourceLineNo">360</span>      // Test with a single region table.<a name="line.360"></a>
+<span class="sourceLineNo">361</span>      Table table = TEST_UTIL.createTable(<a name="line.361"></a>
+<span class="sourceLineNo">362</span>          TableName.valueOf(name.getMethodName()),<a name="line.362"></a>
+<span class="sourceLineNo">363</span>          new byte[][] { FAMILY });<a name="line.363"></a>
+<span class="sourceLineNo">364</span><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(FAMILY, QUALIFIER, VALUE);<a name="line.366"></a>
+<span class="sourceLineNo">367</span><a name="line.367"></a>
+<span class="sourceLineNo">368</span>    Get get = new Get(ROW);<a name="line.368"></a>
+<span class="sourceLineNo">369</span><a name="line.369"></a>
+<span class="sourceLineNo">370</span>    boolean exist = table.exists(get);<a name="line.370"></a>
+<span class="sourceLineNo">371</span>    assertEquals(exist, false);<a name="line.371"></a>
+<span class="sourceLineNo">372</span><a name="line.372"></a>
+<span class="sourceLineNo">373</span>    table.put(put);<a name="line.373"></a>
+<span class="sourceLineNo">374</span><a name="line.374"></a>
+<span class="sourceLineNo">375</span>    exist = table.exists(get);<a name="line.375"></a>
+<span class="sourceLineNo">376</span>    assertEquals(exist, true);<a name="line.376"></a>
+<span class="sourceLineNo">377</span>  }<a name="line.377"></a>
+<span class="sourceLineNo">378</span><a name="line.378"></a>
+<span class="sourceLineNo">379</span>  public void testHTableExistsMethodSingleRegionMultipleGets() throws Exception {<a name="line.379"></a>
+<span class="sourceLineNo">380</span>    Table table = TEST_UTIL.createTable(TableName.valueOf(<a name="line.380"></a>
+<span class="sourceLineNo">381</span>        name.getMethodName()), new byte[][] { FAMILY });<a name="line.381"></a>
+<span class="sourceLineNo">382</span><a name="line.382"></a>
+<span class="sourceLineNo">383</span>    Put put = new Put(ROW);<a name="line.383"></a>
+<span class="sourceLineNo">384</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.384"></a>
+<span class="sourceLineNo">385</span>    table.put(put);<a name="line.385"></a>
 <span class="sourceLineNo">386</span><a name="line.386"></a>
-<span class="sourceLineNo">387</span>      Get get = new Get(ROW);<a name="line.387"></a>
-<span class="sourceLineNo">388</span>      Get get2 = new Get(ROW2);<a name="line.388"></a>
-<span class="sourceLineNo">389</span>      ArrayList&lt;Get&gt; getList = new ArrayList(2);<a name="line.389"></a>
-<span class="sourceLineNo">390</span>      getList.add(get);<a name="line.390"></a>
-<span class="sourceLineNo">391</span>      getList.add(get2);<a name="line.391"></a>
-<span class="sourceLineNo">392</span><a name="line.392"></a>
-<span class="sourceLineNo">393</span>      boolean[] exists = table.existsAll(getList);<a name="line.393"></a>
-<span class="sourceLineNo">394</span>      assertEquals(true, exists[0]);<a name="line.394"></a>
-<span class="sourceLineNo">395</span>      assertEquals(true, exists[1]);<a name="line.395"></a>
-<span class="sourceLineNo">396</span><a name="line.396"></a>
-<span class="sourceLineNo">397</span>      Result[] result = table.get(getList);<a name="line.397"></a>
-<span class="sourceLineNo">398</span>      assertEquals(false, result[0].isEmpty());<a name="line.398"></a>
-<span class="sourceLineNo">399</span>      assertTrue(Bytes.equals(VALUE, result[0].getValue(FAMILY, QUALIFIER)));<a name="line.399"></a>
-<span class="sourceLineNo">400</span>      assertEquals(false, result[1].isEmpty());<a name="line.400"></a>
-<span class="sourceLineNo">401</span>      assertTrue(Bytes.equals(VALUE, result[1].getValue(FAMILY, QUALIFIER)));<a name="line.401"></a>
-<span class="sourceLineNo">402</span>    } finally {<a name="line.402"></a>
-<span class="sourceLineNo">403</span>      table.close();<a name="line.403"></a>
-<span class="sourceLineNo">404</span>    }<a name="line.404"></a>
-<span class="sourceLineNo">405</span>  }<a name="line.405"></a>
+<span class="sourceLineNo">387</span>    List&lt;Get&gt; gets = new ArrayList&lt;&gt;();<a name="line.387"></a>
+<span class="sourceLineNo">388</span>    gets.add(new Get(ROW));<a name="line.388"></a>
+<span class="sourceLineNo">389</span>    gets.add(null);<a name="line.389"></a>
+<span class="sourceLineNo">390</span>    gets.add(new Get(ANOTHERROW));<a name="line.390"></a>
+<span class="sourceLineNo">391</span><a name="line.391"></a>
+<span class="sourceLineNo">392</span>    boolean[] results = table.existsAll(gets);<a name="line.392"></a>
+<span class="sourceLineNo">393</span>    assertEquals(results[0], true);<a name="line.393"></a>
+<span class="sourceLineNo">394</span>    assertEquals(results[1], false);<a name="line.394"></a>
+<span class="sourceLineNo">395</span>    assertEquals(results[2], false);<a name="line.395"></a>
+<span class="sourceLineNo">396</span>  }<a name="line.396"></a>
+<span class="sourceLineNo">397</span><a name="line.397"></a>
+<span class="sourceLineNo">398</span>  @Test<a name="line.398"></a>
+<span class="sourceLineNo">399</span>  public void testHTableExistsBeforeGet() throws Exception {<a name="line.399"></a>
+<span class="sourceLineNo">400</span>    Table table = TEST_UTIL.createTable(TableName.valueOf(name.getMethodName()),<a name="line.400"></a>
+<span class="sourceLineNo">401</span>        new byte[][] { FAMILY });<a name="line.401"></a>
+<span class="sourceLineNo">402</span>    try {<a name="line.402"></a>
+<span class="sourceLineNo">403</span>      Put put = new Put(ROW);<a name="line.403"></a>
+<span class="sourceLineNo">404</span>      put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.404"></a>
+<span class="sourceLineNo">405</span>      table.put(put);<a name="line.405"></a>
 <span class="sourceLineNo">406</span><a name="line.406"></a>
-<span class="sourceLineNo">407</span>  @Test<a name="line.407"></a>
-<span class="sourceLineNo">408</span>  public void testHTableExistsMethodMultipleRegionsSingleGet() throws Exception {<a name="line.408"></a>
-<span class="sourceLineNo">409</span>    Table table = TEST_UTIL.createTable(<a name="line.409"></a>
-<span class="sourceLineNo">410</span>      TableName.valueOf(name.getMethodName()), new byte[][] { FAMILY },<a name="line.410"></a>
-<span class="sourceLineNo">411</span>      1, new byte[] { 0x00 }, new byte[] { (byte) 0xff }, 255);<a name="line.411"></a>
-<span class="sourceLineNo">412</span>    Put put = new Put(ROW);<a name="line.412"></a>
-<span class="sourceLineNo">413</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.413"></a>
-<span class="sourceLineNo">414</span><a name="line.414"></a>
-<span class="sourceLineNo">415</span>    Get get = new Get(ROW);<a name="line.415"></a>
-<span class="sourceLineNo">416</span><a name="line.416"></a>
-<span class="sourceLineNo">417</span>    boolean exist = table.exists(get);<a name="line.417"></a>
-<span class="sourceLineNo">418</span>    assertEquals(exist, false);<a name="line.418"></a>
+<span class="sourceLineNo">407</span>      Get get = new Get(ROW);<a name="line.407"></a>
+<span class="sourceLineNo">408</span><a name="line.408"></a>
+<span class="sourceLineNo">409</span>      boolean exist = table.exists(get);<a name="line.409"></a>
+<span class="sourceLineNo">410</span>      assertEquals(true, exist);<a name="line.410"></a>
+<span class="sourceLineNo">411</span><a name="line.411"></a>
+<span class="sourceLineNo">412</span>      Result result = table.get(get);<a name="line.412"></a>
+<span class="sourceLineNo">413</span>      assertEquals(false, result.isEmpty());<a name="line.413"></a>
+<span class="sourceLineNo">414</span>      assertTrue(Bytes.equals(VALUE, result.getValue(FAMILY, QUALIFIER)));<a name="line.414"></a>
+<span class="sourceLineNo">415</span>    } finally {<a name="line.415"></a>
+<span class="sourceLineNo">416</span>      table.close();<a name="line.416"></a>
+<span class="sourceLineNo">417</span>    }<a name="line.417"></a>
+<span class="sourceLineNo">418</span>  }<a name="line.418"></a>
 <span class="sourceLineNo">419</span><a name="line.419"></a>
-<span class="sourceLineNo">420</span>    table.put(put);<a name="line.420"></a>
-<span class="sourceLineNo">421</span><a name="line.421"></a>
-<span class="sourceLineNo">422</span>    exist = table.exists(get);<a name="line.422"></a>
-<span class="sourceLineNo">423</span>    assertEquals(exist, true);<a name="line.423"></a>
-<span class="sourceLineNo">424</span>  }<a name="line.424"></a>
-<span class="sourceLineNo">425</span><a name="line.425"></a>
-<span class="sourceLineNo">426</span>  @Test<a name="line.426"></a>
-<span class="sourceLineNo">427</span>  public void testHTableExistsMethodMultipleRegionsMultipleGets() throws Exception {<a name="line.427"></a>
-<span class="sourceLineNo">428</span>    Table table = TEST_UTIL.createTable(<a name="line.428"></a>
-<span class="sourceLineNo">429</span>      TableName.valueOf(name.getMethodName()),<a name="line.429"></a>
-<span class="sourceLineNo">430</span>      new byte[][] { FAMILY }, 1, new byte[] { 0x00 }, new byte[] { (byte) 0xff }, 255);<a name="line.430"></a>
-<span class="sourceLineNo">431</span>    Put put = new Put(ROW);<a name="line.431"></a>
-<span class="sourceLineNo">432</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.432"></a>
-<span class="sourceLineNo">433</span>    table.put (put);<a name="line.433"></a>
-<span class="sourceLineNo">434</span><a name="line.434"></a>
-<span class="sourceLineNo">435</span>    List&lt;Get&gt; gets = new ArrayList&lt;&gt;();<a name="line.435"></a>
-<span class="sourceLineNo">436</span>    gets.add(new Get(ANOTHERROW));<a name="line.436"></a>
-<span class="sourceLineNo">437</span>    gets.add(new Get(Bytes.add(ROW, new byte[] { 0x00 })));<a name="line.437"></a>
-<span class="sourceLineNo">438</span>    gets.add(new Get(ROW));<a name="line.438"></a>
-<span class="sourceLineNo">439</span>    gets.add(new Get(Bytes.add(ANOTHERROW, new byte[] { 0x00 })));<a name="line.439"></a>
-<span class="sourceLineNo">440</span><a name="line.440"></a>
-<span class="sourceLineNo">441</span>    LOG.info("Calling exists");<a name="line.441"></a>
-<span class="sourceLineNo">442</span>    boolean[] results = table.existsAll(gets);<a name="line.442"></a>
-<span class="sourceLineNo">443</span>    assertEquals(results[0], false);<a name="line.443"></a>
-<span class="sourceLineNo">444</span>    assertEquals(results[1], false);<a name="line.444"></a>
-<span class="sourceLineNo">445</span>    assertEquals(results[2], true);<a name="line.445"></a>
-<span class="sourceLineNo">446</span>    assertEquals(results[3], false);<a name="line.446"></a>
-<span class="sourceLineNo">447</span><a name="line.447"></a>
-<span class="sourceLineNo">448</span>    // Test with the first region.<a name="line.448"></a>
-<span class="sourceLineNo">449</span>    put = new Put(new byte[] { 0x00 });<a name="line.449"></a>
-<span class="sourceLineNo">450</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.450"></a>
-<span class="sourceLineNo">451</span>    table.put(put);<a name="line.451"></a>
+<span class="sourceLineNo">420</span>  @Test<a name="line.420"></a>
+<span class="sourceLineNo">421</span>  public void testHTableExistsAllBeforeGet() throws Exception {<a name="line.421"></a>
+<span class="sourceLineNo">422</span>    final byte[] ROW2 = Bytes.add(ROW, Bytes.toBytes("2"));<a name="line.422"></a>
+<span class="sourceLineNo">423</span>    Table table = TEST_UTIL.createTable(<a name="line.423"></a>
+<span class="sourceLineNo">424</span>        TableName.valueOf(name.getMethodName()), new byte[][] { FAMILY });<a name="line.424"></a>
+<span class="sourceLineNo">425</span>    try {<a name="line.425"></a>
+<span class="sourceLineNo">426</span>      Put put = new Put(ROW);<a name="line.426"></a>
+<span class="sourceLineNo">427</span>      put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.427"></a>
+<span class="sourceLineNo">428</span>      table.put(put);<a name="line.428"></a>
+<span class="sourceLineNo">429</span>      put = new Put(ROW2);<a name="line.429"></a>
+<span class="sourceLineNo">430</span>      put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.430"></a>
+<span class="sourceLineNo">431</span>      table.put(put);<a name="line.431"></a>
+<span class="sourceLineNo">432</span><a name="line.432"></a>
+<span class="sourceLineNo">433</span>      Get get = new Get(ROW);<a name="line.433"></a>
+<span class="sourceLineNo">434</span>      Get get2 = new Get(ROW2);<a name="line.434"></a>
+<span class="sourceLineNo">435</span>      ArrayList&lt;Get&gt; getList = new ArrayList(2);<a name="line.435"></a>
+<span class="sourceLineNo">436</span>      getList.add(get);<a name="line.436"></a>
+<span class="sourceLineNo">437</span>      getList.add(get2);<a name="line.437"></a>
+<span class="sourceLineNo">438</span><a name="line.438"></a>
+<span class="sourceLineNo">439</span>      boolean[] exists = table.existsAll(getList);<a name="line.439"></a>
+<span class="sourceLineNo">440</span>      assertEquals(true, exists[0]);<a name="line.440"></a>
+<span class="sourceLineNo">441</span>      assertEquals(true, exists[1]);<a name="line.441"></a>
+<span class="sourceLineNo">442</span><a name="line.442"></a>
+<span class="sourceLineNo">443</span>      Result[] result = table.get(getList);<a name="line.443"></a>
+<span class="sourceLineNo">444</span>      assertEquals(false, result[0].isEmpty());<a name="line.444"></a>
+<span class="sourceLineNo">445</span>      assertTrue(Bytes.equals(VALUE, result[0].getValue(FAMILY, QUALIFIER)));<a name="line.445"></a>
+<span class="sourceLineNo">446</span>      assertEquals(false, result[1].isEmpty());<a name="line.446"></a>
+<span class="sourceLineNo">447</span>      assertTrue(Bytes.equals(VALUE, result[1].getValue(FAMILY, QUALIFIER)));<a name="line.447"></a>
+<span class="sourceLineNo">448</span>    } finally {<a name="line.448"></a>
+<span class="sourceLineNo">449</span>      table.close();<a name="line.449"></a>
+<span class="sourceLineNo">450</span>    }<a name="line.450"></a>
+<span class="sourceLineNo">451</span>  }<a name="line.451"></a>
 <span class="sourceLineNo">452</span><a name="line.452"></a>
-<span class="sourceLineNo">453</span>    gets = new ArrayList&lt;&gt;();<a name="line.453"></a>
-<span class="sourceLineNo">454</span>    gets.add(new Get(new byte[] { 0x00 }));<a name="line.454"></a>
-<span class="sourceLineNo">455</span>    gets.add(new Get(new byte[] { 0x00, 0x00 }));<a name="line.455"></a>
-<span class="sourceLineNo">456</span>    results = table.existsAll(gets);<a name="line.456"></a>
-<span class="sourceLineNo">457</span>    assertEquals(results[0], true);<a name="line.457"></a>
-<span class="sourceLineNo">458</span>    assertEquals(results[1], false);<a name="line.458"></a>
-<span class="sourceLineNo">459</span><a name="line.459"></a>
-<span class="sourceLineNo">460</span>    // Test with the last region<a name="line.460"></a>
-<span class="sourceLineNo">461</span>    put = new Put(new byte[] { (byte) 0xff, (byte) 0xff });<a name="line.461"></a>
-<span class="sourceLineNo">462</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.462"></a>
-<span class="sourceLineNo">463</span>    table.put(put);<a name="line.463"></a>
-<span class="sourceLineNo">464</span><a name="line.464"></a>
-<span class="sourceLineNo">465</span>    gets = new ArrayList&lt;&gt;();<a name="line.465"></a>
-<span class="sourceLineNo">466</span>    gets.add(new Get(new byte[] { (byte) 0xff }));<a name="line.466"></a>
-<span class="sourceLineNo">467</span>    gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff }));<a name="line.467"></a>
-<span class="sourceLineNo">468</span>    gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff }));<a name="line.468"></a>
-<span class="sourceLineNo">469</span>    results = table.existsAll(gets);<a name="line.469"></a>
-<span class="sourceLineNo">470</span>    assertEquals(results[0], false);<a name="line.470"></a>
-<span class="sourceLineNo">471</span>    assertEquals(results[1], true);<a name="line.471"></a>
-<span class="sourceLineNo">472</span>    assertEquals(results[2], false);<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>  @Test<a name="line.475"></a>
-<span class="sourceLineNo">476</span>  public void testGetEmptyRow() throws Exception {<a name="line.476"></a>
-<span class="sourceLineNo">477</span>    //Create a table and put in 1 row<a name="line.477"></a>
-<span class="sourceLineNo">478</span>    Admin admin = TEST_UTIL.getAdmin();<a name="line.478"></a>
-<span class="sourceLineNo">479</span>    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes.toBytes(name.getMethodName())));<a name="line.479"></a>
-<span class="sourceLineNo">480</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.480"></a>
-<span class="sourceLineNo">481</span>    admin.createTable(desc);<a name="line.481"></a>
-<span class="sourceLineNo">482</span>    Table table = TEST_UTIL.getConnection().getTable(desc.getTableName());<a name="line.482"></a>
-<span class="sourceLineNo">483</span><a name="line.483"></a>
-<span class="sourceLineNo">484</span>    Put put = new Put(ROW_BYTES);<a name="line.484"></a>
-<span class="sourceLineNo">485</span>    put.addColumn(FAMILY, COL_QUAL, VAL_BYTES);<a name="line.485"></a>
-<span class="sourceLineNo">486</span>    table.put(put);<a name="line.486"></a>
-<span class="sourceLineNo">487</span><a name="line.487"></a>
-<span class="sourceLineNo">488</span>    //Try getting the row with an empty row key<a name="line.488"></a>
-<span class="sourceLineNo">489</span>    Result res = null;<a name="line.489"></a>
-<span class="sourceLineNo">490</span>    try {<a name="line.490"></a>
-<span class="sourceLineNo">491</span>      res = table.get(new Get(new byte[0]));<a name="line.491"></a>
-<span class="sourceLineNo">492</span>      fail();<a name="line.492"></a>
-<span class="sourceLineNo">493</span>    } catch (IllegalArgumentException e) {<a name="line.493"></a>
-<span class="sourceLineNo">494</span>      // Expected.<a name="line.494"></a>
-<span class="sourceLineNo">495</span>    }<a name="line.495"></a>
-<span class="sourceLineNo">496</span>    assertTrue(res == null);<a name="line.496"></a>
-<span class="sourceLineNo">497</span>    res = table.get(new Get(Bytes.toBytes("r1-not-exist")));<a name="line.497"></a>
-<span class="sourceLineNo">498</span>    assertTrue(res.isEmpty() == true);<a name="line.498"></a>
-<span class="sourceLineNo">499</span>    res = table.get(new Get(ROW_BYTES));<a name="line.499"></a>
-<span class="sourceLineNo">500</span>    assertTrue(Arrays.equals(res.getValue(FAMILY, COL_QUAL), VAL_BYTES));<a name="line.500"></a>
-<span class="sourceLineNo">501</span>    table.close();<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>  @Test<a name="line.504"></a>
-<span class="sourceLineNo">505</span>  public void testConnectionDefaultUsesCodec() throws Exception {<a name="line.505"></a>
-<span class="sourceLineNo">506</span>    ClusterConnection con = (ClusterConnection) TEST_UTIL.getConnection();<a name="line.506"></a>
-<span class="sourceLineNo">507</span>    assertTrue(con.hasCellBlockSupport());<a name="line.507"></a>
-<span class="sourceLineNo">508</span>  }<a name="line.508"></a>
-<span class="sourceLineNo">509</span><a name="line.509"></a>
-<span class="sourceLineNo">510</span>  @Test(timeout = 60000)<a name="line.510"></a>
-<span class="sourceLineNo">511</span>  public void testPutWithPreBatchMutate() throws Exception {<a name="line.511"></a>
-<span class="sourceLineNo">512</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.512"></a>
-<span class="sourceLineNo">513</span>    testPreBatchMutate(tableName, () -&gt; {<a name="line.513"></a>
-<span class="sourceLineNo">514</span>      try {<a name="line.514"></a>
-<span class="sourceLineNo">515</span>        Table t = TEST_UTIL.getConnection().getTable(tableName);<a name="line.515"></a>
-<span class="sourceLineNo">516</span>        Put put = new Put(ROW);<a name="line.516"></a>
-<span class="sourceLineNo">517</span>        put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.517"></a>
-<span class="sourceLineNo">518</span>        t.put(put);<a name="line.518"></a>
-<span class="sourceLineNo">519</span>      } catch (IOException ex) {<a name="line.519"></a>
-<span class="sourceLineNo">520</span>        throw new RuntimeException(ex);<a name="line.520"></a>
-<span class="sourceLineNo">521</span>      }<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><a name="line.524"></a>
-<span class="sourceLineNo">525</span>  @Test(timeout = 60000)<a name="line.525"></a>
-<span class="sourceLineNo">526</span>  public void testRowMutationsWithPreBatchMutate() throws Exception {<a name="line.526"></a>
-<span class="sourceLineNo">527</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.527"></a>
-<span class="sourceLineNo">528</span>    testPreBatchMutate(tableName, () -&gt; {<a name="line.528"></a>
-<span class="sourceLineNo">529</span>      try {<a name="line.529"></a>
-<span class="sourceLineNo">530</span>        RowMutations rm = new RowMutations(ROW, 1);<a name="line.530"></a>
-<span class="sourceLineNo">531</span>        Table t = TEST_UTIL.getConnection().getTable(tableName);<a name="line.531"></a>
-<span class="sourceLineNo">532</span>        Put put = new Put(ROW);<a name="line.532"></a>
-<span class="sourceLineNo">533</span>        put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.533"></a>
-<span class="sourceLineNo">534</span>        rm.add(put);<a name="line.534"></a>
-<span class="sourceLineNo">535</span>        t.mutateRow(rm);<a name="line.535"></a>
-<span class="sourceLineNo">536</span>      } catch (IOException ex) {<a name="line.536"></a>
-<span class="sourceLineNo">537</span>        throw new RuntimeException(ex);<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>  }<a name="line.540"></a>
-<span class="sourceLineNo">541</span><a name="line.541"></a>
-<span class="sourceLineNo">542</span>  private void testPreBatchMutate(TableName tableName, Runnable rn)throws Exception {<a name="line.542"></a>
-<span class="sourceLineNo">543</span>    HTableDescriptor desc = new HTableDescriptor(tableName);<a name="line.543"></a>
-<span class="sourceLineNo">544</span>    desc.addCoprocessor(WatiingForScanObserver.class.getName());<a name="line.544"></a>
-<span class="sourceLineNo">545</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.545"></a>
-<span class="sourceLineNo">546</span>    TEST_UTIL.getAdmin().createTable(desc);<a name="line.546"></a>
-<span class="sourceLineNo">547</span>    ExecutorService service = Executors.newFixedThreadPool(2);<a name="line.547"></a>
-<span class="sourceLineNo">548</span>    service.execute(rn);<a name="line.548"></a>
-<span class="sourceLineNo">549</span>    final List&lt;Cell&gt; cells = new ArrayList&lt;&gt;();<a name="line.549"></a>
-<span class="sourceLineNo">550</span>    service.execute(() -&gt; {<a name="line.550"></a>
-<span class="sourceLineNo">551</span>      try {<a name="line.551"></a>
-<span class="sourceLineNo">552</span>        // waiting for update.<a name="line.552"></a>
-<span class="sourceLineNo">553</span>        TimeUnit.SECONDS.sleep(3);<a name="line.553"></a>
-<span class="sourceLineNo">554</span>        Table t = TEST_UTIL.getConnection().getTable(tableName);<a name="line.554"></a>
-<span class="sourceLineNo">555</span>        Scan scan = new Scan();<a name="line.555"></a>
-<span class="sourceLineNo">556</span>        try (ResultScanner scanner = t.getScanner(scan)) {<a name="line.556"></a>
-<span class="sourceLineNo">557</span>          for (Result r : scanner) {<a name="line.557"></a>
-<span class="sourceLineNo">558</span>            cells.addAll(Arrays.asList(r.rawCells()));<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>
-<span class="sourceLineNo">561</span>      } catch (IOException | InterruptedException ex) {<a name="line.561"></a>
-<span class="sourceLineNo">562</span>        throw new RuntimeException(ex);<a name="line.562"></a>
-<span class="sourceLineNo">563</span>      }<a name="line.563"></a>
-<span class="sourceLineNo">564</span>    });<a name="line.564"></a>
-<span class="sourceLineNo">565</span>    service.shutdown();<a name="line.565"></a>
-<span class="sourceLineNo">566</span>    service.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.566"></a>
-<span class="sourceLineNo">567</span>    assertEquals("The write is blocking by RegionObserver#postBatchMutate"<a name="line.567"></a>
-<span class="sourceLineNo">568</span>      + ", so the data is invisible to reader", 0, cells.size());<a name="line.568"></a>
-<span class="sourceLineNo">569</span>    TEST_UTIL.deleteTable(tableName);<a name="line.569"></a>
-<span class="sourceLineNo">570</span>  }<a name="line.570"></a>
-<span class="sourceLineNo">571</span><a name="line.571"></a>
-<span class="sourceLineNo">572</span>  @Test(timeout = 30000)<a name="line.572"></a>
-<span class="sourceLineNo">573</span>  public void testLockLeakWithDelta() throws Exception, Throwable {<a name="line.573"></a>
-<span class="sourceLineNo">574</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.574"></a>
-<span class="sourceLineNo">575</span>    HTableDescriptor desc = new HTableDescriptor(tableName);<a name="line.575"></a>
-<span class="sourceLineNo">576</span>    desc.addCoprocessor(WatiingForMultiMutationsObserver.class.getName());<a name="line.576"></a>
-<span class="sourceLineNo">577</span>    desc.setConfiguration("hbase.rowlock.wait.duration", String.valueOf(5000));<a name="line.577"></a>
-<span class="sourceLineNo">578</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.578"></a>
-<span class="sourceLineNo">579</span>    TEST_UTIL.getAdmin().createTable(desc);<a name="line.579"></a>
-<span class="sourceLineNo">580</span>    // new a connection for lower retry number.<a name="line.580"></a>
-<span class="sourceLineNo">581</span>    Configuration copy = new Configuration(TEST_UTIL.getConfiguration());<a name="line.581"></a>
-<span class="sourceLineNo">582</span>    copy.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);<a name="line.582"></a>
-<span class="sourceLineNo">583</span>    try (Connection con = ConnectionFactory.createConnection(copy)) {<a name="line.583"></a>
-<span class="sourceLineNo">584</span>      HRegion region = (HRegion) find(tableName);<a name="line.584"></a>
-<span class="sourceLineNo">585</span>      region.setTimeoutForWriteLock(10);<a name="line.585"></a>
-<span class="sourceLineNo">586</span>      ExecutorService putService = Executors.newSingleThreadExecutor();<a name="line.586"></a>
-<span class="sourceLineNo">587</span>      putService.execute(() -&gt; {<a name="line.587"></a>
-<span class="sourceLineNo">588</span>        try (Table table = con.getTable(tableName)) {<a name="line.588"></a>
-<span class="sourceLineNo">589</span>          Put put = new Put(ROW);<a name="line.589"></a>
-<span class="sourceLineNo">590</span>          put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.590"></a>
-<span class="sourceLineNo">591</span>          // the put will be blocked by WatiingForMultiMutationsObserver.<a name="line.591"></a>
-<span class="sourceLineNo">592</span>          table.put(put);<a name="line.592"></a>
-<span class="sourceLineNo">593</span>        } catch (IOException ex) {<a name="line.593"></a>
-<span class="sourceLineNo">594</span>          throw new RuntimeException(ex);<a name="line.594"></a>
-<span class="sourceLineNo">595</span>        }<a name="line.595"></a>
-<span class="sourceLineNo">596</span>      });<a name="line.596"></a>
-<span class="sourceLineNo">597</span>      ExecutorService appendService = Executors.newSingleThreadExecutor();<a name="line.597"></a>
-<span class="sourceLineNo">598</span>      appendService.execute(() -&gt; {<a name="line.598"></a>
-<span class="sourceLineNo">599</span>        Append append = new Append(ROW);<a name="line.599"></a>
-<span class="sourceLineNo">600</span>        append.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.600"></a>
-<span class="sourceLineNo">601</span>        try (Table table = con.getTable(tableName)) {<a name="line.601"></a>
-<span class="sourceLineNo">602</span>          table.append(append);<a name="line.602"></a>
-<span class="sourceLineNo">603</span>          fail("The APPEND should fail because the target lock is blocked by previous put");<a name="line.603"></a>
-<span class="sourceLineNo">604</span>        } catch (Throwable ex) {<a name="line.604"></a>
-<span class="sourceLineNo">605</span>        }<a name="line.605"></a>
-<span class="sourceLineNo">606</span>      });<a name="line.606"></a>
-<span class="sourceLineNo">607</span>      appendService.shutdown();<a name="line.607"></a>
-<span class="sourceLineNo">608</span>      appendService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.608"></a>
-<span class="sourceLineNo">609</span>      WatiingForMultiMutationsObserver observer = find(tableName, WatiingForMultiMutationsObserver.class);<a name="line.609"></a>
-<span class="sourceLineNo">610</span>      observer.latch.countDown();<a name="line.610"></a>
-<span class="sourceLineNo">611</span>      putService.shutdown();<a name="line.611"></a>
-<span class="sourceLineNo">612</span>      putService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.612"></a>
-<span class="sourceLineNo">613</span>      try (Table table = con.getTable(tableName)) {<a name="line.613"></a>
-<span class="sourceLineNo">614</span>        Result r = table.get(new Get(ROW));<a name="line.614"></a>
-<span class="sourceLineNo">615</span>        assertFalse(r.isEmpty());<a name="line.615"></a>
-<span class="sourceLineNo">616</span>        assertTrue(Bytes.equals(r.getValue(FAMILY, QUALIFIER), VALUE));<a name="line.616"></a>
-<span class="sourceLineNo">617</span>      }<a name="line.617"></a>
-<span class="sourceLineNo">618</span>    }<a name="line.618"></a>
-<span class="sourceLineNo">619</span>    HRegion region = (HRegion) find(tableName);<a name="line.619"></a>
-<span class="sourceLineNo">620</span>    int readLockCount = region.getReadLockCount();<a name="line.620"></a>
-<span class="sourceLineNo">621</span>    LOG.info("readLockCount:" + readLockCount);<a name="line.621"></a>
-<span class="sourceLineNo">622</span>    assertEquals(0, readLockCount);<a name="line.622"></a>
-<span class="sourceLineNo">623</span>  }<a name="line.623"></a>
-<span class="sourceLineNo">624</span><a name="line.624"></a>
-<span class="sourceLineNo">625</span>  @Test(timeout = 30000)<a name="line.625"></a>
-<span class="sourceLineNo">626</span>  public void testMultiRowMutations() throws Exception, Throwable {<a name="line.626"></a>
-<span class="sourceLineNo">627</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.627"></a>
-<span class="sourceLineNo">628</span>    HTableDescriptor desc = new HTableDescriptor(tableName);<a name="line.628"></a>
-<span class="sourceLineNo">629</span>    desc.addCoprocessor(MultiRowMutationEndpoint.class.getName());<a name="line.629"></a>
-<span class="sourceLineNo">630</span>    desc.addCoprocessor(WatiingForMultiMutationsObserver.class.getName());<a name="line.630"></a>
-<span class="sourceLineNo">631</span>    desc.setConfiguration("hbase.rowlock.wait.duration", String.valueOf(5000));<a name="line.631"></a>
-<span class="sourceLineNo">632</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.632"></a>
-<span class="sourceLineNo">633</span>    TEST_UTIL.getAdmin().createTable(desc);<a name="line.633"></a>
-<span class="sourceLineNo">634</span>    // new a connection for lower retry number.<a name="line.634"></a>
-<span class="sourceLineNo">635</span>    Configuration copy = new Configuration(TEST_UTIL.getConfiguration());<a name="line.635"></a>
-<span class="sourceLineNo">636</span>    copy.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);<a name="line.636"></a>
-<span class="sourceLineNo">637</span>    try (Connection con = ConnectionFactory.createConnection(copy)) {<a name="line.637"></a>
-<span class="sourceLineNo">638</span>      byte[] row = Bytes.toBytes("ROW-0");<a name="line.638"></a>
-<span class="sourceLineNo">639</span>      byte[] rowLocked= Bytes.toBytes("ROW-1");<a name="line.639"></a>
-<span class="sourceLineNo">640</span>      byte[] value0 = Bytes.toBytes("VALUE-0");<a name="line.640"></a>
-<span class="sourceLineNo">641</span>      byte[] value1 = Bytes.toBytes("VALUE-1");<a name="line.641"></a>
-<span class="sourceLineNo">642</span>      byte[] value2 = Bytes.toBytes("VALUE-2");<a name="line.642"></a>
-<span class="sourceLineNo">643</span>      assertNoLocks(tableName);<a name="line.643"></a>
-<span class="sourceLineNo">644</span>      ExecutorService putService = Executors.newSingleThreadExecutor();<a name="line.644"></a>
-<span class="sourceLineNo">645</span>      putService.execute(() -&gt; {<a name="line.645"></a>
-<span class="sourceLineNo">646</span>        try (Table table = con.getTable(tableName)) {<a name="line.646"></a>
-<span class="sourceLineNo">647</span>          Put put0 = new Put(rowLocked);<a name="line.647"></a>
-<span class="sourceLineNo">648</span>          put0.addColumn(FAMILY, QUALIFIER, value0);<a name="line.648"></a>
-<span class="sourceLineNo">649</span>          // the put will be blocked by WatiingForMultiMutationsObserver.<a name="line.649"></a>
-<span class="sourceLineNo">650</span>          table.put(put0);<a name="line.650"></a>
-<span class="sourceLineNo">651</span>        } catch (IOException ex) {<a name="line.651"></a>
-<span class="sourceLineNo">652</span>          throw new RuntimeException(ex);<a name="line.652"></a>
-<span class="sourceLineNo">653</span>        }<a name="line.653"></a>
-<span class="sourceLineNo">654</span>      });<a name="line.654"></a>
-<span class="sourceLineNo">655</span>      ExecutorService cpService = Executors.newSingleThreadExecutor();<a name="line.655"></a>
-<span class="sourceLineNo">656</span>      cpService.execute(() -&gt; {<a name="line.656"></a>
-<span class="sourceLineNo">657</span>        Put put1 = new Put(row);<a name="line.657"></a>
-<span class="sourceLineNo">658</span>        Put put2 = new Put(rowLocked);<a name="line.658"></a>
-<span class="sourceLineNo">659</span>        put1.addColumn(FAMILY, QUALIFIER, value1);<a name="line.659"></a>
-<span class="sourceLineNo">660</span>        put2.addColumn(FAMILY, QUALIFIER, value2);<a name="line.660"></a>
-<span class="sourceLineNo">661</span>        try (Table table = con.getTable(tableName)) {<a name="line.661"></a>
-<span class="sourceLineNo">662</span>          MultiRowMutationProtos.MutateRowsRequest request<a name="line.662"></a>
-<span class="sourceLineNo">663</span>            = MultiRowMutationProtos.MutateRowsRequest.newBuilder()<a name="line.663"></a>
-<span class="sourceLineNo">664</span>              .addMutationRequest(org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(<a name="line.664"></a>
-<span class="sourceLineNo">665</span>                      org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType.PUT, put1))<a name="line.665"></a>
-<span class="sourceLineNo">666</span>              .addMutationRequest(org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(<a name="line.666"></a>
-<span class="sourceLineNo">667</span>                      org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType.PUT, put2))<a name="line.667"></a>
-<span class="sourceLineNo">668</span>              .build();<a name="line.668"></a>
-<span class="sourceLineNo">669</span>          table.coprocessorService(MultiRowMutationProtos.MultiRowMutationService.class,<a name="line.669"></a>
-<span class="sourceLineNo">670</span>            ROW, ROW,<a name="line.670"></a>
-<span class="sourceLineNo">671</span>            (MultiRowMutationProtos.MultiRowMutationService exe) -&gt; {<a name="line.671"></a>
-<span class="sourceLineNo">672</span>              ServerRpcController controller = new ServerRpcController();<a name="line.672"></a>
-<span class="sourceLineNo">673</span>              CoprocessorRpcUtils.BlockingRpcCallback&lt;MultiRowMutationProtos.MutateRowsResponse&gt;<a name="line.673"></a>
-<span class="sourceLineNo">674</span>                rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback&lt;&gt;();<a name="line.674"></a>
-<span class="sourceLineNo">675</span>              exe.mutateRows(controller, request, rpcCallback);<a name="line.675"></a>
-<span class="sourceLineNo">676</span>              return rpcCallback.get();<a name="line.676"></a>
-<span class="sourceLineNo">677</span>            });<a name="line.677"></a>
-<span class="sourceLineNo">678</span>          fail("This cp should fail because the target lock is blocked by previous put");<a name="line.678"></a>
-<span class="sourceLineNo">679</span>        } catch (Throwable ex) {<a name="line.679"></a>
-<span class="sourceLineNo">680</span>          // TODO!!!! Is this right? It catches everything including the above fail<a name="line.680"></a>
-<span class="sourceLineNo">681</span>          // if it happens (which it seems too....)<a name="line.681"></a>
-<span class="sourceLineNo">682</span>        }<a name="line.682"></a>
-<span class="sourceLineNo">683</span>      });<a name="line.683"></a>
-<span class="sourceLineNo">684</span>      cpService.shutdown();<a name="line.684"></a>
-<span class="sourceLineNo">685</span>      cpService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.685"></a>
-<span class="sourceLineNo">686</span>      WatiingForMultiMutationsObserver observer = find(tableName, WatiingForMultiMutationsObserver.class);<a name="line.686"></a>
-<span class="sourceLineNo">687</span>      observer.latch.countDown();<a name="line.687"></a>
-<span class="sourceLineNo">688</span>      putService.shutdown();<a name="line.688"></a>
-<span class="sourceLineNo">689</span>      putService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.689"></a>
-<span class="sourceLineNo">690</span>      try (Table table = con.getTable(tableName)) {<a name="line.690"></a>
-<span class="sourceLineNo">691</span>        Get g0 = new Get(row);<a name="line.691"></a>
-<span class="sourceLineNo">692</span>        Get g1 = new Get(rowLocked);<a name="line.692"></a>
-<span class="sourceLineNo">693</span>        Result r0 = table.get(g0);<a name="line.693"></a>
-<span class="sourceLineNo">694</span>        Result r1 = table.get(g1);<a name="line.694"></a>
-<span class="sourceLineNo">695</span>        assertTrue(r0.isEmpty());<a name="line.695"></a>
-<span class="sourceLineNo">696</span>        assertFalse(r1.isEmpty());<a name="line.696"></a>
-<span class="sourceLineNo">697</span>        assertTrue(Bytes.equals(r1.getValue(FAMILY, QUALIFIER), value0));<a name="line.697"></a>
-<span class="sourceLineNo">698</span>      }<a name="line.698"></a>
-<span class="sourceLineNo">699</span>      assertNoLocks(tableName);<a name="line.699"></a>
-<span class="sourceLineNo">700</span>    }<a name="line.700"></a>
-<span class="sourceLineNo">701</span>  }<a name="line.701"></a>
-<span class="sourceLineNo">702</span><a name="line.702"></a>
-<span class="sourceLineNo">703</span>  /**<a name="line.703"></a>
-<span class="sourceLineNo">704</span>   * A test case for issue HBASE-17482<a name="line.704"></a>
-<span class="sourceLineNo">705</span>   * After combile seqid with mvcc readpoint, seqid/mvcc is acquired and stamped<a name="line.705"></a>
-<span class="sourceLineNo">706</span>   * onto cells in the append thread, a countdown latch is used to ensure that happened<a name="line.706"></a>
-<span class="sourceLineNo">707</span>   * before cells can be put into memstore. But the MVCCPreAssign patch(HBASE-16698)<a name="line.707"></a>
-<span class="sourceLineNo">708</span>   * make the seqid/mvcc acquirement in handler thread and stamping in append thread<a name="line.708"></a>
-<span class="sourceLineNo">709</span>   * No countdown latch to assure cells in memstore are stamped with seqid/mvcc.<a name="line.709"></a>
-<span class="sourceLineNo">710</span>   * If cells without mvcc(A.K.A mvcc=0) are put into memstore, then a scanner<a name="line.710"></a>
-<span class="sourceLineNo">711</span>   * with a smaller readpoint can see these data, which disobey the multi version<a name="line.711"></a>
-<span class="sourceLineNo">712</span>   * concurrency control rules.<a name="line.712"></a>
-<span class="sourceLineNo">713</span>   * This test case is to reproduce this scenario.<a name="line.713"></a>
-<span class="sourceLineNo">714</span>   * @throws IOException<a name="line.714"></a>
-<span class="sourceLineNo">715</span>   */<a name="line.715"></a>
-<span class="sourceLineNo">716</span>  @Test<a name="line.716"></a>
-<span class="sourceLineNo">717</span>  public void testMVCCUsingMVCCPreAssign() throws IOException {<a name="line.717"></a>
-<span class="sourceLineNo">718</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.718"></a>
-<span class="sourceLineNo">719</span>    HTableDescriptor htd = new HTableDescriptor(tableName);<a name="line.719"></a>
-<span class="sourceLineNo">720</span>    HColumnDescriptor fam = new HColumnDescriptor(FAMILY);<a name="line.720"></a>
-<span class="sourceLineNo">721</span>    htd.addFamily(fam);<a name="line.721"></a>
-<span class="sourceLineNo">722</span>    Admin admin = TEST_UTIL.getAdmin();<a name="line.722"></a>
-<span class="sourceLineNo">723</span>    admin.createTable(htd);<a name="line.723"></a>
-<span class="sourceLineNo">724</span>    Table table = admin.getConnection().getTable(TableName.valueOf(name.getMethodName()));<a name="line.724"></a>
-<span class="sourceLineNo">725</span>    //put two row first to init the scanner<a name="line.725"></a>
-<span class="sourceLineNo">726</span>    Put put = new Put(Bytes.toBytes("0"));<a name="line.726"></a>
-<span class="sourceLineNo">727</span>    put.addColumn(FAMILY, Bytes.toBytes( ""), Bytes.toBytes("0"));<a name="line.727"></a>
-<span class="sourceLineNo">728</span>    table.put(put);<a name="line.728"></a>
-<span class="sourceLineNo">729</span>    put = new Put(Bytes.toBytes("00"));<a name="line.729"></a>
-<span class="sourceLineNo">730</span>    put.addColumn(FAMILY, Bytes.toBytes( ""), Bytes.toBytes("0"));<a name="line.730"></a>
-<span class="sourceLineNo">731</span>    table.put(put);<a name="line.731"></a>
-<span class="sourceLineNo">732</span>    Scan scan = new Scan();<a name="line.732"></a>
-<span class="sourceLineNo">733</span>    scan.setTimeRange(0, Long.MAX_VALUE);<a name="line.733"></a>
-<span class="sourceLineNo">734</span>    scan.setCaching(1);<a name="line.734"></a>
-<span class="sourceLineNo">735</span>    ResultScanner scanner = table.getScanner(scan);<a name="line.735"></a>
-<span class="sourceLineNo">736</span>    int rowNum = scanner.next() != null ? 1 : 0;<a name="line.736"></a>
-<span class="sourceLineNo">737</span>    //the started scanner shouldn't see the rows put below<a name="line.737"></a>
-<span class="sourceLineNo">738</span>    for(int i = 1; i &lt; 1000; i++) {<a name="line.738"></a>
-<span class="sourceLineNo">739</span>      put = new Put(Bytes.toBytes(String.valueOf(i)));<a name="line.739"></a>
-<span class="sourceLineNo">740</span>      put.setDurability(Durability.ASYNC_WAL);<a name="line.740"></a>
-<span class="sourceLineNo">741</span>      put.addColumn(FAMILY, Bytes.toBytes( ""), Bytes.toBytes(i));<a name="line.741"></a>
-<span class="sourceLineNo">742</span>      table.put(put);<a name="line.742"></a>
-<span class="sourceLineNo">743</span>    }<a name="line.743"></a>
-<span class="sourceLineNo">744</span>    for(Result result : scanner) {<a name="line.744"></a>
-<span class="sourceLineNo">745</span>      rowNum++;<a name="line.745"></a>
+<span class="sourceLineNo">453</span>  @Test<a name="line.453"></a>
+<span class="sourceLineNo">454</span>  public void testHTableExistsMethodMultipleRegionsSingleGet() throws Exception {<a name="line.454"></a>
+<span class="sourceLineNo">455</span>    Table table = TEST_UTIL.createTable(<a name="line.455"></a>
+<span class="sourceLineNo">456</span>      TableName.valueOf(name.getMethodName()), new byte[][] { FAMILY },<a name="line.456"></a>
+<span class="sourceLineNo">457</span>      1, new byte[] { 0x00 }, new byte[] { (byte) 0xff }, 255);<a name="line.457"></a>
+<span class="sourceLineNo">458</span>    Put put = new Put(ROW);<a name="line.458"></a>
+<span class="sourceLineNo">459</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.459"></a>
+<span class="sourceLineNo">460</span><a name="line.460"></a>
+<span class="sourceLineNo">461</span>    Get get = new Get(ROW);<a name="line.461"></a>
+<span class="sourceLineNo">462</span><a name="line.462"></a>
+<span class="sourceLineNo">463</span>    boolean exist = table.exists(get);<a name="line.463"></a>
+<span class="sourceLineNo">464</span>    assertEquals(exist, false);<a name="line.464"></a>
+<span class="sourceLineNo">465</span><a name="line.465"></a>
+<span class="sourceLineNo">466</span>    table.put(put);<a name="line.466"></a>
+<span class="sourceLineNo">467</span><a name="line.467"></a>
+<span class="sourceLineNo">468</span>    exist = table.exists(get);<a name="line.468"></a>
+<span class="sourceLineNo">469</span>    assertEquals(exist, true);<a name="line.469"></a>
+<span class="sourceLineNo">470</span>  }<a name="line.470"></a>
+<span class="sourceLineNo">471</span><a name="line.471"></a>
+<span class="sourceLineNo">472</span>  @Test<a name="line.472"></a>
+<span class="sourceLineNo">473</span>  public void testHTableExistsMethodMultipleRegionsMultipleGets() throws Exception {<a name="line.473"></a>
+<span class="sourceLineNo">474</span>    Table table = TEST_UTIL.createTable(<a name="line.474"></a>
+<span class="sourceLineNo">475</span>      TableName.valueOf(name.getMethodName()),<a name="line.475"></a>
+<span class="sourceLineNo">476</span>      new byte[][] { FAMILY }, 1, new byte[] { 0x00 }, new byte[] { (byte) 0xff }, 255);<a name="line.476"></a>
+<span class="sourceLineNo">477</span>    Put put = new Put(ROW);<a name="line.477"></a>
+<span class="sourceLineNo">478</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.478"></a>
+<span class="sourceLineNo">479</span>    table.put (put);<a name="line.479"></a>
+<span class="sourceLineNo">480</span><a name="line.480"></a>
+<span class="sourceLineNo">481</span>    List&lt;Get&gt; gets = new ArrayList&lt;&gt;();<a name="line.481"></a>
+<span class="sourceLineNo">482</span>    gets.add(new Get(ANOTHERROW));<a name="line.482"></a>
+<span class="sourceLineNo">483</span>    gets.add(new Get(Bytes.add(ROW, new byte[] { 0x00 })));<a name="line.483"></a>
+<span class="sourceLineNo">484</span>    gets.add(new Get(ROW));<a name="line.484"></a>
+<span class="sourceLineNo">485</span>    gets.add(new Get(Bytes.add(ANOTHERROW, new byte[] { 0x00 })));<a name="line.485"></a>
+<span class="sourceLineNo">486</span><a name="line.486"></a>
+<span class="sourceLineNo">487</span>    LOG.info("Calling exists");<a name="line.487"></a>
+<span class="sourceLineNo">488</span>    boolean[] results = table.existsAll(gets);<a name="line.488"></a>
+<span class="sourceLineNo">489</span>    assertEquals(results[0], false);<a name="line.489"></a>
+<span class="sourceLineNo">490</span>    assertEquals(results[1], false);<a name="line.490"></a>
+<span class="sourceLineNo">491</span>    assertEquals(results[2], true);<a name="line.491"></a>
+<span class="sourceLineNo">492</span>    assertEquals(results[3], false);<a name="line.492"></a>
+<span class="sourceLineNo">493</span><a name="line.493"></a>
+<span class="sourceLineNo">494</span>    // Test with the first region.<a name="line.494"></a>
+<span class="sourceLineNo">495</span>    put = new Put(new byte[] { 0x00 });<a name="line.495"></a>
+<span class="sourceLineNo">496</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.496"></a>
+<span class="sourceLineNo">497</span>    table.put(put);<a name="line.497"></a>
+<span class="sourceLineNo">498</span><a name="line.498"></a>
+<span class="sourceLineNo">499</span>    gets = new ArrayList&lt;&gt;();<a name="line.499"></a>
+<span class="sourceLineNo">500</span>    gets.add(new Get(new byte[] { 0x00 }));<a name="line.500"></a>
+<span class="sourceLineNo">501</span>    gets.add(new Get(new byte[] { 0x00, 0x00 }));<a name="line.501"></a>
+<span class="sourceLineNo">502</span>    results = table.existsAll(gets);<a name="line.502"></a>
+<span class="sourceLineNo">503</span>    assertEquals(results[0], true);<a name="line.503"></a>
+<span class="sourceLineNo">504</span>    assertEquals(results[1], false);<a name="line.504"></a>
+<span class="sourceLineNo">505</span><a name="line.505"></a>
+<span class="sourceLineNo">506</span>    // Test with the last region<a name="line.506"></a>
+<span class="sourceLineNo">507</span>    put = new Put(new byte[] { (byte) 0xff, (byte) 0xff });<a name="line.507"></a>
+<span class="sourceLineNo">508</span>    put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.508"></a>
+<span class="sourceLineNo">509</span>    table.put(put);<a name="line.509"></a>
+<span class="sourceLineNo">510</span><a name="line.510"></a>
+<span class="sourceLineNo">511</span>    gets = new ArrayList&lt;&gt;();<a name="line.511"></a>
+<span class="sourceLineNo">512</span>    gets.add(new Get(new byte[] { (byte) 0xff }));<a name="line.512"></a>
+<span class="sourceLineNo">513</span>    gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff }));<a name="line.513"></a>
+<span class="sourceLineNo">514</span>    gets.add(new Get(new byte[] { (byte) 0xff, (byte) 0xff, (byte) 0xff }));<a name="line.514"></a>
+<span class="sourceLineNo">515</span>    results = table.existsAll(gets);<a name="line.515"></a>
+<span class="sourceLineNo">516</span>    assertEquals(results[0], false);<a name="line.516"></a>
+<span class="sourceLineNo">517</span>    assertEquals(results[1], true);<a name="line.517"></a>
+<span class="sourceLineNo">518</span>    assertEquals(results[2], false);<a name="line.518"></a>
+<span class="sourceLineNo">519</span>  }<a name="line.519"></a>
+<span class="sourceLineNo">520</span><a name="line.520"></a>
+<span class="sourceLineNo">521</span>  @Test<a name="line.521"></a>
+<span class="sourceLineNo">522</span>  public void testGetEmptyRow() throws Exception {<a name="line.522"></a>
+<span class="sourceLineNo">523</span>    //Create a table and put in 1 row<a name="line.523"></a>
+<span class="sourceLineNo">524</span>    Admin admin = TEST_UTIL.getAdmin();<a name="line.524"></a>
+<span class="sourceLineNo">525</span>    HTableDescriptor desc = new HTableDescriptor(TableName.valueOf(Bytes.toBytes(name.getMethodName())));<a name="line.525"></a>
+<span class="sourceLineNo">526</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.526"></a>
+<span class="sourceLineNo">527</span>    admin.createTable(desc);<a name="line.527"></a>
+<span class="sourceLineNo">528</span>    Table table = TEST_UTIL.getConnection().getTable(desc.getTableName());<a name="line.528"></a>
+<span class="sourceLineNo">529</span><a name="line.529"></a>
+<span class="sourceLineNo">530</span>    Put put = new Put(ROW_BYTES);<a name="line.530"></a>
+<span class="sourceLineNo">531</span>    put.addColumn(FAMILY, COL_QUAL, VAL_BYTES);<a name="line.531"></a>
+<span class="sourceLineNo">532</span>    table.put(put);<a name="line.532"></a>
+<span class="sourceLineNo">533</span><a name="line.533"></a>
+<span class="sourceLineNo">534</span>    //Try getting the row with an empty row key<a name="line.534"></a>
+<span class="sourceLineNo">535</span>    Result res = null;<a name="line.535"></a>
+<span class="sourceLineNo">536</span>    try {<a name="line.536"></a>
+<span class="sourceLineNo">537</span>      res = table.get(new Get(new byte[0]));<a name="line.537"></a>
+<span class="sourceLineNo">538</span>      fail();<a name="line.538"></a>
+<span class="sourceLineNo">539</span>    } catch (IllegalArgumentException e) {<a name="line.539"></a>
+<span class="sourceLineNo">540</span>      // Expected.<a name="line.540"></a>
+<span class="sourceLineNo">541</span>    }<a name="line.541"></a>
+<span class="sourceLineNo">542</span>    assertTrue(res == null);<a name="line.542"></a>
+<span class="sourceLineNo">543</span>    res = table.get(new Get(Bytes.toBytes("r1-not-exist")));<a name="line.543"></a>
+<span class="sourceLineNo">544</span>    assertTrue(res.isEmpty() == true);<a name="line.544"></a>
+<span class="sourceLineNo">545</span>    res = table.get(new Get(ROW_BYTES));<a name="line.545"></a>
+<span class="sourceLineNo">546</span>    assertTrue(Arrays.equals(res.getValue(FAMILY, COL_QUAL), VAL_BYTES));<a name="line.546"></a>
+<span class="sourceLineNo">547</span>    table.close();<a name="line.547"></a>
+<span class="sourceLineNo">548</span>  }<a name="line.548"></a>
+<span class="sourceLineNo">549</span><a name="line.549"></a>
+<span class="sourceLineNo">550</span>  @Test<a name="line.550"></a>
+<span class="sourceLineNo">551</span>  public void testConnectionDefaultUsesCodec() throws Exception {<a name="line.551"></a>
+<span class="sourceLineNo">552</span>    ClusterConnection con = (ClusterConnection) TEST_UTIL.getConnection();<a name="line.552"></a>
+<span class="sourceLineNo">553</span>    assertTrue(con.hasCellBlockSupport());<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>  @Test(timeout = 60000)<a name="line.556"></a>
+<span class="sourceLineNo">557</span>  public void testPutWithPreBatchMutate() throws Exception {<a name="line.557"></a>
+<span class="sourceLineNo">558</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.558"></a>
+<span class="sourceLineNo">559</span>    testPreBatchMutate(tableName, () -&gt; {<a name="line.559"></a>
+<span class="sourceLineNo">560</span>      try {<a name="line.560"></a>
+<span class="sourceLineNo">561</span>        Table t = TEST_UTIL.getConnection().getTable(tableName);<a name="line.561"></a>
+<span class="sourceLineNo">562</span>        Put put = new Put(ROW);<a name="line.562"></a>
+<span class="sourceLineNo">563</span>        put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.563"></a>
+<span class="sourceLineNo">564</span>        t.put(put);<a name="line.564"></a>
+<span class="sourceLineNo">565</span>      } catch (IOException ex) {<a name="line.565"></a>
+<span class="sourceLineNo">566</span>        throw new RuntimeException(ex);<a name="line.566"></a>
+<span class="sourceLineNo">567</span>      }<a name="line.567"></a>
+<span class="sourceLineNo">568</span>    });<a name="line.568"></a>
+<span class="sourceLineNo">569</span>  }<a name="line.569"></a>
+<span class="sourceLineNo">570</span><a name="line.570"></a>
+<span class="sourceLineNo">571</span>  @Test(timeout = 60000)<a name="line.571"></a>
+<span class="sourceLineNo">572</span>  public void testRowMutationsWithPreBatchMutate() throws Exception {<a name="line.572"></a>
+<span class="sourceLineNo">573</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.573"></a>
+<span class="sourceLineNo">574</span>    testPreBatchMutate(tableName, () -&gt; {<a name="line.574"></a>
+<span class="sourceLineNo">575</span>      try {<a name="line.575"></a>
+<span class="sourceLineNo">576</span>        RowMutations rm = new RowMutations(ROW, 1);<a name="line.576"></a>
+<span class="sourceLineNo">577</span>        Table t = TEST_UTIL.getConnection().getTable(tableName);<a name="line.577"></a>
+<span class="sourceLineNo">578</span>        Put put = new Put(ROW);<a name="line.578"></a>
+<span class="sourceLineNo">579</span>        put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.579"></a>
+<span class="sourceLineNo">580</span>        rm.add(put);<a name="line.580"></a>
+<span class="sourceLineNo">581</span>        t.mutateRow(rm);<a name="line.581"></a>
+<span class="sourceLineNo">582</span>      } catch (IOException ex) {<a name="line.582"></a>
+<span class="sourceLineNo">583</span>        throw new RuntimeException(ex);<a name="line.583"></a>
+<span class="sourceLineNo">584</span>      }<a name="line.584"></a>
+<span class="sourceLineNo">585</span>    });<a name="line.585"></a>
+<span class="sourceLineNo">586</span>  }<a name="line.586"></a>
+<span class="sourceLineNo">587</span><a name="line.587"></a>
+<span class="sourceLineNo">588</span>  private void testPreBatchMutate(TableName tableName, Runnable rn)throws Exception {<a name="line.588"></a>
+<span class="sourceLineNo">589</span>    HTableDescriptor desc = new HTableDescriptor(tableName);<a name="line.589"></a>
+<span class="sourceLineNo">590</span>    desc.addCoprocessor(WatiingForScanObserver.class.getName());<a name="line.590"></a>
+<span class="sourceLineNo">591</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.591"></a>
+<span class="sourceLineNo">592</span>    TEST_UTIL.getAdmin().createTable(desc);<a name="line.592"></a>
+<span class="sourceLineNo">593</span>    ExecutorService service = Executors.newFixedThreadPool(2);<a name="line.593"></a>
+<span class="sourceLineNo">594</span>    service.execute(rn);<a name="line.594"></a>
+<span class="sourceLineNo">595</span>    final List&lt;Cell&gt; cells = new ArrayList&lt;&gt;();<a name="line.595"></a>
+<span class="sourceLineNo">596</span>    service.execute(() -&gt; {<a name="line.596"></a>
+<span class="sourceLineNo">597</span>      try {<a name="line.597"></a>
+<span class="sourceLineNo">598</span>        // waiting for update.<a name="line.598"></a>
+<span class="sourceLineNo">599</span>        TimeUnit.SECONDS.sleep(3);<a name="line.599"></a>
+<span class="sourceLineNo">600</span>        Table t = TEST_UTIL.getConnection().getTable(tableName);<a name="line.600"></a>
+<span class="sourceLineNo">601</span>        Scan scan = new Scan();<a name="line.601"></a>
+<span class="sourceLineNo">602</span>        try (ResultScanner scanner = t.getScanner(scan)) {<a name="line.602"></a>
+<span class="sourceLineNo">603</span>          for (Result r : scanner) {<a name="line.603"></a>
+<span class="sourceLineNo">604</span>            cells.addAll(Arrays.asList(r.rawCells()));<a name="line.604"></a>
+<span class="sourceLineNo">605</span>          }<a name="line.605"></a>
+<span class="sourceLineNo">606</span>        }<a name="line.606"></a>
+<span class="sourceLineNo">607</span>      } catch (IOException | InterruptedException ex) {<a name="line.607"></a>
+<span class="sourceLineNo">608</span>        throw new RuntimeException(ex);<a name="line.608"></a>
+<span class="sourceLineNo">609</span>      }<a name="line.609"></a>
+<span class="sourceLineNo">610</span>    });<a name="line.610"></a>
+<span class="sourceLineNo">611</span>    service.shutdown();<a name="line.611"></a>
+<span class="sourceLineNo">612</span>    service.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.612"></a>
+<span class="sourceLineNo">613</span>    assertEquals("The write is blocking by RegionObserver#postBatchMutate"<a name="line.613"></a>
+<span class="sourceLineNo">614</span>      + ", so the data is invisible to reader", 0, cells.size());<a name="line.614"></a>
+<span class="sourceLineNo">615</span>    TEST_UTIL.deleteTable(tableName);<a name="line.615"></a>
+<span class="sourceLineNo">616</span>  }<a name="line.616"></a>
+<span class="sourceLineNo">617</span><a name="line.617"></a>
+<span class="sourceLineNo">618</span>  @Test(timeout = 30000)<a name="line.618"></a>
+<span class="sourceLineNo">619</span>  public void testLockLeakWithDelta() throws Exception, Throwable {<a name="line.619"></a>
+<span class="sourceLineNo">620</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.620"></a>
+<span class="sourceLineNo">621</span>    HTableDescriptor desc = new HTableDescriptor(tableName);<a name="line.621"></a>
+<span class="sourceLineNo">622</span>    desc.addCoprocessor(WatiingForMultiMutationsObserver.class.getName());<a name="line.622"></a>
+<span class="sourceLineNo">623</span>    desc.setConfiguration("hbase.rowlock.wait.duration", String.valueOf(5000));<a name="line.623"></a>
+<span class="sourceLineNo">624</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.624"></a>
+<span class="sourceLineNo">625</span>    TEST_UTIL.getAdmin().createTable(desc);<a name="line.625"></a>
+<span class="sourceLineNo">626</span>    // new a connection for lower retry number.<a name="line.626"></a>
+<span class="sourceLineNo">627</span>    Configuration copy = new Configuration(TEST_UTIL.getConfiguration());<a name="line.627"></a>
+<span class="sourceLineNo">628</span>    copy.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);<a name="line.628"></a>
+<span class="sourceLineNo">629</span>    try (Connection con = ConnectionFactory.createConnection(copy)) {<a name="line.629"></a>
+<span class="sourceLineNo">630</span>      HRegion region = (HRegion) find(tableName);<a name="line.630"></a>
+<span class="sourceLineNo">631</span>      region.setTimeoutForWriteLock(10);<a name="line.631"></a>
+<span class="sourceLineNo">632</span>      ExecutorService putService = Executors.newSingleThreadExecutor();<a name="line.632"></a>
+<span class="sourceLineNo">633</span>      putService.execute(() -&gt; {<a name="line.633"></a>
+<span class="sourceLineNo">634</span>        try (Table table = con.getTable(tableName)) {<a name="line.634"></a>
+<span class="sourceLineNo">635</span>          Put put = new Put(ROW);<a name="line.635"></a>
+<span class="sourceLineNo">636</span>          put.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.636"></a>
+<span class="sourceLineNo">637</span>          // the put will be blocked by WatiingForMultiMutationsObserver.<a name="line.637"></a>
+<span class="sourceLineNo">638</span>          table.put(put);<a name="line.638"></a>
+<span class="sourceLineNo">639</span>        } catch (IOException ex) {<a name="line.639"></a>
+<span class="sourceLineNo">640</span>          throw new RuntimeException(ex);<a name="line.640"></a>
+<span class="sourceLineNo">641</span>        }<a name="line.641"></a>
+<span class="sourceLineNo">642</span>      });<a name="line.642"></a>
+<span class="sourceLineNo">643</span>      ExecutorService appendService = Executors.newSingleThreadExecutor();<a name="line.643"></a>
+<span class="sourceLineNo">644</span>      appendService.execute(() -&gt; {<a name="line.644"></a>
+<span class="sourceLineNo">645</span>        Append append = new Append(ROW);<a name="line.645"></a>
+<span class="sourceLineNo">646</span>        append.addColumn(FAMILY, QUALIFIER, VALUE);<a name="line.646"></a>
+<span class="sourceLineNo">647</span>        try (Table table = con.getTable(tableName)) {<a name="line.647"></a>
+<span class="sourceLineNo">648</span>          table.append(append);<a name="line.648"></a>
+<span class="sourceLineNo">649</span>          fail("The APPEND should fail because the target lock is blocked by previous put");<a name="line.649"></a>
+<span class="sourceLineNo">650</span>        } catch (Throwable ex) {<a name="line.650"></a>
+<span class="sourceLineNo">651</span>        }<a name="line.651"></a>
+<span class="sourceLineNo">652</span>      });<a name="line.652"></a>
+<span class="sourceLineNo">653</span>      appendService.shutdown();<a name="line.653"></a>
+<span class="sourceLineNo">654</span>      appendService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.654"></a>
+<span class="sourceLineNo">655</span>      WatiingForMultiMutationsObserver observer = find(tableName, WatiingForMultiMutationsObserver.class);<a name="line.655"></a>
+<span class="sourceLineNo">656</span>      observer.latch.countDown();<a name="line.656"></a>
+<span class="sourceLineNo">657</span>      putService.shutdown();<a name="line.657"></a>
+<span class="sourceLineNo">658</span>      putService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.658"></a>
+<span class="sourceLineNo">659</span>      try (Table table = con.getTable(tableName)) {<a name="line.659"></a>
+<span class="sourceLineNo">660</span>        Result r = table.get(new Get(ROW));<a name="line.660"></a>
+<span class="sourceLineNo">661</span>        assertFalse(r.isEmpty());<a name="line.661"></a>
+<span class="sourceLineNo">662</span>        assertTrue(Bytes.equals(r.getValue(FAMILY, QUALIFIER), VALUE));<a name="line.662"></a>
+<span class="sourceLineNo">663</span>      }<a name="line.663"></a>
+<span class="sourceLineNo">664</span>    }<a name="line.664"></a>
+<span class="sourceLineNo">665</span>    HRegion region = (HRegion) find(tableName);<a name="line.665"></a>
+<span class="sourceLineNo">666</span>    int readLockCount = region.getReadLockCount();<a name="line.666"></a>
+<span class="sourceLineNo">667</span>    LOG.info("readLockCount:" + readLockCount);<a name="line.667"></a>
+<span class="sourceLineNo">668</span>    assertEquals(0, readLockCount);<a name="line.668"></a>
+<span class="sourceLineNo">669</span>  }<a name="line.669"></a>
+<span class="sourceLineNo">670</span><a name="line.670"></a>
+<span class="sourceLineNo">671</span>  @Test(timeout = 30000)<a name="line.671"></a>
+<span class="sourceLineNo">672</span>  public void testMultiRowMutations() throws Exception, Throwable {<a name="line.672"></a>
+<span class="sourceLineNo">673</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.673"></a>
+<span class="sourceLineNo">674</span>    HTableDescriptor desc = new HTableDescriptor(tableName);<a name="line.674"></a>
+<span class="sourceLineNo">675</span>    desc.addCoprocessor(MultiRowMutationEndpoint.class.getName());<a name="line.675"></a>
+<span class="sourceLineNo">676</span>    desc.addCoprocessor(WatiingForMultiMutationsObserver.class.getName());<a name="line.676"></a>
+<span class="sourceLineNo">677</span>    desc.setConfiguration("hbase.rowlock.wait.duration", String.valueOf(5000));<a name="line.677"></a>
+<span class="sourceLineNo">678</span>    desc.addFamily(new HColumnDescriptor(FAMILY));<a name="line.678"></a>
+<span class="sourceLineNo">679</span>    TEST_UTIL.getAdmin().createTable(desc);<a name="line.679"></a>
+<span class="sourceLineNo">680</span>    // new a connection for lower retry number.<a name="line.680"></a>
+<span class="sourceLineNo">681</span>    Configuration copy = new Configuration(TEST_UTIL.getConfiguration());<a name="line.681"></a>
+<span class="sourceLineNo">682</span>    copy.setInt(HConstants.HBASE_CLIENT_RETRIES_NUMBER, 2);<a name="line.682"></a>
+<span class="sourceLineNo">683</span>    try (Connection con = ConnectionFactory.createConnection(copy)) {<a name="line.683"></a>
+<span class="sourceLineNo">684</span>      byte[] row = Bytes.toBytes("ROW-0");<a name="line.684"></a>
+<span class="sourceLineNo">685</span>      byte[] rowLocked= Bytes.toBytes("ROW-1");<a name="line.685"></a>
+<span class="sourceLineNo">686</span>      byte[] value0 = Bytes.toBytes("VALUE-0");<a name="line.686"></a>
+<span class="sourceLineNo">687</span>      byte[] value1 = Bytes.toBytes("VALUE-1");<a name="line.687"></a>
+<span class="sourceLineNo">688</span>      byte[] value2 = Bytes.toBytes("VALUE-2");<a name="line.688"></a>
+<span class="sourceLineNo">689</span>      assertNoLocks(tableName);<a name="line.689"></a>
+<span class="sourceLineNo">690</span>      ExecutorService putService = Executors.newSingleThreadExecutor();<a name="line.690"></a>
+<span class="sourceLineNo">691</span>      putService.execute(() -&gt; {<a name="line.691"></a>
+<span class="sourceLineNo">692</span>        try (Table table = con.getTable(tableName)) {<a name="line.692"></a>
+<span class="sourceLineNo">693</span>          Put put0 = new Put(rowLocked);<a name="line.693"></a>
+<span class="sourceLineNo">694</span>          put0.addColumn(FAMILY, QUALIFIER, value0);<a name="line.694"></a>
+<span class="sourceLineNo">695</span>          // the put will be blocked by WatiingForMultiMutationsObserver.<a name="line.695"></a>
+<span class="sourceLineNo">696</span>          table.put(put0);<a name="line.696"></a>
+<span class="sourceLineNo">697</span>        } catch (IOException ex) {<a name="line.697"></a>
+<span class="sourceLineNo">698</span>          throw new RuntimeException(ex);<a name="line.698"></a>
+<span class="sourceLineNo">699</span>        }<a name="line.699"></a>
+<span class="sourceLineNo">700</span>      });<a name="line.700"></a>
+<span class="sourceLineNo">701</span>      ExecutorService cpService = Executors.newSingleThreadExecutor();<a name="line.701"></a>
+<span class="sourceLineNo">702</span>      cpService.execute(() -&gt; {<a name="line.702"></a>
+<span class="sourceLineNo">703</span>        Put put1 = new Put(row);<a name="line.703"></a>
+<span class="sourceLineNo">704</span>        Put put2 = new Put(rowLocked);<a name="line.704"></a>
+<span class="sourceLineNo">705</span>        put1.addColumn(FAMILY, QUALIFIER, value1);<a name="line.705"></a>
+<span class="sourceLineNo">706</span>        put2.addColumn(FAMILY, QUALIFIER, value2);<a name="line.706"></a>
+<span class="sourceLineNo">707</span>        try (Table table = con.getTable(tableName)) {<a name="line.707"></a>
+<span class="sourceLineNo">708</span>          MultiRowMutationProtos.MutateRowsRequest request<a name="line.708"></a>
+<span class="sourceLineNo">709</span>            = MultiRowMutationProtos.MutateRowsRequest.newBuilder()<a name="line.709"></a>
+<span class="sourceLineNo">710</span>              .addMutationRequest(org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(<a name="line.710"></a>
+<span class="sourceLineNo">711</span>                      org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType.PUT, put1))<a name="line.711"></a>
+<span class="sourceLineNo">712</span>              .addMutationRequest(org.apache.hadoop.hbase.protobuf.ProtobufUtil.toMutation(<a name="line.712"></a>
+<span class="sourceLineNo">713</span>                      org.apache.hadoop.hbase.protobuf.generated.ClientProtos.MutationProto.MutationType.PUT, put2))<a name="line.713"></a>
+<span class="sourceLineNo">714</span>              .build();<a name="line.714"></a>
+<span class="sourceLineNo">715</span>          table.coprocessorService(MultiRowMutationProtos.MultiRowMutationService.class,<a name="line.715"></a>
+<span class="sourceLineNo">716</span>            ROW, ROW,<a name="line.716"></a>
+<span class="sourceLineNo">717</span>            (MultiRowMutationProtos.MultiRowMutationService exe) -&gt; {<a name="line.717"></a>
+<span class="sourceLineNo">718</span>              ServerRpcController controller = new ServerRpcController();<a name="line.718"></a>
+<span class="sourceLineNo">719</span>              CoprocessorRpcUtils.BlockingRpcCallback&lt;MultiRowMutationProtos.MutateRowsResponse&gt;<a name="line.719"></a>
+<span class="sourceLineNo">720</span>                rpcCallback = new CoprocessorRpcUtils.BlockingRpcCallback&lt;&gt;();<a name="line.720"></a>
+<span class="sourceLineNo">721</span>              exe.mutateRows(controller, request, rpcCallback);<a name="line.721"></a>
+<span class="sourceLineNo">722</span>              return rpcCallback.get();<a name="line.722"></a>
+<span class="sourceLineNo">723</span>            });<a name="line.723"></a>
+<span class="sourceLineNo">724</span>          fail("This cp should fail because the target lock is blocked by previous put");<a name="line.724"></a>
+<span class="sourceLineNo">725</span>        } catch (Throwable ex) {<a name="line.725"></a>
+<span class="sourceLineNo">726</span>          // TODO!!!! Is this right? It catches everything including the above fail<a name="line.726"></a>
+<span class="sourceLineNo">727</span>          // if it happens (which it seems too....)<a name="line.727"></a>
+<span class="sourceLineNo">728</span>        }<a name="line.728"></a>
+<span class="sourceLineNo">729</span>      });<a name="line.729"></a>
+<span class="sourceLineNo">730</span>      cpService.shutdown();<a name="line.730"></a>
+<span class="sourceLineNo">731</span>      cpService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.731"></a>
+<span class="sourceLineNo">732</span>      WatiingForMultiMutationsObserver observer = find(tableName, WatiingForMultiMutationsObserver.class);<a name="line.732"></a>
+<span class="sourceLineNo">733</span>      observer.latch.countDown();<a name="line.733"></a>
+<span class="sourceLineNo">734</span>      putService.shutdown();<a name="line.734"></a>
+<span class="sourceLineNo">735</span>      putService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS);<a name="line.735"></a>
+<span class="sourceLineNo">736</span>      try (Table table = con.getTable(tableName)) {<a name="line.736"></a>
+<span class="sourceLineNo">737</span>        Get g0 = new Get(row);<a name="line.737"></a>
+<span class="sourceLineNo">738</span>        Get g1 = new Get(rowLocked);<a name="line.738"></a>
+<span class="sourceLineNo">739</span>        Result r0 = table.get(g0);<a name="line.739"></a>
+<span class="sourceLineNo">740</span>        Result r1 = table.get(g1);<a name="line.740"></a>
+<span class="sourceLineNo">741</span>        assertTrue(r0.isEmpty());<a name="line.741"></a>
+<span class="sourceLineNo">742</span>        assertFalse(r1.isEmpty());<a name="line.742"></a>
+<span class="sourceLineNo">743</span>        assertTrue(Bytes.equals(r1.getValue(FAMILY, QUALIFIER), value0));<a name="line.743"></a>
+<span class="sourceLineNo">744</span>      }<a name="line.744"></a>
+<span class="sourceLineNo">745</span>      assertNoLocks(tableName);<a name="line.745"></a>
 <span class="sourceLineNo">746</span>    }<a name="line.746"></a>
-<span class="sourceLineNo">747</span>    //scanner should only see two rows<a name="line.747"></a>
-<span class="sourceLineNo">748</span>    assertEquals(2, rowNum);<a name="line.748"></a>
-<span class="sourceLineNo">749</span>    scanner = table.getScanner(scan);<a name="line.749"></a>
-<span class="sourceLineNo">750</span>    rowNum = 0;<a name="line.750"></a>
-<span class="sourceLineNo">751</span>    for(Result result : scanner) {<a name="line.751"></a>
-<span class="sourceLineNo">752</span>      rowNum++;<a name="line.752"></a>
-<span class="sourceLineNo">753</span>    }<a name="line.753"></a>
-<span class="sourceLineNo">754</span>    // the new scanner should see all rows<a name="line.754"></a>
-<span class="sourceLineNo">755</span>    assertEquals(1001, rowNum);<a name="line.755"></a>
-<span class="sourceLineNo">756</span><a name="line.756"></a>
-<span class="sourceLineNo">757</span><a name="line.757"></a>
-<span class="sourceLineNo">758</span>  }<a name="line.758"></a>
-<span class="sourceLineNo">759</span><a name="line.759"></a>
-<span class="sourceLineNo">760</span>  @Test<a name="line.760"></a>
-<span class="sourceLineNo">761</span>  public void testPutThenGetWithMultipleThreads() throws Exception {<a name="line.761"></a>
-<span class="sourceLineNo">762</span>    final TableName tableName = TableName.valueOf(name.getMethodName());<a name="line.762"></a>
-<span class="sourceLineNo">763</span>    final int THREAD_NUM = 20;<a name="line.763"></a>
-<span class="sourceLineNo">764</span>    final int ROUND_NUM = 10;<a name="line.764"></a>
-<span class="sourceLineNo">765</span>    for (int round = 0; round &lt; ROUND_NUM; round++) {<a name="line.765"></a>
-<span class="sourceLineNo">766</span>      ArrayList&lt;Thread&gt; threads = new ArrayList&lt;&gt;(THREAD_NUM);<a name="line.766"></a>
-<span class="sourceLineNo">767</span>      final AtomicInteger successCnt = new AtomicInteger(0);<a name="line.767"></a>
-<span class="sourceLineNo">768</span>      Table ht = TEST_UTIL.createTable(tableName, FAMILY);<a name="line.768"></a>
-<span class="sourceLineNo">769</span>      for (int i = 0; i &lt; THREAD_NUM; i++) {<a name="line.769"></a>
-<span class="sourceLineNo">770</span>        final int index = i;<a name="line.770"></a>
-<span class="sourceLineNo">771</span>        Thread t = new Thread(new

<TRUNCATED>

Mime
View raw message