private void testReverseScanWithDBE(Connection conn, DataBlockEncoding encoding, byte[] family,
    int blockSize, int maxRows) throws IOException {
    LOG.info("Running test with DBE={}", encoding);
    TableName tableName = TableName.valueOf(TEST_NAME.getMethodName() + "-" + encoding);
    TEST_UTIL.createTable(
      TableDescriptorBuilder.newBuilder(tableName).setColumnFamily(ColumnFamilyDescriptorBuilder
        .newBuilder(family).setDataBlockEncoding(encoding).setBlocksize(blockSize).build()).build(),
      null);

    Table table = conn.getTable(tableName);

    byte[] val1 = new byte[10];
    byte[] val2 = new byte[10];
    Bytes.random(val1);
    Bytes.random(val2);

    for (int i = 0; i < maxRows; i++) {
      table.put(new Put(Bytes.toBytes(i)).addColumn(family, Bytes.toBytes(1), val1)
        .addColumn(family, Bytes.toBytes(2), val2).setTTL(600_000));
    }

    TEST_UTIL.flush(table.getName());

    Scan scan = new Scan();
    scan.setReversed(true);

    try (ResultScanner scanner = table.getScanner(scan)) {
      for (int i = maxRows - 1; i >= 0; i--) {
        Result row = scanner.next();
        assertEquals(2, row.size());

        Cell cell1 = row.getColumnLatestCell(family, Bytes.toBytes(1));
        assertTrue(CellUtil.matchingRows(cell1, Bytes.toBytes(i)));
        assertTrue(CellUtil.matchingValue(cell1, val1));

        Cell cell2 = row.getColumnLatestCell(family, Bytes.toBytes(2));
        assertTrue(CellUtil.matchingRows(cell2, Bytes.toBytes(i)));
        assertTrue(CellUtil.matchingValue(cell2, val2));
      }
    }

  }
Test that we can do reverse scans when writing tags and using DataBlockEncoding. Fails with an
exception for PREFIX, DIFF, and FAST_DIFF
hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestTags.java