@Test
  public void testOptimizeAndGetWithFakedNextBlockIndexStart() throws IOException {
    // First test a Get of second column in the row R2. Every Get is a Scan. Second column has a
    // qualifier of R2.
    Get get = new Get(THREE);
    get.addColumn(CF, TWO);
    Scan scan = new Scan(get);
    try (CellGridStoreScanner scanner = new CellGridStoreScanner(scan, this.scanInfo)) {
      List<Cell> results = new ArrayList<>();
      // For a Get there should be no more next's after the first call.
      assertEquals(false, scanner.next(results));
      // Should be one result only.
      assertEquals(1, results.size());
      // And we should have gone through optimize twice only.
      assertEquals("First qcode is SEEK_NEXT_COL and second INCLUDE_AND_SEEK_NEXT_ROW", 2,
        scanner.count.get());
    }
  }
Ensure that optimize does not cause the Get to do more seeking than required. Optimize (see
HBASE-15392) was causing us to seek all Cells in a block when a Get Scan if the next block
index/start key was a different row to the current one. A bug. We'd call next too often because
we had to exhaust all Cells in the current row making us load the next block just to discard
what we read there. This test is a little cryptic. Takes a bit of staring to figure what it up
to.
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestStoreScanner.java