@Test
  public void testDuplicateIncrement() throws Exception {
    TableDescriptorBuilder builder =
      TEST_UTIL.createModifyableTableDescriptor(name.getMethodName());
    Map<String, String> kvs = new HashMap<>();
    kvs.put(SleepAtFirstRpcCall.SLEEP_TIME_CONF_KEY, "2000");
    builder.setCoprocessor(CoprocessorDescriptorBuilder
      .newBuilder(SleepAtFirstRpcCall.class.getName()).setPriority(1).setProperties(kvs).build());
    TEST_UTIL.createTable(builder.build(), new byte[][] { ROW }).close();

    Configuration c = new Configuration(TEST_UTIL.getConfiguration());
    c.setInt(HConstants.HBASE_CLIENT_PAUSE, 50);
    // Client will retry beacuse rpc timeout is small than the sleep time of first rpc call
    c.setInt(HConstants.HBASE_RPC_TIMEOUT_KEY, 1500);

    try (Connection connection = ConnectionFactory.createConnection(c);
      Table table = connection.getTableBuilder(TableName.valueOf(name.getMethodName()), null)
        .setOperationTimeout(3 * 1000).build()) {
      Increment inc = new Increment(ROW);
      inc.addColumn(HBaseTestingUtil.fam1, QUALIFIER, 1);
      Result result = table.increment(inc);

      Cell[] cells = result.rawCells();
      assertEquals(1, cells.length);
      assertIncrementKey(cells[0], ROW, HBaseTestingUtil.fam1, QUALIFIER, 1);

      // Verify expected result
      Result readResult = table.get(new Get(ROW));
      cells = readResult.rawCells();
      assertEquals(1, cells.length);
      assertIncrementKey(cells[0], ROW, HBaseTestingUtil.fam1, QUALIFIER, 1);
    }
  }
Test increment result when there are duplicate rpc request.
hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestIncrementsFromClientSide.java