Skip to content

Commit

Permalink
ISPN-11157 Optimistic Transaction ignores ZERO_LOCK_ACQUISITION flag
Browse files Browse the repository at this point in the history
  • Loading branch information
wburns authored and danberindei committed Jan 17, 2020
1 parent df6dc33 commit 49c2c54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,16 @@ public Object getKeyLockOwner() {

@Override
public boolean hasZeroLockAcquisition() {
return false;
if (modifications == null || modifications.length == 0) {
return false;
}
for (WriteCommand wc : modifications) {
// If even a single command doesn't have the zero lock acquisition timeout flag, we can't use a zero timeout
if (!wc.hasAnyFlag(FlagBitSets.ZERO_LOCK_ACQUISITION_TIMEOUT)) {
return false;
}
}
return true;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ public Object visitPrepareCommand(TxInvocationContext ctx, PrepareCommand comman
// However, keep the backup locks if the prepare command is being replayed because of state transfer
ctx.getCacheTransaction().cleanupBackupLocks();
}
lockStage = lockAllOrRegisterBackupLock(ctx, command, keysToLock, cacheConfiguration.locking().lockAcquisitionTimeout());
lockStage = lockAllOrRegisterBackupLock(ctx, command, keysToLock, command.hasZeroLockAcquisition() ? 0 :
cacheConfiguration.locking().lockAcquisitionTimeout());
}

if (command.isOnePhaseCommit()) {
Expand Down

0 comments on commit 49c2c54

Please sign in to comment.