Examples of Ln


Examples of com.sleepycat.je.tree.LN

             * a random read during an update operation.
             *
             * Note that we checked for a deleted/cleaned LN above, so we know
             * that fetchTarget will not return null.
             */
            LN ln;
            if (foundData != null ||
                data.getPartial() ||
                envImpl.getCleaner().getFetchObsoleteSize() ||
                !dbType.mayCreateUpdatedLN()) {
                /* Must fetch. */
                ln = (LN) bin.fetchTarget(index);
            } else {
                /* If resident, use LN for obsolete size tracking. */
                ln = (LN) bin.getTarget(index);
            }
            final byte[] oldKey = bin.getKey(index);
            final byte[] foundDataBytes = (ln != null) ? ln.getData() : null;
            final byte[] newData = data.getPartial() ?
                LN.resolvePartialEntry(data, foundDataBytes) :
                LN.copyEntryData(data);

            /*
             * If the key is changed (according to the comparator), we assume
             * it is actually the data that has changed via putCurrent() for a
             * duplicate's DB.  It is not possible to change the key in a
             * non-duplicates DB, because 1) putCurrent() is not passed the
             * key, 2) for put() the key is used to perform the lookup.
             */
            if (key != null &&
                Key.compareKeys
                    (oldKey, key, databaseImpl.getKeyComparator()) != 0) {
                throw new DuplicateDataException
                    ("Can't replace a duplicate with data that is " +
                     "unequal according to the duplicate comparator.");
            }

            if (foundData != null) {
                assert foundDataBytes != null;
                LN.setEntry(foundData, foundDataBytes);
            }
            if (foundKey != null) {
                LN.setEntry(foundKey, oldKey);
            }

            /*
             * Update the existing LN, if resident, else create a new updated
             * LN.
             */
            final long oldLNMemSize;
            if (ln != null) {
                /* LN is already resident, modify its data. */
                oldLNMemSize = ln.getMemorySizeIncludedByParent();
                ln.modify(newData);
            } else {
                /* LN is not resident, create updated LN for logging. */
                ln = dbType.createUpdatedLN(envImpl, newData);
                /* Make updated LN resident. */
                bin.updateNode(index, ln, null /*lnSlotKey*/);
                oldLNMemSize = ln.getMemorySizeIncludedByParent();
            }

            /*
             * Log the updated LN.
             *
             * Note that if the LN is not resident, the lastLoggedSize is
             * unknown and not counted during utilization tracking.
             */
            newLsn = ln.optionalLog
                (envImpl, databaseImpl, (key != null) ? key : oldKey, oldKey,
                 oldLsn, locker, lockStanding.prepareForUpdate(), repContext);

            /* Return a copy of resulting data, if requested. [#16932] */
            if (returnNewData != null) {
                ln.setEntry(returnNewData);
            }

            /*
             * Update the parent BIN.  Update the key, if changed.  [#15704]
             */
 
View Full Code Here

Examples of com.sleepycat.je.tree.LN

     */
    private OperationStatus
        putNoDups(final DatabaseEntry key,
                  final DatabaseEntry data,
                  final PutMode putMode) {
        final LN ln = (putMode == PutMode.CURRENT) ?
            null :
            LN.makeLN(dbImpl.getDbEnvironment(), data);
        return putNotify(key, data, ln, putMode, dbImpl.getRepContext());
    }
View Full Code Here

Examples of com.sleepycat.je.tree.LN

                             i < origBIN.getNEntries();
                             i++) {
                            if (!origBIN.isEntryKnownDeleted(i)) {
                                final Node n = origBIN.fetchTarget(i);
                                if (n != null) {
                                    final LN ln = (LN) n;
                                    /* See comment above about locking. */
                                    if (!ln.isDeleted()) {
                                        ret = true;
                                        break;
                                    }
                                }
                            }
                        }
                    }
                } else {
                    if (origCursor.getIndex() > 0) {

                        /*
                         * We were adjusted to something other than the
                         * first entry so some insertion happened.
                         */
                        for (int i = 0; i < origCursor.getIndex(); i++) {
                            if (!origBIN.isEntryKnownDeleted(i)) {
                                final Node n = origBIN.fetchTarget(i);
                                if (n != null) {
                                    final LN ln = (LN) n;
                                    /* See comment above about locking. */
                                    if (!ln.isDeleted()) {
                                        ret = true;
                                        break;
                                    }
                                }
                            }
View Full Code Here

Examples of com.sleepycat.je.tree.LN

             * a random read during a delete operation.
             *
             * Note that we checked for a deleted/cleaned LN above, so we know
             * that fetchTarget will not return null.
             */
            LN ln;
            if (envImpl.getCleaner().getFetchObsoleteSize() ||
                !dbType.mayCreateDeletedLN()) {
                /* Must fetch. */
                ln = (LN) bin.fetchTarget(index);
            } else {
                /* If resident, use LN for obsolete size tracking. */
                ln = (LN) bin.getTarget(index);
            }

            /*
             * Make the existing LN deleted, if resident, else create a new
             * deleted LN.
             */
            final byte[] oldKey = bin.getKey(index);
            final long oldLNMemSize;
            if (ln != null) {
                /* Leave LN resident, make it deleted. */
                oldLNMemSize = ln.getMemorySizeIncludedByParent();
                ln.delete();
            } else {
                /* LN is not resident, create deleted LN for logging. */
                ln = dbType.createDeletedLN(envImpl);
                /* Make deleted LN resident. */
                oldLNMemSize = ln.getMemorySizeIncludedByParent();
                bin.updateNode(index, ln, null /*lnSlotKey*/);
            }

            /*
             * Log the deleted LN.
             *
             * Note that if the LN is not resident, the lastLoggedSize is
             * unknown and not counted during utilization tracking.
             */
            newLsn = ln.optionalLog
                (envImpl, databaseImpl, oldKey, oldKey, oldLsn, locker,
                 lockStanding.prepareForUpdate(), repContext);

            /*
             * Now update the parent BIN of the LN to correctly reference the
View Full Code Here

Examples of com.sleepycat.je.tree.LN

            if (treeStatsAccumulator != null) {
                treeStatsAccumulator.incrementDeletedLNCount();
            }
            return OperationStatus.KEYEMPTY;
        }
        final LN ln = (LN) (mustFetch ?  bin.fetchTarget(index) : null);
        byte[] lnData = (ln != null) ? ln.getData() : null;

        /*
         * Don't set the abort LSN here since we are not logging yet, even
         * if this is a write lock.  Tree.insert depends on the fact that
         * the abortLSN is not already set for deleted items.
View Full Code Here

Examples of com.sleepycat.je.tree.LN

        if (bin == null || index < 0) {
            return true;
        }

        /* Cannot verify deletedness if LN is not resident. */
        final LN ln = (LN) bin.getTarget(index);
        if (ln == null) {
            return true;
        }

        /*
         * If the LN is deleted then KD or PD must be set.  If the LN is not
         * deleted then PD must not be set, but KD may or may not be set since
         * it used for various purposes (see IN.java).
         */
        final boolean kd = bin.isEntryKnownDeleted(index);
        final boolean pd = bin.isEntryPendingDeleted(index);
        final boolean lnDeleted = ln.isDeleted();
        assert ((lnDeleted && (kd || pd)) || (!lnDeleted && !pd)) :
               "Deleted state mismatch LNDeleted = " + lnDeleted +
               " PD = " + pd + " KD = " + kd;
        return true;
    }
View Full Code Here

Examples of com.sleepycat.je.tree.LN

            }
            checkReplicaWrite(nameLocker, useRepContext);

            /* Insert it into name -> id db. */
            nameCursor = new CursorImpl(nameDatabase, nameLocker);
            LN nameLN = null;
            if (replicatedLN != null) {
                nameLN = replicatedLN;
            } else {
                nameLN = new NameLN(newId);
            }
View Full Code Here

Examples of com.sleepycat.je.tree.LN

            checkProcessEntry(entry, entryType, false);

        if (processThisEntry &&
            (entry instanceof LNLogEntry)) {
            LNLogEntry lnEntry = (LNLogEntry) entry;
            LN ln = lnEntry.getLN();
            if (ln instanceof NameLN) {
                String name = new String(lnEntry.getKey());
                Long dbId = Long.valueOf(((NameLN) ln).getId().getId());
                if (dbIdToName.containsKey(dbId) &&
                    !dbIdToName.get(dbId).equals(name)) {
View Full Code Here

Examples of com.sleepycat.je.tree.LN

            checkProcessEntry(entry, entryType, true);

        if (processThisEntry) {
            LNLogEntry lnEntry = (LNLogEntry) entry;
            Long dbId = Long.valueOf(lnEntry.getDbId().getId());
            LN ln = lnEntry.getLN();

            /* Create output file even if we don't process a deleted entry. */
            PrintStream out = getOutputStream(dbId);

            if (!ln.isDeleted()) {
                DatabaseEntry key = new DatabaseEntry();
                DatabaseEntry data = new DatabaseEntry();
                lnEntry.getUserKeyData(key, data);
                dumpOne(out, key.getData(), formatUsingPrintable);
                dumpOne(out, data.getData(), formatUsingPrintable);
View Full Code Here

Examples of com.sleepycat.je.tree.LN

        }
    }

    private void processDirtyLN(Node node, long lsn, byte[] lnKey) {
        if (node != null && node.isLN()) {
            LN ln = (LN) node;
            if (ln.isDirty()) {
                callback.processDirtyDeletedLN(lsn, ln, lnKey);
            }
        }
    }
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.