@Test
public void testCleanPrimaryLock() throws IOException {

  // lock exist
  writeLockAndData(COLUMN);
  Pair<Long, PrimaryLock> result = lockCleaner.cleanPrimaryLock(COLUMN, prewriteTs);
  Assert.assertNull(result.getFirst());
  Assert.assertEquals(getLock(COLUMN), result.getSecond());
  Assert.assertNull(readLockBytes(COLUMN));
  // transaction committed with lock cleaned
  boolean[] isPuts = new boolean[]{true, false};
  for (boolean isPut : isPuts) {
    deleteOldDataAndUpdateTs();
    writeWriteColumn(COLUMN, prewriteTs, commitTs, isPut);
    result = lockCleaner.cleanPrimaryLock(COLUMN, prewriteTs);
    Assert.assertEquals(commitTs, result.getFirst().longValue());
    Assert.assertNull(result.getSecond());
  }
  // transaction uncommitted with lock erased
  deleteOldDataAndUpdateTs();
  result = lockCleaner.cleanPrimaryLock(COLUMN, prewriteTs);
  Assert.assertNull(result.getFirst());
  Assert.assertNull(result.getSecond());
}