/** * Converts the given DIN and its descendants. * * <p>Enter/leave with bin field latched, although bin field will change to last inserted slot. */ private void convertDin(final DIN din, final byte[] binKey) { din.latch(); try { for (int i = 0; i < din.getNEntries(); i += 1) { final IN child = din.fetchIN(i, CacheMode.DEFAULT); assert (!child.isBINDelta(false)); if (child instanceof DBIN) { final DBIN dbin = (DBIN) child; dbin.latch(); try { for (int j = 0; j < dbin.getNEntries(); j += 1) { if (!isLNDeleted(dbin, j)) { convertDbinSlot(dbin, j, binKey); } } assert dbin.verifyMemorySize(); /* Count DBIN obsolete. */ if (dbin.getLastLoggedLsn() != DbLsn.NULL_LSN) { localTracker.countObsoleteNodeInexact( dbin.getLastLoggedLsn(), dbin.getLogType(), 0, dbin.getDatabase()); } } finally { dbin.releaseLatch(); } } else { convertDin((DIN) child, binKey); } /* Evict DIN child. */ din.detachNode(i, false /*updateLsn*/, -1 /*lsn*/); } assert din.verifyMemorySize(); /* Count DIN and DupCountLN obsolete. */ if (din.getLastLoggedLsn() != DbLsn.NULL_LSN) { localTracker.countObsoleteNodeInexact( din.getLastLoggedLsn(), din.getLogType(), 0, din.getDatabase()); } final ChildReference dupCountRef = din.getDupCountLNRef(); if (dupCountRef != null && dupCountRef.getLsn() != DbLsn.NULL_LSN) { localTracker.countObsoleteNodeInexact( dupCountRef.getLsn(), LogEntryType.LOG_DUPCOUNTLN, 0, din.getDatabase()); } } finally { din.releaseLatch(); } }
/** * Converts the given DIN and its descendants. * * <p>Enter/leave with bin field latched, although bin field will change to last inserted slot. */ private void convertDin(final DIN din, final byte[] binKey) { din.latch(); try { for (int i = 0; i < din.getNEntries(); i += 1) { final IN child = (IN) din.fetchTargetWithExclusiveLatch(i); if (child instanceof DBIN) { final DBIN dbin = (DBIN) child; dbin.latch(); try { for (int j = 0; j < dbin.getNEntries(); j += 1) { if (!isLNDeleted(dbin, j)) { convertDbinSlot(dbin, j, binKey); } } assert dbin.verifyMemorySize(); /* Count DBIN obsolete. */ if (dbin.getLastLoggedVersion() != DbLsn.NULL_LSN) { localTracker.countObsoleteNodeInexact( dbin.getLastLoggedVersion(), dbin.getLogType(), 0, dbin.getDatabase()); } } finally { dbin.releaseLatch(); } } else { convertDin((DIN) child, binKey); } /* Evict DIN child. */ din.updateNode(i, null, null); envImpl.getInMemoryINs().remove(child); } assert din.verifyMemorySize(); /* Count DIN and DupCountLN obsolete. */ if (din.getLastLoggedVersion() != DbLsn.NULL_LSN) { localTracker.countObsoleteNodeInexact( din.getLastLoggedVersion(), din.getLogType(), 0, din.getDatabase()); } final ChildReference dupCountRef = din.getDupCountLNRef(); if (dupCountRef != null && dupCountRef.getLsn() != DbLsn.NULL_LSN) { localTracker.countObsoleteNodeInexact( dupCountRef.getLsn(), LogEntryType.LOG_DUPCOUNTLN, 0, din.getDatabase()); } } finally { din.releaseLatch(); } }