Package com.sleepycat.je.dbi

Examples of com.sleepycat.je.dbi.EnvironmentImpl$NoopVLSNProxy


    @SuppressWarnings("unused")
    private static void doEvict(Environment env)
        throws DatabaseException {
           
        /* Push the cache size down by half to force eviction. */
        EnvironmentImpl envImpl = DbInternal.getEnvironmentImpl(env);
        long cacheUsage = envImpl.getMemoryBudget().getCacheMemoryUsage();
        EnvironmentMutableConfig c = new EnvironmentMutableConfig();
        c.setCacheSize(cacheUsage/2);
        env.setMutableConfig(c);

        long start = System.currentTimeMillis();
View Full Code Here


        /* No need to call super, this handler is not truly publishing. */
    }

    @Override
    public void publish(LogRecord record) {
        EnvironmentImpl envImpl =
            LoggerUtils.envMap.get(Thread.currentThread());

        /*
         * Prefer to lose logging output, rather than risk a
         * NullPointerException if the caller forgets to set and release the
         * environmentImpl.
         */
        if (envImpl == null) {
            return;
        }

        /*
         * The FileHandler is not always created for an environment, because
         * creating a FileHandler automatically creates a logging file, and
         * we avoid doing that for read only environments. Because of that,
         * there may legitimately be no environment file handler.
         */
        if (envImpl.getFileHandler() == null) {
            return;
        }

        envImpl.getFileHandler().publish(record);
    }
View Full Code Here

           long oldLsn,
           Locker locker)
        throws DatabaseException {

        makeDeleted();
        EnvironmentImpl env = database.getDbEnvironment();

        long newLsn = DbLsn.NULL_LSN;
        if (dupKey != null) {

            /*
             * Deleted Duplicate LNs are logged with two keys -- the one that
             * identifies the main tree (the dup key) and the one that places
             * them in the duplicate tree (really the data) since we can't
             * recreate the latter because the data field has been nulled. Note
             * that the dupKey is passed to the log manager FIRST, because the
             * dup key is the one that navigates us in the main tree. The "key"
             * is the one that navigates us in the duplicate tree. Also, we
             * must check if this is a transactional entry that must be rolled
             * back or one done on the behalf of a null txn.
             */
            LogEntryType entryType;
            long logAbortLsn;
            boolean logAbortKnownDeleted;
            Txn logTxn;
            if (locker.isTransactional()) {
                entryType = LogEntryType.LOG_DEL_DUPLN_TRANSACTIONAL;
                logAbortLsn = locker.getAbortLsn(getNodeId());
                logAbortKnownDeleted =
                    locker.getAbortKnownDeleted(getNodeId());
                logTxn = locker.getTxnLocker();
            } else {
                entryType = LogEntryType.LOG_DEL_DUPLN;
                logAbortLsn = DbLsn.NULL_LSN;
                logAbortKnownDeleted = true;
                logTxn = null;
            }

            /* Don't count abortLsn as obsolete, this is done during commit. */
            if (oldLsn == logAbortLsn) {
                oldLsn = DbLsn.NULL_LSN;
            }

            DeletedDupLNLogEntry logEntry =
                new DeletedDupLNLogEntry(entryType,
                                         this,
                                         database.getId(),
                                         dupKey,
                                         lnKey,
                                         logAbortLsn,
                                         logAbortKnownDeleted,
                                         logTxn);

            LogManager logManager = env.getLogManager();
            newLsn = logManager.log(logEntry, false, oldLsn);

        } else {

            /*
 
View Full Code Here

        throws DatabaseException {

        data = newData;

        /* Log the new ln. */
        EnvironmentImpl env = database.getDbEnvironment();
        long newLsn = log(env, database.getId(), lnKey, oldLsn, locker);
        return newLsn;
    }
View Full Code Here

    protected void init(DatabaseImpl db,
                        byte[] identifierKey,
                        int initialCapacity,
                        int level) {
        setDatabase(db);
  EnvironmentImpl env =
      (databaseImpl == null) ? null : databaseImpl.getDbEnvironment();
        latch = new Latch(shortClassName() + getNodeId(), env);
        generation = 0;
        dirty = false;
        nEntries = 0;
View Full Code Here

    public void postFetchInit(DatabaseImpl db, long sourceLsn)
        throws DatabaseException {

        setDatabase(db);
        setLastFullLsn(sourceLsn);
        EnvironmentImpl env = db.getDbEnvironment();
        initMemorySize(); // compute before adding to inlist
        env.getInMemoryINs().add(this);
    }
View Full Code Here

                 * This is the remnant of an incomplete insertion -- see
                 * Tree.insert. [#13126]
                 */
            } else {
                try {
                    EnvironmentImpl env = databaseImpl.getDbEnvironment();
                    Node node = (Node) env.getLogManager().get(lsn);
                    node.postFetchInit(databaseImpl, lsn);
                    entryTargets[idx] = node;
                    updateMemorySize(null, node);
                } catch (LogFileNotFoundException LNFE) {
                    if (!isEntryKnownDeleted(idx) &&
View Full Code Here

       * get logged last, as all referred-to children must preceed
       * it. Provisional entries guarantee that all three are processed
       * as a unit. Recovery skips provisional entries, so the changed
       * children are only used if the parent makes it out to the log.
       */
      EnvironmentImpl env = databaseImpl.getDbEnvironment();
      LogManager logManager = env.getLogManager();
      INList inMemoryINs = env.getInMemoryINs();

      long newSiblingLsn = newSibling.logProvisional(logManager, parent);
      long myNewLsn = logProvisional(logManager, parent);

      /*
 
View Full Code Here

                                 new Integer(FILE_SIZE).toString());
        /* Yank the cache size way down. */
        envConfig.setConfigParam
      (EnvironmentParams.LOG_FILE_CACHE_SIZE.getName(), "3");
        envConfig.setAllowCreate(true);
        envImpl = new EnvironmentImpl(envHome, envConfig);

        /* Make a standalone file manager for this test. */
        envImpl.close();
        envImpl.open(); /* Just sets state to OPEN. */
        fileManager = new FileManager(envImpl, envHome, false);
View Full Code Here

        EnvironmentConfig envConfig = TestUtils.initEnvConfig();
        envConfig.setAllowCreate(true);
        envConfig.setTransactional(true);
        Environment env = new Environment(envHome, envConfig);
  EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
  FileManager fileManager = envImpl.getFileManager();

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        Database exampleDb =
      env.openDatabase(null, "simpleDb", dbConfig);

        assertEquals("Should have 0 as current file", 0L,
                     fileManager.getCurrentFileNum());
  long flipLsn = envImpl.forceLogFileFlip();
  assertEquals("LSN should be 1 post-flip", 1L,
         DbLsn.getFileNumber(flipLsn));
  DatabaseEntry key = new DatabaseEntry();
  DatabaseEntry data = new DatabaseEntry();
  key.setData("key".getBytes());
View Full Code Here

TOP

Related Classes of com.sleepycat.je.dbi.EnvironmentImpl$NoopVLSNProxy

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.