@Test public void testCleanSecondaryLocks() throws IOException { prepareCleanSecondaryLocks(true); lockCleaner.cleanSecondaryLocks((PrimaryLock)getLock(COLUMN), commitTs); checkCommitSecondariesSuccess(); deleteOldDataAndUpdateTs(); prepareCleanSecondaryLocks(false); lockCleaner.cleanSecondaryLocks((PrimaryLock)getLock(COLUMN), null); checkSecondariesRollback(); }
public void cleanSecondaryLocks(PrimaryLock primaryLock, Long commitTs) throws IOException { for (Entry<ColumnCoordinate, Type> secondary : primaryLock.getSecondaryColumns().entrySet()) { if (commitTs == null) { eraseLockAndData(secondary.getKey(), primaryLock.getTimestamp()); } else { ColumnCoordinate column = secondary.getKey(); ColumnMutation columnMutation = new ColumnMutation(column, secondary.getValue(), null); cpClient.commitSecondaryRow(column.getTableName(), column.getRow(), Lists.newArrayList(columnMutation), primaryLock.getTimestamp(), commitTs); } } }
ServerLockCleaner { public void cleanSecondaryLocks(PrimaryLock primaryLock, Long commitTs) throws IOException { for (Entry<ColumnCoordinate, Type> secondary : primaryLock.getSecondaryColumns().entrySet()) { if (commitTs == null) { eraseLockAndData(secondary.getKey(), primaryLock.getTimestamp()); } else { ColumnCoordinate column = secondary.getKey(); ColumnMutation columnMutation = new ColumnMutation(column, secondary.getValue(), null); cpClient.commitSecondaryRow(column.getTableName(), column.getRow(), Lists.newArrayList(columnMutation), primaryLock.getTimestamp(), commitTs); } } } }
ServerLockCleaner { public void cleanSecondaryLocks(PrimaryLock primaryLock, Long commitTs) throws IOException { for (Entry<ColumnCoordinate, Type> secondary : primaryLock.getSecondaryColumns().entrySet()) { if (commitTs == null) { eraseLockAndData(secondary.getKey(), primaryLock.getTimestamp()); } else { ColumnCoordinate column = secondary.getKey(); ColumnMutation columnMutation = new ColumnMutation(column, secondary.getValue(), null); cpClient.commitSecondaryRow(column.getTableName(), column.getRow(), Lists.newArrayList(columnMutation), primaryLock.getTimestamp(), commitTs); } } } ServerLockCleaner(HConnection conn, ThemisCoprocessorClient cpClient); }
ServerLockCleaner { public void cleanSecondaryLocks(PrimaryLock primaryLock, Long commitTs) throws IOException { for (Entry<ColumnCoordinate, Type> secondary : primaryLock.getSecondaryColumns().entrySet()) { if (commitTs == null) { eraseLockAndData(secondary.getKey(), primaryLock.getTimestamp()); } else { ColumnCoordinate column = secondary.getKey(); ColumnMutation columnMutation = new ColumnMutation(column, secondary.getValue(), null); cpClient.commitSecondaryRow(column.getTableName(), column.getRow(), Lists.newArrayList(columnMutation), primaryLock.getTimestamp(), commitTs); } } } 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); }
ServerLockCleaner { public void cleanSecondaryLocks(PrimaryLock primaryLock, Long commitTs) throws IOException { for (Entry<ColumnCoordinate, Type> secondary : primaryLock.getSecondaryColumns().entrySet()) { if (commitTs == null) { eraseLockAndData(secondary.getKey(), primaryLock.getTimestamp()); } else { ColumnCoordinate column = secondary.getKey(); ColumnMutation columnMutation = new ColumnMutation(column, secondary.getValue(), null); cpClient.commitSecondaryRow(column.getTableName(), column.getRow(), Lists.newArrayList(columnMutation), primaryLock.getTimestamp(), commitTs); } } } 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);  }