});
}
/* Now delete all FileSummaryLNs. */
Locker locker = null;
CursorImpl cursor = null;
boolean clearedTrackedFile = false;
try {
locker = BasicLocker.createBasicLocker(env, false /*noWait*/);
cursor = new CursorImpl(fileSummaryDb, locker);
/* Perform eviction in unsynchronized methods. */
cursor.setAllowEviction(true);
DatabaseEntry keyEntry = new DatabaseEntry();
DatabaseEntry dataEntry = new DatabaseEntry();
long fileNumVal = fileNum.longValue();
/* Search by file number. */
OperationStatus status = OperationStatus.SUCCESS;
if (getFirstFSLN
(cursor, fileNumVal, keyEntry, dataEntry, LockType.WRITE)) {
status = OperationStatus.SUCCESS;
} else {
status = OperationStatus.NOTFOUND;
}
/* Delete all LNs for this file number. */
while (status == OperationStatus.SUCCESS) {
/* Perform eviction once per operation. */
env.criticalEviction(true /*backgroundIO*/);
FileSummaryLN ln = (FileSummaryLN)
cursor.getCurrentLN(LockType.NONE);
if (ln != null) {
/* Stop if the file number changes. */
if (fileNumVal != ln.getFileNumber(keyEntry.getData())) {
break;
}
TrackedFileSummary tfs =
tracker.getTrackedFile(fileNumVal);
/* Associate the tracked summary so it will be cleared. */
if (tfs != null) {
ln.setTrackedSummary(tfs);
clearedTrackedFile = true;
}
/*
* Do not evict after deleting since the compressor would
* have to fetch it again.
*/
cursor.latchBIN();
cursor.delete(ReplicationContext.NO_REPLICATE);
}
status = cursor.getNext
(keyEntry, dataEntry, LockType.WRITE,
true, // forward
false); // alreadyLatched
}
} finally {
if (cursor != null) {
cursor.releaseBINs();
cursor.close();
}
if (locker != null) {
locker.operationEnd();
}
}