}
public boolean deleteRecord(final ORecordId iRid, final int iVersion) {
final long timer = OProfiler.getInstance().startChrono();
final OCluster cluster = getClusterById(iRid.clusterId);
lock.acquireSharedLock();
try {
lockManager.acquireLock(Thread.currentThread(), iRid, LOCK.EXCLUSIVE);
try {
final OPhysicalPosition ppos = cluster.getPhysicalPosition(iRid.clusterPosition, new OPhysicalPosition());
if (ppos == null)
return false;
// MVCC TRANSACTION: CHECK IF VERSION IS THE SAME
if (iVersion > -1 && ppos.version != iVersion)
throw new OConcurrentModificationException(
"Can't delete record "
+ iRid
+ " because the version is not the latest one. Probably you are deleting an old record or it has been modified by another user (db=v"
+ ppos.version + " your=v" + iVersion + ")");
cluster.removePhysicalPosition(iRid.clusterPosition, null);
data.deleteRecord(ppos.dataPosition);
return true;
} finally {