@Test
  public void testScanSameTimestamp() throws IOException {
    // returns only 1 of these 2 even though same timestamp
    KeyValue[] kvs = new KeyValue[] { create("R1", "cf", "a", 1, KeyValue.Type.Put, "dont-care"),
      create("R1", "cf", "a", 1, KeyValue.Type.Put, "dont-care"), };
    List<KeyValueScanner> scanners = Arrays
      .asList(new KeyValueScanner[] { new KeyValueScanFixture(CellComparator.getInstance(), kvs) });

    Scan scanSpec = new Scan().withStartRow(Bytes.toBytes("R1"));
    // this only uses maxVersions (default=1) and TimeRange (default=all)
    try (StoreScanner scan = new StoreScanner(scanSpec, scanInfo, null, scanners)) {
      List<Cell> results = new ArrayList<>();
      assertEquals(true, scan.next(results));
      assertEquals(1, results.size());
      assertEquals(1, scan.memstoreOnlyReads);
      assertEquals(kvs[0], results.get(0));
    }
  }
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