/** * Evict a single LN if allowed. The amount of memory freed is returned and must be subtracted * from the memory budget by the caller. */ private long evictInternal(int index, Cleaner cleaner) throws DatabaseException { Node n = getTarget(index); if (n instanceof LN) { LN ln = (LN) n; /* * Don't evict MapLNs for open databases (LN.isEvictable) [#13415]. * And don't strip LNs that the cleaner will be migrating * (Cleaner.isEvictable). */ if (ln.isEvictable() && cleaner.isEvictable(this, index)) { boolean force = getDatabase().isDeferredWriteMode() && getLsn(index) == DbLsn.NULL_LSN; /* Log target if necessary. */ logDirtyLN(index, (LN) n, force); /* Clear target. */ setTarget(index, null); ln.releaseMemoryBudget(); return n.getMemorySizeIncludedByParent(); } } return 0; }
/** * Mark this entry as deleted, using the delete flag. Only BINS may do this. * * @param index indicates target entry */ @Override public void setKnownDeleted(int index) { /* * The target is cleared to save memory, since a known deleted entry * will never be fetched. The migrate flag is also cleared since * migration is never needed for known deleted entries either. */ super.setKnownDeleted(index); /* * We know it's an LN because we never call setKnownDeleted for * an IN. */ LN oldLN = (LN) getTarget(index); updateMemorySize(oldLN, null /* newNode */); if (oldLN != null) { oldLN.releaseMemoryBudget(); } setMigrate(index, false); super.setTarget(index, null); setDirty(true); }