ServerLockCleaner { public static PrimaryLock getPrimaryLockWithColumn(ThemisLock lock) { if (lock.isPrimary()) { return (PrimaryLock)lock; } else { PrimaryLock primaryLock = new PrimaryLock(); primaryLock.setColumn(((SecondaryLock)lock).getPrimaryColumn()); ThemisLock.copyThemisLock(lock, primaryLock); primaryLock.addSecondaryColumn(lock.getColumn(), lock.getType()); return primaryLock; } } ServerLockCleaner(HConnection conn, ThemisCoprocessorClient cpClient); static PrimaryLock getPrimaryLockWithColumn(ThemisLock lock); void cleanLock(ThemisLock lock); Pair<Long, PrimaryLock> cleanPrimaryLock(ColumnCoordinate columnCoordinate,
      long prewriteTs); Long getTimestampOfWriteIndexingPrewriteTs(ColumnCoordinate columnCoordinate, long timestamp); Get createGetOfWriteColumnsIndexingPrewriteTs(ColumnCoordinate columnCoordinate, long timestamp); void cleanSecondaryLocks(PrimaryLock primaryLock, Long commitTs); void eraseLockAndData(ColumnCoordinate column, long timestamp); void eraseLockAndData(byte[] tableName, byte[] row, Collection<Column> columns, long timestamp);  }
@Test public void testGetPrimaryLockWithColumn() throws IOException { PrimaryLock primary = (PrimaryLock)getLock(COLUMN); PrimaryLock actual = ServerLockCleaner.getPrimaryLockWithColumn(primary); Assert.assertTrue(primary.equals(actual)); Assert.assertTrue(COLUMN.equals(actual.getColumn())); SecondaryLock secondary = (SecondaryLock)getLock(COLUMN_WITH_ANOTHER_ROW); actual = ServerLockCleaner.getPrimaryLockWithColumn(secondary); Assert.assertTrue(COLUMN.equals(actual.getColumn())); Assert.assertTrue(actual.isPrimary()); Assert.assertEquals(Type.Minimum, actual.getType()); Assert.assertEquals(1, actual.getSecondaryColumns().size()); Assert.assertNotNull(actual.getSecondaryColumns().get(COLUMN_WITH_ANOTHER_ROW)); }