final SearchMode searchMode,
final Comparator<byte[]> searchComparator) {
try {
if (!isSerializableIsolation(lockMode)) {
final LockType lockType = getLockType(lockMode, false);
final KeyChangeStatus result = searchAllowPhantoms
(key, data, lockType, lockType, searchMode,
searchComparator, cursorRangeConstraint);
return result.status;
}
/*
* Perform range locking to prevent phantoms and handle restarts.
*/
while (true) {
try {
/* Do not use a range lock for the initial search. */
final LockType searchLockType =
getLockType(lockMode, false);
/* Switch to a range lock when advancing forward. */
final LockType advanceLockType =
getLockType(lockMode, true);
/* Do not modify key/data params until SUCCESS. */
final DatabaseEntry tryKey = cloneEntry(key);
final DatabaseEntry tryData = cloneEntry(data);