Examples of DatabaseConfig


Examples of com.sleepycat.je.DatabaseConfig

        String dbName = (String)params[2];

        Database db = null;
        try {
            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setReadOnly(true);
            DbInternal.setUseExistingConfig(dbConfig, true);
            db = env.openDatabase(null, dbName, dbConfig);

            return db.getStats(getStatsConfig(params));
        } finally {
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

                (autoTxn, DbType.UTILIZATION.getInternalName(), null);
            if (db == null) {
                if (env.isReadOnly()) {
                    return false;
                }
                DatabaseConfig dbConfig = new DatabaseConfig();
                DbInternal.setReplicated(dbConfig, false);
                db = dbTree.createInternalDb
                    (autoTxn, DbType.UTILIZATION.getInternalName(),
                     dbConfig);
            }
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

                if (envImpl.isReadOnly()) {
                    /* This should have been caught earlier. */
                    throw EnvironmentFailureException.unexpectedState
                       ("A replicated environment can't be opened read only.");
                }
                DatabaseConfig dbConfig = new DatabaseConfig();
                DbInternal.setReplicated(dbConfig, false);
                db = dbTree.createInternalDb(locker, mappingDbName, dbConfig);
            }
            mappingDbImpl = db;
        } finally {
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

    public static void verifyDb(Environment env,
                                PrintStream out,
                                boolean verbose)
        throws DatabaseException {

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setReadOnly(true);
        Database db = env.openDatabase
            (null, DbType.VLSN_MAP.getInternalName(), dbConfig);
        Cursor cursor = null;
        try {
            if (verbose) {
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

        EnvironmentConfig envConfiguration = new EnvironmentConfig();
        envConfiguration.setReadOnly(true);
        envConfiguration.setCachePercent(40);
        Environment env1 = new Environment(home1, envConfiguration);

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setReadOnly(true);
        DbInternal.setUseExistingConfig(dbConfig, true);

        Database db2;
        if (home2 != null) {
            Environment env2 = new Environment(home2, envConfiguration);
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

        boolean ret = (env1names.size() == env2names.size());
        if (!ret) {
            output("Environments have different number of databases.");
        }
        for (String dbName : env1names) {
            DatabaseConfig dbConfig = new DatabaseConfig();
            dbConfig.setReadOnly(true);
            DbInternal.setUseExistingConfig(dbConfig, true);
            Database db1, db2;
            try {
                db1 = env1.openDatabase(null, dbName, dbConfig);
            } catch (DatabaseNotFoundException e) {
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

         * succeed, the environments match.
         */
        for (String dbName : envNames) {
            channel = connect(addr);

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

Examples of com.sleepycat.je.DatabaseConfig

        if (dbName == null) {
            throw new IllegalArgumentException
                ("Must supply a database name if -l not supplied.");
        }

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setSortedDuplicates(dupSort);
        dbConfig.setAllowCreate(true);
        Database db;
        try {
            db = env.openDatabase(null, dbName, dbConfig);
        } catch (DatabaseNotFoundException e) {
            /* Should never happen, AllowCreate is true. */
 
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

            /* Open a read-only catalog that uses the stored model. */
            if (model != null) {
                throw new IllegalArgumentException
                    ("A model may not be specified when opening a RawStore");
            }
            DatabaseConfig dbConfig = new DatabaseConfig();
            /* <!-- begin JE only --> */
            DbInternal.setReplicated(dbConfig, storeConfig.getReplicated());
            /* <!-- end JE only --> */
            dbConfig.setReadOnly(true);
            dbConfig.setTransactional
                (storeConfig.getTransactional());
            catalog = new PersistCatalog
                (env, storePrefix, storePrefix + CATALOG_DB, dbConfig,
                 null /*model*/, config.getMutations(), rawAccess, this);
        } else {
            /* Open the shared catalog that uses the current model. */
            synchronized (catalogPool) {
                Map<String, PersistCatalog> catalogMap = catalogPool.get(env);
                if (catalogMap == null) {
                    catalogMap = new HashMap<String, PersistCatalog>();
                    catalogPool.put(env, catalogMap);
                }
                catalog = catalogMap.get(storeName);
                if (catalog != null) {
                    catalog.openExisting();
                } else {
                    DatabaseConfig dbConfig = new DatabaseConfig();
                    dbConfig.setAllowCreate(storeConfig.getAllowCreate());
                    dbConfig.setExclusiveCreate
                        (storeConfig.getExclusiveCreate());
                    /* <!-- begin JE only --> */
                    dbConfig.setTemporary(storeConfig.getTemporary());
                    DbInternal.setReplicated(dbConfig,
                                             storeConfig.getReplicated());
                    /* <!-- end JE only --> */
                    dbConfig.setReadOnly(storeConfig.getReadOnly());
                    dbConfig.setTransactional
                        (storeConfig.getTransactional());
                    DbCompat.setTypeBtree(dbConfig);
                    catalog = new PersistCatalog
                        (env, storePrefix, storePrefix + CATALOG_DB, dbConfig,
                         model, config.getMutations(), rawAccess, this);
View Full Code Here

Examples of com.sleepycat.je.DatabaseConfig

             * Use a no-wait transaction to avoid blocking on a Replica while
             * attempting to open an index that is currently being populated
             * via the replication stream from the Master.
             */
            Transaction txn = null;
            DatabaseConfig dbConfig = getPrimaryConfig(entityMeta);
            if (dbConfig.getTransactional() &&
                DbCompat.getThreadTransaction(env) == null) {
                txn = env.beginTransaction(null, autoCommitNoWaitTxnConfig);
            }
            PrimaryOpenState priOpenState =
                new PrimaryOpenState(entityClassName);
            final boolean saveAllowCreate = dbConfig.getAllowCreate();
            boolean success = false;
            try {

                /*
                 * The AllowCreate setting is false in read-only / Replica
                 * upgrade mode. In this mode new primaries are not available.
                 * They can be opened later when the upgrade is complete on the
                 * Master, by calling getSecondaryIndex.  [#16655]
                 */
                if (catalog.isReadOnly()) {
                    dbConfig.setAllowCreate(false);
                }

                /*
                 * Open the primary database.  Account for database renaming
                 * by calling getDatabaseClassName.  The dbClassName will be
                 * null if the format has not yet been stored. [#16655].
                 */
                Database db = null;
                final String dbClassName =
                    catalog.getDatabaseClassName(entityClassName);
                if (dbClassName != null) {
                    final String[] fileAndDbNames =
                        parseDbName(storePrefix + dbClassName);
                    /* <!-- begin JE only --> */
                    try {
                    /* <!-- end JE only --> */
                        db = DbCompat.openDatabase(env, txn, fileAndDbNames[0],
                                                   fileAndDbNames[1],
                                                   dbConfig);
                    /* <!-- begin JE only --> */
                    } catch (LockConflictException e) {
                        /* Treat this as if the database does not exist. */
                    }
                    /* <!-- end JE only --> */
                }
                if (db == null) {
                    throw new IndexNotAvailableException
                        ("PrimaryIndex not yet available on this Replica, " +
                         "entity class: " + entityClassName);
                }

                priOpenState.addDatabase(db);

                /* Create index object. */
                priIndex = new InternalPrimaryIndex(db, primaryKeyClass,
                                                    keyBinding, entityClass,
                                                    entityBinding);

                /* Update index and database maps. */
                priIndexMap.put(entityClassName, priIndex);
                if (DbCompat.getDeferredWrite(dbConfig)) {
                    deferredWriteDatabases.put(db, null);
                }

                /* If not read-only, open all associated secondaries. */
                if (!dbConfig.getReadOnly()) {
                    openSecondaryIndexes(txn, entityMeta, priOpenState);

                    /*
                     * To enable foreign key contraints, also open all primary
                     * indexes referring to this class via a relatedEntity
                     * property in another entity. [#15358]
                     */
                    Set<String> inverseClassNames =
                        inverseRelatedEntityMap.get(entityClassName);
                    if (inverseClassNames != null) {
                        for (String relatedClsName : inverseClassNames) {
                            getRelatedIndex(relatedClsName);
                        }
                    }
                }
                success = true;
            } finally {
                dbConfig.setAllowCreate(saveAllowCreate);
                if (success) {
                    if (txn != null) {
                        txn.commit();
                    }
                } else {
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.