/* Make a child reference as a candidate for insertion. */
ChildReference newLNRef =
new ChildReference(null, location.lnKey, logLsn);
BIN parentBIN = location.bin;
int entryIndex = parentBIN.insertEntry1(newLNRef);
if ((entryIndex & IN.INSERT_SUCCESS) == 0) {
/*
* Entry may have been a duplicate. Insertion was not successful.
*/
entryIndex &= ~IN.EXACT_MATCH;
boolean canOverwrite = false;
if (parentBIN.isEntryKnownDeleted(entryIndex)) {
canOverwrite = true;
} else {
/*
* Read the LN that's in this slot to check for deleted
* status. No need to lock, since this is recovery. If
* fetchTarget returns null, a deleted LN was cleaned.
*/
LN currentLN = (LN) parentBIN.fetchTarget(entryIndex);
if (currentLN == null || currentLN.isDeleted()) {
canOverwrite = true;
}
/*
* Evict the target again manually, to reduce memory
* consumption while the evictor is not running.
*/
parentBIN.updateEntry(entryIndex, null);
}
if (canOverwrite) {
parentBIN.updateEntry(entryIndex, null, logLsn,
location.lnKey);
parentBIN.clearKnownDeleted(entryIndex);
location.index = entryIndex;
return true;
} else {
return false;
}