Package com.sleepycat.je

Examples of com.sleepycat.je.EnvironmentMutableConfig


                    (((Boolean) value).booleanValue());
            } else {
                /* Set the specified attribute if the environment is open. */
                if (targetEnv != null) {

                    EnvironmentMutableConfig config =
                        targetEnv.getMutableConfig();

                    if (name.equals(ATT_CACHE_SIZE)) {
                        config.setCacheSize(((Long) value).longValue());
                        targetEnv.setMutableConfig(config);
                    } else if (name.equals(ATT_CACHE_PERCENT)) {
                        config.setCachePercent(((Integer) value).intValue());
                        targetEnv.setMutableConfig(config);
                    } else {
                        throw new AttributeNotFoundException
                            ("attribute " + name + " is not valid.");
                    }
View Full Code Here


            throw new InvalidAttributeValueException
                ("Attribute value for attribute " + name + " can't be null");
        }

        try {
            EnvironmentMutableConfig mutableConfig = env.getMutableConfig();

            if (name.equals(ATT_CACHE_SIZE)) {
                mutableConfig.setCacheSize(((Long) value).longValue());
                env.setMutableConfig(mutableConfig);
            } else if (name.equals(ATT_CACHE_PERCENT)) {
                mutableConfig.setCachePercent(((Integer) value).intValue());
                env.setMutableConfig(mutableConfig);
            } else {
                throw new AttributeNotFoundException
                    ("Attribute " + name + " is not valid.");
            }
View Full Code Here

        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();
        env.evictMemory();
        long end = System.currentTimeMillis();
View Full Code Here

     */
    private void adjustCacheSizes() {
        long newSharedCacheSize = voldemortConfig.getBdbCacheSize() - this.reservedCacheSize;
        logger.info("Setting the shared cache size to " + newSharedCacheSize);
        for(Environment environment: unreservedStores) {
            EnvironmentMutableConfig mConfig = environment.getMutableConfig();
            mConfig.setCacheSize(newSharedCacheSize);
            environment.setMutableConfig(mConfig);
        }
    }
View Full Code Here

        String storeName = storeDef.getName();
        Environment environment = environments.get(storeName);
        // change reservation amount of reserved store
        if(!unreservedStores.contains(environment) && storeDef.hasMemoryFootprint()) {
            EnvironmentMutableConfig mConfig = environment.getMutableConfig();
            long currentCacheSize = mConfig.getCacheSize();
            long newCacheSize = storeDef.getMemoryFootprintMB() * ByteUtils.BYTES_PER_MB;
            if(currentCacheSize != newCacheSize) {
                long newReservedCacheSize = this.reservedCacheSize - currentCacheSize
                                            + newCacheSize;

                // check that we leave a 'minimum' shared cache
                if((voldemortConfig.getBdbCacheSize() - newReservedCacheSize) < voldemortConfig.getBdbMinimumSharedCache()) {
                    throw new StorageInitializationException("Reservation of "
                                                             + storeDef.getMemoryFootprintMB()
                                                             + " MB for store "
                                                             + storeName
                                                             + " violates minimum shared cache size of "
                                                             + voldemortConfig.getBdbMinimumSharedCache());
                }

                this.reservedCacheSize = newReservedCacheSize;
                adjustCacheSizes();
                mConfig.setCacheSize(newCacheSize);
                environment.setMutableConfig(mConfig);
                logger.info("Setting private cache for store " + storeDef.getName() + " to "
                            + newCacheSize);
            }
        } else {
View Full Code Here

            synchronized(this) {
                numOutstandingBatchWriteJobs++;
                // turn the checkpointer off for the first job
                if(numOutstandingBatchWriteJobs == 1) {
                    logger.info("Turning checkpointer off for batch writes");
                    EnvironmentMutableConfig mConfig = environment.getMutableConfig();
                    mConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CHECKPOINTER,
                                           Boolean.toString(false));
                    environment.setMutableConfig(mConfig);
                    return true;
                }
            }
View Full Code Here

            synchronized(this) {
                numOutstandingBatchWriteJobs--;
                // turn the checkpointer back on if the last job finishes
                if(numOutstandingBatchWriteJobs == 0) {
                    logger.info("Turning checkpointer on");
                    EnvironmentMutableConfig mConfig = environment.getMutableConfig();
                    mConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CHECKPOINTER,
                                           Boolean.toString(true));
                    environment.setMutableConfig(mConfig);
                    return true;
                }
            }
View Full Code Here

        EnvironmentConfig envConfig = new EnvironmentConfig();
        //envConfig.setTransactional(true);
        envConfig.setAllowCreate(true);
        dbEnv = new Environment(dbDir, envConfig);

        EnvironmentMutableConfig envMutableConfig = new EnvironmentMutableConfig();
        //envMutableConfig.setDurability(Durability.COMMIT_SYNC);
        //envMutableConfig.setDurability(Durability.COMMIT_NO_SYNC);
        envMutableConfig.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
        dbEnv.setMutableConfig(envMutableConfig);

        DatabaseConfig dbConfig = new DatabaseConfig();
        dbConfig.setAllowCreate(true);
        //dbConfig.setDeferredWrite(true);
View Full Code Here

                                             ((Boolean) value).booleanValue());
            } else {
                /* Set the specified attribute if the environment is open. */
                if (targetEnv != null) {

                    EnvironmentMutableConfig config =
                        targetEnv.getMutableConfig();

                    if (name.equals(ATT_CACHE_SIZE)) {
                        config.setCacheSize(((Long) value).longValue());
                        targetEnv.setMutableConfig(config);
                    } else if (name.equals(ATT_CACHE_PERCENT)) {
                        config.setCachePercent(((Integer) value).intValue());
                        targetEnv.setMutableConfig(config);
                    } else {
                        throw new AttributeNotFoundException("attribute " +
                                                             name +
                                                             " is not valid.");
View Full Code Here

        throws DatabaseException {
     
        /* push the cache size down by half to force eviction. */
        EnvironmentImpl envImpl = DbInternal.envGetEnvironmentImpl(env);
        long cacheUsage = envImpl.getMemoryBudget().getCacheMemoryUsage();
        EnvironmentMutableConfig c = new EnvironmentMutableConfig();
        c.setCacheSize(cacheUsage/2);
        env.setMutableConfig(c);

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

TOP

Related Classes of com.sleepycat.je.EnvironmentMutableConfig

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.