Package com.sleepycat.je.tree

Examples of com.sleepycat.je.tree.LN


                    found = !exactSearch;
                }
            }
        } else {
            /* Not a duplicate, but checking for both key and data match. */
            LN ln = (LN) n;

            /* Lock LN, check if deleted. */
            LockResult lockResult = lockLN(ln, lockType);

            /*
             * Note that during the lockLN call, this cursor may have been
             * adjusted to refer to an LN in a duplicate tree.  This happens in
             * the case where we entered with a non-duplicate tree LN and
             * during the lock call it was mutated to a duplicate tree.  The LN
             * is still the correct LN, but our cursor is now down in a
             * duplicate tree. [#14230].
             */

            ln = lockResult.getLN();

            if (ln == null) {
                found = !exactSearch;
            } else {

                /* Don't set abort LSN for read operation. [#13158] */

                /*
                 * The comparison logic below mimics IN.findEntry as used above
                 * for duplicates.
                 */
                int cmp = Key.compareKeys
                    (ln.getData(), data, databaseImpl.getDuplicateComparator());
                if (cmp == 0 || (cmp <= 0 && !exactSearch)) {
                    if (cmp == 0) {
                        exact = true;
                    }
                    found = true;
View Full Code Here


            } else {
                return OperationStatus.NOTFOUND;
            }
        }

        LN ln = (LN) n;

        assert TestHookExecute.doHookIfSet(testHook);

        /*
         * Lock the LN.  For dirty-read, the data of the LN can be set to null
         * at any time.  Cache the data in a local variable so its state does
         * not change before calling setDbt further below.
         */
        LockResult lockResult = lockLN(ln, lockType);
        try {
            ln = lockResult.getLN();
            byte[] lnData = (ln != null) ? ln.getData() : null;
            if (ln == null || lnData == null) {
                if (treeStatsAccumulator != null) {
                    treeStatsAccumulator.incrementDeletedLNCount();
                }
                return OperationStatus.KEYEMPTY;
View Full Code Here

                if (in.isEntryPendingDeleted(i) ||
                    in.isEntryKnownDeleted(i)) {

                    /* Dirty LNs (deferred write) get special treatment. */
                    if (node instanceof LN) {
                        LN ln = (LN) node;
                        if (ln.isDirty()) {
                            callback.processDirtyDeletedLN
                                (lsn, ln, in.getKey(i));
                        }
                    }
                    continue;
View Full Code Here

        throws DatabaseException {

        /* Invoke the evictor to reduce memory consumption. */
        envImpl.invokeEvictor();

        LN ln = reader.getLN();
        TreeLocation location = new TreeLocation();
        long logLsn = reader.getLastLsn();
        long abortLsn = reader.getAbortLsn();
        boolean abortKnownDeleted = reader.getAbortKnownDeleted();
        DatabaseId dbId = reader.getDatabaseId();
        DatabaseImpl db = dbMapTree.getDb(dbId);

        try {
            /* Database may be null if it's been deleted. */
            if (db == null) {
                return;
            }

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

            /* Undo utilization info. */
 
View Full Code Here

                 * We're doing a redo. Invoke the evictor in this loop to
                 * reduce memory consumption.
                 */
                envImpl.invokeEvictor();

                LN ln = reader.getLN();
                DatabaseId dbId = reader.getDatabaseId();
                DatabaseImpl db = dbMapTree.getDb(dbId);
                try {
                    long logLsn = reader.getLastLsn();
                    long treeLsn = DbLsn.NULL_LSN;
View Full Code Here

                /*
                 * 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

    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

        @Override
        protected void display() {
            DatabaseEntry key = new DatabaseEntry(targetEntry.getKey());
            long keyVal = LongBinding.entryToLong(key);
            LN ln = targetEntry.getLN();
            if (ln.isDeleted()) {
                outStream.print("<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

        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

        Locker idDbLocker = null;
        try {
            newDb = new DatabaseImpl(databaseName, newId, envImpl, dbConfig);
            /* Insert it into name -> id db. */
            nameCursor = new CursorImpl(nameDatabase, nameLocker);
            LN nameLN = null;
            if (replicatedLN != null) {
                nameLN = replicatedLN;
            } else {
                nameLN = new NameLN(newId, envImpl, newDb.isReplicated());
            }

            ReplicationContext useRepContext = repContext;
            if (repContext == null) {
                useRepContext = newDb.getOperationRepContext(CREATE);
            }
            nameCursor.putLN(databaseName.getBytes("UTF-8"),// key
                             nameLN,
                             null,                          // returnNewData
                             false,                         // allowDuplicates
                             useRepContext);

            /*
             * If this is a non-handle use, no need to record any handle locks.
             */
            if (databaseHandle != null) {
                nameLocker.addToHandleMaps(Long.valueOf(nameLN.getNodeId()),
                                           databaseHandle);
            }

            /* Insert it into id -> name db, in auto commit mode. */
            idDbLocker = BasicLocker.createBasicLocker(envImpl);
View Full Code Here

TOP

Related Classes of com.sleepycat.je.tree.LN

Copyright © 2018 www.massapicom. 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.