Package com.sleepycat.je

Examples of com.sleepycat.je.DatabaseConfig


        final int increment = Integer.parseInt(args[3]);
        final int threads = Integer.parseInt(args[4]);

        Environment environment;
        EnvironmentConfig environmentConfig;
        DatabaseConfig databaseConfig;

        environmentConfig = new EnvironmentConfig();
        environmentConfig.setCacheSize(cacheSize);
        environmentConfig.setDurability(Durability.COMMIT_NO_SYNC);
        environmentConfig.setConfigParam(EnvironmentConfig.LOG_FILE_MAX, "1000000000");
        environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_MAX_BATCH_FILES, "100");
        environmentConfig.setConfigParam(EnvironmentConfig.CLEANER_READ_SIZE, "52428800");
        environmentConfig.setAllowCreate(true);
        environmentConfig.setTransactional(true);
        databaseConfig = new DatabaseConfig();
        databaseConfig.setAllowCreate(true);
        // databaseConfig.setDeferredWrite(true);
        databaseConfig.setTransactional(true);
        databaseConfig.setNodeMaxEntries(1024);
        File bdbDir = new File(dir);
        if(!bdbDir.exists()) {
            bdbDir.mkdir();
        } else {
            for(File f: bdbDir.listFiles())
View Full Code Here


        EnvironmentConfig environmentConfig = new EnvironmentConfig();
        environmentConfig.setDurability(Durability.COMMIT_NO_SYNC);
        environmentConfig.setAllowCreate(true);
        environmentConfig.setTransactional(config.isBdbWriteTransactionsEnabled());
        Environment environment = new Environment(new File(bdbDir), environmentConfig);
        DatabaseConfig databaseConfig = new DatabaseConfig();
        databaseConfig.setAllowCreate(true);
        databaseConfig.setTransactional(config.isBdbWriteTransactionsEnabled());
        databaseConfig.setSortedDuplicates(false);
        Database database = environment.openDatabase(null, storeName, databaseConfig);

        StorageEngine<ByteArray, byte[], byte[]> store = null;
        if(config.getBdbPrefixKeysWithPartitionId()) {
            store = new PartitionPrefixedBdbStorageEngine(storeName,
View Full Code Here

        this.envConfig.setDurability(Durability.COMMIT_NO_SYNC);
        this.envConfig.setAllowCreate(true);
        this.envConfig.setTransactional(true);
        this.tempDir = TestUtils.createTempDir();
        this.environment = new Environment(this.tempDir, envConfig);
        this.databaseConfig = new DatabaseConfig();
        databaseConfig.setAllowCreate(true);
        databaseConfig.setTransactional(true);
        databaseConfig.setSortedDuplicates(false);
        this.database = environment.openDatabase(null, "test", databaseConfig);
        this.runtimeConfig = new BdbRuntimeConfig();
View Full Code Here

    final File envDir = new File(_storagePath);
    if (!envDir.exists())
      envDir.mkdirs();
    _env = new Environment(envDir, envConfig);

    final DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setAllowCreate(true);
    dbConfig.setTemporary(true); // opposite to DiskPermanent
    dbConfig.setTransactional(false);
    // dbConfig.setCacheMode(CacheMode.EVICT_LN); // keeps only internal nodes in the memory
    // dbConfig.setSortedDuplicates(true); // terribly slow
    _db = _env.openDatabase(null, "simpleDb", dbConfig);
  }
View Full Code Here

                final EnvironmentConfig dbEnvConfig = new EnvironmentConfig();
                dbEnvConfig.setTransactional(true);
                dbEnvConfig.setAllowCreate(true);
                dbEnvConfig.setLockTimeout(5, TimeUnit.SECONDS);
                environment = new Environment(dir, dbEnvConfig);
                final DatabaseConfig dbConfig = new DatabaseConfig();
                dbConfig.setTransactional(true);
                dbConfig.setAllowCreate(true);
                database = environment.openDatabase(null, name, dbConfig);
            } catch (final Exception ex) {
                LOGGER.error("Could not create FlumePersistentManager", ex);
                return null;
            }
View Full Code Here

        throw e;
      }
      listener.onInfo(Thread.currentThread(), null, "file -> " + f.getAbsolutePath() + " delete success !");
    }
   
    DatabaseConfig dbConfig = new DatabaseConfig();
    dbConfig.setAllowCreate(true);
    EnvironmentConfig ec = new EnvironmentConfig();
    ec.setAllowCreate(true);
    env = new Environment(dir, ec);
    db = env.openDatabase(null, name, dbConfig);
    lastDocID = 0;
View Full Code Here

    public synchronized EntityIndex<SK, PK> keysIndex()
        throws DatabaseException {

        if (keysIndex == null) {
            if (keysDb == null) {
                DatabaseConfig config = secDb.getConfig();
                config.setReadOnly(true);
                config.setAllowCreate(false);
                config.setExclusiveCreate(false);  
                keysDb = DbCompat.openDatabase
                    (db.getEnvironment(), null /*txn*/,
                     DbCompat.getDatabaseFile(secDb),
                     secDb.getDatabaseName(),
                     config);
View Full Code Here

               EntryBinding keyBinding,
               ValueAdapter<E> entityAdapter)
        throws DatabaseException {

        this.db = db;
        DatabaseConfig config = db.getConfig();
        transactional = config.getTransactional();
        sortedDups = config.getSortedDuplicates();
        locking =
            DbCompat.getInitializeLocking(db.getEnvironment().getConfig());
        Environment env = db.getEnvironment();
        concurrentDB = DbCompat.getInitializeCDB(env.getConfig());
        this.keyClass = keyClass;
        this.keyBinding = keyBinding;
        this.entityAdapter = entityAdapter;

        emptyRange = new KeyRange(config.getBtreeComparator());
        keyAdapter = new KeyValueAdapter(keyClass, keyBinding);
    }
View Full Code Here

                              "DbDump.dump of " + dbName + " starting");

        DatabaseEntry foundKey = new DatabaseEntry();
        DatabaseEntry foundData = new DatabaseEntry();

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setReadOnly(true);
        DbInternal.setUseExistingConfig(dbConfig, true);
        Database db;
        try {
            db = env.openDatabase(null, dbName, dbConfig);
        } catch (DatabaseExistsException e) {
View Full Code Here

    /**
     * Create a database config for use on the replica which contains
     * all the configuration options that were conveyed by way of this class.
     */
    public DatabaseConfig getReplicaConfig(EnvironmentImpl envImpl) {
        DatabaseConfig replicaConfig = new DatabaseConfig();
        replicaConfig.setTransactional(true);
        replicaConfig.setSortedDuplicates
            (DatabaseImpl.getSortedDuplicates(flags));

        /*
         * KeyPrefixing is set to true if dups are enabled, to account for the
         * upgrade scenario where the Master has not yet been upgraded but the
         * Replica has been.
         */
        replicaConfig.setKeyPrefixing(DatabaseImpl.getKeyPrefixing(flags) ||
                                      DatabaseImpl.getSortedDuplicates(flags));
        replicaConfig.setTemporary(DatabaseImpl.isTemporary(flags));
        DbInternal.setReplicated(replicaConfig, true);
        replicaConfig.setNodeMaxEntries(maxTreeEntriesPerNode);

        DatabaseImpl.ComparatorReader reader =
            new DatabaseImpl.ComparatorReader(btreeComparatorBytes,
                                              "Btree",
                                              envImpl.getClassLoader());
        if (reader.isClass()) {
            replicaConfig.setBtreeComparator(reader.getComparatorClass());
        } else {
            replicaConfig.setBtreeComparator(reader.getComparator());
        }

        reader = new DatabaseImpl.ComparatorReader(duplicateComparatorBytes,
                                                   "Duplicate",
                                                   envImpl.getClassLoader());
        if (reader.isClass()) {
            replicaConfig.setDuplicateComparator(reader.getComparatorClass());
        } else {
            replicaConfig.setDuplicateComparator(reader.getComparator());
        }

        replicaConfig.setTriggers(TriggerUtils.
                                  unmarshallTriggers(null, triggerBytes,
                                                     envImpl.getClassLoader()));

        return replicaConfig;
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.DatabaseConfig

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.