Examples of LN


Examples of com.sleepycat.je.tree.LN

    public int fetchLNSize(int size, long lsn)
        throws DatabaseException {

        if (size == 0 && env.getCleaner().getFetchObsoleteSize()) {
            try {
                LN ln = (LN) env.getLogManager().getEntry(lsn);
                size = ln.getLastLoggedSize();
            } catch (FileNotFoundException e) {
                /* Ignore errors if the file was cleaned. */
            }
        }
        return size;
View Full Code Here

Examples of com.sleepycat.je.tree.LN

        @Override
        protected void display() {
            DatabaseEntry key = new DatabaseEntry(targetEntry.getKey());
            long keyVal = LongBinding.entryToLong(key);
            LN ln = targetEntry.getLN();
            if (ln.isDeleted()) {
                outStream.println("key=" + keyVal + " <deleted>");
            } else {
                DatabaseEntry data = new DatabaseEntry(ln.getData());

                if (keyVal == VLSNRange.RANGE_KEY) {
                    outStream.print(" range: ");
                    VLSNRange range = VLSNRange.readFromDatabase(data);
                    outStream.println(range);
View Full Code Here

Examples of com.sleepycat.je.tree.LN

        protected void display() {
            out.print(" VLSN=" + currentEntryHeader.getVLSN());

            DatabaseEntry key = new DatabaseEntry(targetEntry.getKey());

            LN ln = targetEntry.getLN();
            if (ln.isDeleted()) {
                outStream.print("<deleted>");
            } else {
                DatabaseEntry data = new DatabaseEntry(ln.getData());
                String keyVal = StringBinding.entryToString(key);
                TupleBinding<?> binding = null;
                if (keyVal.equals(RepGroupDB.GROUP_KEY)) {
                    outStream.print(" GroupInfo: ");
                    binding = new GroupBinding();
View Full Code Here

Examples of com.sleepycat.je.tree.LN

            new ReplicationContext(wireRecord.getVLSN());
        final Cursor cursor = DbInternal.makeCursor(dbImpl, repTxn,
                                                    null /*cursorConfig*/);
        try {
            OperationStatus status;
            final LN ln = lnEntry.getLN();

            if (ln.isDeleted()) {

                /*
                 * Perform an exact search by key.  Use read-uncommitted and
                 * partial data entry to avoid reading old data.
                 */
 
View Full Code Here

Examples of com.sleepycat.je.tree.LN

                LNInfo info = entry.getValue();
                DatabaseId dbId = info.getDbId();
                DatabaseImpl db = dbMapTree.getDb(dbId, lockTimeout);
                try {
                    byte[] key = info.getKey();
                    LN ln = info.getLN();

                    /* Evict before processing each entry. */
                    if (DO_CRITICAL_EVICTION) {
                        env.daemonEviction(true /*backgroundIO*/);
                    }
View Full Code Here

Examples of com.sleepycat.je.tree.LN

        /*
         * If wasCleaned is false we don't count statistics unless we migrate
         * the LN.  This avoids double counting.
         */
        BasicLocker locker = null;
        LN ln = null;

        try {
            if (lsn == DbLsn.NULL_LSN) {
                /* This node was never written, no need to migrate. */
                completed = true;
                return;
            }

            /*
             * Fetch the node, if necessary.  If it was not resident and it is
             * an evictable LN, we will clear it after we migrate it.
             */
            if (!bin.isEntryKnownDeleted(index)) {
                ln = (LN) bin.getTarget(index);
                if (ln == null) {
                    /* If fetchTarget returns null, a deleted LN was cleaned.*/
                    ln = (LN) bin.fetchTarget(index);
                    clearTarget = !db.getId().equals(DbTree.ID_DB_ID);
                }
            }

            /* Don't migrate knownDeleted or deleted cleaned LNs.  */
            if (ln == null) {
                if (wasCleaned) {
                    nLNsDead.increment();
                }
                obsolete = true;
                completed = true;
                return;
            }

            /*
             * Get a non-blocking read lock on the LN.  A pending node is
             * already locked, but the original pending LSN may have changed.
             * We must lock the current LSN to guard against aborts.
             */
            if (lockedPendingLsn != lsn) {
                locker = BasicLocker.createBasicLocker(env, false /*noWait*/);
                /* Don't allow this short-lived lock to be preempted/stolen. */
                locker.setPreemptable(false);
                LockResult lockRet = locker.nonBlockingLock
                    (lsn, LockType.READ, false /*jumpAheadOfWaiters*/, db);
                if (lockRet.getLockGrant() == LockGrantType.DENIED) {

                    /*
                     * LN is currently locked by another Locker, so we can't
                     * assume anything about the value of the LSN in the bin.
                     */
                    if (wasCleaned) {
                        nLNsLocked.increment();
                    }
                    lockDenied = true;
                    completed = true;
                    return;
                }
            }

            /* Don't migrate deleted LNs.  */
            if (ln.isDeleted()) {
                bin.setKnownDeleted(index);
                if (wasCleaned) {
                    nLNsDead.increment();
                }
                obsolete = true;
                completed = true;
                return;
            }

            /*
             * Once we have a lock, check whether the current LSN needs to be
             * migrated.  There is no need to migrate it if the LSN no longer
             * qualifies for cleaning.  The LSN could have been changed by an
             * update or delete after we set the MIGRATE flag.
             *
             * Note that we do not perform this optimization if the MIGRATE
             * flag is not set, i.e, for clustering and proactive migration of
             * resident LNs.  For these cases, we checked the conditions for
             * migration immediately before calling this method.  Although the
             * condition could change after locking, the window is small and
             * a second check is not worthwhile.
             */
            if (bin.getMigrate(index)) {
                Long fileNum = Long.valueOf(DbLsn.getFileNumber(lsn));
                if (!fileSelector.isFileCleaningInProgress(fileNum)) {
                    obsolete = true;
                    completed = true;
                    if (wasCleaned) {
                        nLNsDead.increment();
                    }
                    return;
                }
            }

            /*
             * Migrate the LN.
             *
             * Do not pass a locker, because there is no need to lock the new
             * LSN, as done for user operations.  Another locker cannot attempt
             * to lock the new LSN until we're done, because we release the
             * lock before we release the BIN latch.
             */
            long newLNLsn = ln.log(env, db, bin.getKey(index), lsn,
                                   backgroundIO,
                                   getMigrationRepContext(ln));
            bin.updateEntry(index, newLNLsn);
            nLNsMigrated.increment();
            /* Lock new LSN on behalf of existing lockers. */
 
View Full Code Here

Examples of com.sleepycat.je.tree.LN

        if (db == null) {
            return;
        }
        LNLogEntry lnEntry = reader.getLNLogEntry();
        lnEntry.postFetchInit(db);
        LN ln = lnEntry.getLN();
        TreeLocation location = new TreeLocation();
        long logLsn = reader.getLastLsn();
        long abortLsn = reader.getAbortLsn();
        boolean abortKnownDeleted = reader.getAbortKnownDeleted();

        try {

            ln.postFetchInit(db, logLsn);
            recoveryUndo(db, location, ln, lnEntry.getKey(), logLsn, abortLsn,
                         abortKnownDeleted);

            /* Undo utilization info. */
            undoUtilizationInfo(ln, db, logLsn, reader.getLastEntrySize());
View Full Code Here

Examples of com.sleepycat.je.tree.LN

                    continue;
                }
                try {
                    LNLogEntry lnEntry = reader.getLNLogEntry();
                    lnEntry.postFetchInit(db);
                    LN ln = lnEntry.getLN();

                    long logLsn = reader.getLastLsn();
                    long treeLsn = DbLsn.NULL_LSN;

                    counter.incNumProcessed();
View Full Code Here

Examples of com.sleepycat.je.tree.LN

                         */
                        boolean pendingDeleted = false;
                        if (isRollback ||
                            db.getDuplicateComparator() != null ||
                            db.getBtreeComparator() != null) {
                            final LN ln =
                                (LN) location.bin.fetchTarget(location.index);
                            if (isRollback && ln != null && ln.isDeleted()) {
                                pendingDeleted = true;
                            }
                        }
                        if (pendingDeleted) {
                            location.bin.setPendingDeleted(location.index);
View Full Code Here

Examples of com.sleepycat.je.tree.LN

                /*
                 * 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
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.