TRowLock newRowLock = new TRowLock(ROW_LOCK_VERSION, TRowLockState.PREWRITTEN,
tx.getCommitTimestamp()).setCurrentTimestamp(tx.getPrewriteTimestamp());
if (isPrimary) {
// for primary row
for (Entry<TRowKey, HaeinsaRowTransaction> rowStateEntry : tx.getMutationRowStates().entrySet()) {
TRowKey rowKey = rowStateEntry.getKey();
if (Bytes.equals(rowKey.getTableName(), getTableName()) && Bytes.equals(rowKey.getRow(), row)) {
// if this is primaryRow
continue;
}
newRowLock.addToSecondaries(new TRowKey().setTableName(rowKey.getTableName()).setRow(rowKey.getRow()));
}
} else {
// for secondary rows
newRowLock.setPrimary(tx.getPrimary());
}