Package com.sleepycat.je.dbi

Examples of com.sleepycat.je.dbi.DatabaseImpl


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

                        LN ln = reader.getLN();
                        DatabaseId dbId = reader.getDatabaseId();
                        DatabaseImpl db = dbMapTree.getDb(dbId);
                        long logLsn = reader.getLastLsn();
                        long treeLsn = DbLsn.NULL_LSN;

                        /* Database may be null if it's been deleted. */
                        if (db != null) {
View Full Code Here


        Iterator iter = inListRebuildDbIds.iterator();
        while (iter.hasNext()) {
            DatabaseId dbId = (DatabaseId) iter.next();
            /* We already did the map tree, don't do it again. */
            if (!dbId.equals(DbTree.ID_DB_ID)) {
                DatabaseImpl db = env.getDbMapTree().getDb(dbId);
                db.getTree().rebuildINList();
            }
        }
    }
View Full Code Here

        envConfig.setConfigParam(EnvironmentParams.NODE_MAX.getName(), "6");
        envConfig.setAllowCreate(true);
        noLogEnv = new EnvironmentImpl(envHome, envConfig);
  initialINCapacity =
      noLogEnv.getConfigManager().getInt(EnvironmentParams.NODE_MAX);
        db = new DatabaseImpl("foo", new DatabaseId(11), noLogEnv,
            new DatabaseConfig());
    }
View Full Code Here

    */
    private void addData(Database db)
        throws DatabaseException {

  DatabaseImpl dbImpl = DbInternal.dbGetDatabaseImpl(db);
        EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
        CheckpointConfig ckptConfig = new CheckpointConfig();
        ckptConfig.setForce(true);

  /*
   * Create a one element dup tree by making a dupe and then reducing it
   * back to one element.
   */
  put(db, "cfhaa", "yrhwlvlgvq");
  put(db, "cfhaa", "blort");
  delete(db, "cfhaa", "blort");
  env.compress();
        env.sync();

  /* Same thing for cfgaa. */   
  put(db, "cfgaa", "urhwlvlgvq");
  put(db, "cfgaa", "blort");
  delete(db, "cfgaa", "blort");
  put(db, "cfiaa", "yrhwlvlgvq");
  put(db, "cffaa", "yrhwlvlgvq");
        env.sync();
        env.sync();

  /* Write out the DelDupLN and DupCountLN. */
  delete(db, "cfhaa", "yrhwlvlgvq");
  BIN bin = (BIN) dbImpl.getTree().search("cfhaa".getBytes(),
            SearchType.NORMAL,
            -1,
                                                null,
                                                true);
  assertNotNull(bin);
View Full Code Here

        }

  Iterator it = queueSnapshot.iterator();
  while (it.hasNext()) {
      BINReference binRef = (BINReference) it.next();
            DatabaseImpl db =
    env.getDbMapTree().getDb(binRef.getDatabaseId(), lockTimeout);
      BIN bin = searchForBIN(db, binRef);
      if (bin != null) {
    bin.verifyCursors();
    bin.releaseLatch();
View Full Code Here

            DbInternal.setUseExistingConfig(dbConfig, true);
            Database db = env.openDatabase(null, dbName, dbConfig);

            try {
                /* Use DatabaseImpl.verify so we can get a status return. */
                DatabaseImpl dbImpl = DbInternal.dbGetDatabaseImpl(db);
                DatabaseStats stats = dbImpl.getEmptyStats();
                ret = dbImpl.verify(verifyConfig, stats);
                if (verifyConfig.getPrintInfo()) {
                    out.println(stats);
                }
            } finally {
                if (db != null) {
View Full Code Here

                keyDbt.setData(TestUtils.getTestArray(i));
                db.put(txn, keyDbt, dataDbt);
            }

            /* Check that we're ready for a split. */
            DatabaseImpl database = DbInternal.dbGetDatabaseImpl(db);
            CheckReadyToSplit splitChecker = new CheckReadyToSplit(database);
            database.getTree().withRootLatched(splitChecker);
            assertTrue(splitChecker.getReadyToSplit());

            /*
             * Make another txn that will get a read lock on the map
             * LSN. Then abort the first txn. It shouldn't try to do a
View Full Code Here

    private void verifyData(int numKeys, int valueOffset)
        throws DatabaseException {

        for (int i = 0; i < NUM_DBS; i++) {
            /* Run verify */
            DatabaseImpl dbImpl = DbInternal.dbGetDatabaseImpl(dbs[i]);
            assertTrue(dbImpl.verify(new VerifyConfig(),
                                      dbImpl.getEmptyStats()));

            Cursor verifyCursor =
    dbs[i].openCursor(null, CursorConfig.READ_UNCOMMITTED);
            DatabaseEntry key = new DatabaseEntry();
            DatabaseEntry data = new DatabaseEntry();
View Full Code Here

                        /*
                         * We were adjusted to something other than the last
                         * entry so some insertion happened.
                         */
                        DatabaseImpl database = origBIN.getDatabase();
                        for (int i = origCursor.getIndex() + 1;
                             i < origBIN.getNEntries();
                             i++) {
                            if (!origBIN.isEntryKnownDeleted(i)) {
                                Node n = origBIN.fetchTarget(i);
                                if (n != null && !n.containsDuplicates()) {
                                    LN ln = (LN) n;
                                    /* See comment above about locking. */
                                    if (!ln.isDeleted()) {
                                        ret = true;
                                        break;
                                    }
                                }
                            } else {
                                /* Need to check the DupCountLN. */
                            }
                        }
                    }
                } else {
                    if (origCursor.getIndex() > 0) {

                        /*
                         * We were adjusted to something other than the first
                         * entry so some insertion happened.
                         */
                        DatabaseImpl database = origBIN.getDatabase();
                        for (int i = 0; i < origCursor.getIndex(); i++) {
                            if (!origBIN.isEntryKnownDeleted(i)) {
                                Node n = origBIN.fetchTarget(i);
                                if (n != null && !n.containsDuplicates()) {
                                    LN ln = (LN) n;
                                    /* See comment above about locking. */
                                    if (!ln.isDeleted()) {
                                        ret = true;
                                        break;
                                    }
                                } else {
                                    /* Need to check the DupCountLN. */
                                }
                            }
                        }
                    }
                }
            }
            origCursor.releaseBINs();
            return ret;
        }

        if (origDBIN != dupCursor.getDupBIN() &&
            origCursor.getIndex() == dupCursor.getIndex() &&
            getMode != GetMode.NEXT_NODUP &&
            getMode != GetMode.PREV_NODUP) {
            /* Same as above, only for the dupBIN. */
            origCursor.latchBINs();
            if (forward) {
                if (origDBIN.getNEntries() - 1 >
                    origCursor.getDupIndex()) {

                    /*
                     * We were adjusted to something other than the last entry
                     * so some insertion happened.
                     */
                    DatabaseImpl database = origDBIN.getDatabase();
                    for (int i = origCursor.getDupIndex() + 1;
                         i < origDBIN.getNEntries();
                         i++) {
                        if (!origDBIN.isEntryKnownDeleted(i)) {
                            Node n = origDBIN.fetchTarget(i);
                            LN ln = (LN) n;
                            /* See comment above about locking. */
                            if (n != null && !ln.isDeleted()) {
                                ret = true;
                                break;
                            }
                        }
                    }
                }
            } else {
                if (origCursor.getDupIndex() > 0) {

                    /*
                     * We were adjusted to something other than the first entry
                     * so some insertion happened.
                     */
                    DatabaseImpl database = origDBIN.getDatabase();
                    for (int i = 0; i < origCursor.getDupIndex(); i++) {
                        if (!origDBIN.isEntryKnownDeleted(i)) {
                            Node n = origDBIN.fetchTarget(i);
                            LN ln = (LN) n;
                            /* See comment above about locking. */
 
View Full Code Here

                     false); // readCommittedIsolation
                isWritableLocker = !dbConfig.getTransactional() ||
                                   locker.isTransactional();
            }

            DatabaseImpl database = environmentImpl.getDb(locker,
                                                          databaseName,
                                                          newDb);
            boolean databaseExists =
                (database == null) ? false :
                ((database.getIsDeleted()) ? false : true);

            if (databaseExists) {
                if (dbConfig.getAllowCreate() &&
                    dbConfig.getExclusiveCreate()) {
                    /* We intended to create this, but it already exists. */
 
View Full Code Here

TOP

Related Classes of com.sleepycat.je.dbi.DatabaseImpl

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.