add double finally for handle the case of record unlock failure
@@ -2023,6 +2023,7 @@ public abstract class OAbstractPaginatedStorage extends OStorageAbstract
database.getMetadata().clearThreadLocalSchemaSnapshot();
}
} finally {
+ try {
if (pessimisticLock) {
for (ORecordOperation recordOperation : recordOperations) {
if (recordOperation.type == ORecordOperation.UPDATED || recordOperation.type == ORecordOperation.DELETED) {
@@ -2030,8 +2031,10 @@ public abstract class OAbstractPaginatedStorage extends OStorageAbstract
}
}
}
+ } finally {
stateLock.releaseReadLock();
}
+ }
if (OLogManager.instance().isDebugEnabled())
OLogManager.instance()
@@ -4030,12 +4033,15 @@ public abstract class OAbstractPaginatedStorage extends OStorageAbstract
buff = doReadRecordIfNotLatest(cluster, rid, recordVersion);
return buff;
} finally {
+ try {
if (pessimisticLock) {
releaseReadLock(rid);
}
+ } finally {
stateLock.releaseReadLock();
}
}
+ }
private ORawBuffer readRecord(final OCluster clusterSegment, final ORecordId rid, boolean prefetchRecords) {
checkOpenness();
@@ -4058,12 +4064,15 @@ public abstract class OAbstractPaginatedStorage extends OStorageAbstract
checkOpenness();
return doReadRecord(clusterSegment, rid, prefetchRecords);
} finally {
+ try {
if (pessimisticLock) {
releaseReadLock(rid);
}
+ } finally {
stateLock.releaseReadLock();
}
}
+ }
private OLogSequenceNumber endStorageTx() throws IOException {
final OLogSequenceNumber lsn = atomicOperationsManager.endAtomicOperation(false, null);
