@Test
public void testCleanLockFromSecondary() throws IOException {

  ColumnCoordinate columnCoordinate = SECONDARY_COLUMNS[1];
  ThemisLock from = getLock(columnCoordinate);
  // primary lock exist
  writeLockAndData(COLUMN);
  prepareCleanSecondaryLocks(false);
  lockCleaner.cleanLock(from);
  checkTransactionRollback();
  // transaction committed with primary lock cleaned
  deleteOldDataAndUpdateTs();
  writePutAndData(COLUMN, prewriteTs, commitTs);
  prepareCleanSecondaryLocks(true);
  from = getLock(columnCoordinate);
  lockCleaner.cleanLock(from);
  checkColumnsCommitSuccess(new ColumnCoordinate[]{COLUMN, SECONDARY_COLUMNS[0], SECONDARY_COLUMNS[1]});
  checkColumnsPrewriteSuccess(new ColumnCoordinate[]{SECONDARY_COLUMNS[2], SECONDARY_COLUMNS[3]});
  // transaction uncommitted with primary lock erased
  deleteOldDataAndUpdateTs();
  writeData(COLUMN, prewriteTs);
  prepareCleanSecondaryLocks(false);
  from = getLock(columnCoordinate);
  lockCleaner.cleanLock(from);
  checkColumnsRallback(new ColumnCoordinate[]{COLUMN, SECONDARY_COLUMNS[0], SECONDARY_COLUMNS[1]});
  checkColumnsPrewriteSuccess(new ColumnCoordinate[]{SECONDARY_COLUMNS[2], SECONDARY_COLUMNS[3]});
}