/*
* Get a new reference to the child, in case the reference
* saved in the selection list became out of date because of
* changes to that parent.
*/
IN renewedChild = (IN) parent.getTarget(index);
if (renewedChild == null) {
return evictBytes;
}
boolean inline = (source == EvictionSource.CACHEMODE);
if (!inline && renewedChild.getGeneration() > oldGenerationCount) {
return evictBytes;
}
/*
* See the evictIN() method in this class for an explanation for
* calling latchNoWait().
*/
if (inline) {
renewedChild.latch(CacheMode.UNCHANGED);
} else {
if (!renewedChild.latchNoWait(CacheMode.UNCHANGED)) {
return evictBytes;
}
}
try {
if (!renewedChild.isEvictable()) {
return evictBytes;
}
DatabaseImpl db = renewedChild.getDatabase();
/* Do not use superclass envImpl. */
EnvironmentImpl useEnvImpl = db.getDbEnvironment();
/*
* Log the child if dirty and env is not r/o. Remove
* from IN list.
*/
long renewedChildLsn = DbLsn.NULL_LSN;
boolean newChildLsn = false;
if (renewedChild.getDirty()) {
if (!useEnvImpl.isReadOnly()) {
boolean logProvisional =
coordinateWithCheckpoint(renewedChild, parent);
/*
* Log a full version (no deltas) and with cleaner
* migration allowed. Allow compression of deleted
* slots in full version BINs.
*/
renewedChildLsn = renewedChild.log
(useEnvImpl.getLogManager(),
allowBinDeltas,
true /*allowCompress*/,
logProvisional,
backgroundIO,
parent);
newChildLsn = true;
}
} else {
renewedChildLsn = parent.getLsn(index);
}
if (renewedChildLsn != DbLsn.NULL_LSN) {
/* Take this off the inlist. */
useEnvImpl.getInMemoryINs().remove(renewedChild);
evictBytes = renewedChild.getBudgetedMemorySize();
if (newChildLsn) {
/*
* Update the parent so its reference is
* null and it has the proper LSN.
*/
parent.updateNode
(index, null /*node*/, renewedChildLsn,
null /*lnSlotKey*/);
} else {
/*
* Null out the reference, but don't dirty
* the node since only the reference
* changed.
*/
parent.updateNode
(index, (Node) null /*node*/,
null /*lnSlotKey*/);
}
/* Stats */
nNodesEvicted.increment();
renewedChild.incEvictStats(source);
}
} finally {
renewedChild.releaseLatch();
}
} finally {
parent.releaseLatch();
}