Examples of BabuDBConfig


Examples of org.xtreemfs.babudb.config.BabuDBConfig

public class SimpleDemo {
   
    public static void main(String[] args) throws InterruptedException {
        try {
            // start the database
            BabuDB databaseSystem = BabuDBFactory.createBabuDB(new BabuDBConfig("myDatabase/", "myDatabase/",
                2, 1024 * 1024 * 16, 5 * 60, SyncMode.SYNC_WRITE, 0, 0, false, 16, 1024 * 1024 * 512));
            DatabaseManager dbm = databaseSystem.getDatabaseManager();
           
            // create a new database called myDB
            dbm.createDatabase("myDB", 2);
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

                + " is too short to create enough unique keys for " + numKeys + " keys");
       
        FSUtils.delTree(new File(dbDir));
       
        // use one worker because we use one database TODO rebuild
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(dbDir, dbDir, numDBWorkers, 1, 0, syncMode,
            pseudoModeWait, maxQ, compression, maxNumRecordsPerBlock, maxBlockFileSize));
        /*
         * ReplicationConfig conf = new
         * ReplicationConfig("config/replication.properties"); conf.read();
         * database = BabuDBFactory.createBabuDB(conf); slaveDB =
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

        System.out.println("Setting up the BabuDB instances ... ");
       
        ConfigBuilder builder0 = new ConfigBuilder();
        builder0.setDataPath("/tmp/babudb0", "/tmp/babudb0/log").setLogAppendSyncMode(SyncMode.SYNC_WRITE);
        builder0.addPlugin("myBabuDBPath/pluginConfig0.properties");
        BabuDBConfig config0 = builder0.build();

        ConfigBuilder builder1 = new ConfigBuilder();
        builder1.setDataPath("/tmp/babudb1", "/tmp/babudb1/log").setLogAppendSyncMode(SyncMode.SYNC_WRITE);
        builder1.addPlugin("myBabuDBPath/pluginConfig1.properties");
        BabuDBConfig config1 = builder1.build();

        BabuDB babuDB0 = BabuDBFactory.createBabuDB(config0);
        BabuDB babuDB1 = BabuDBFactory.createBabuDB(config1);
       
        System.out.println("Creating database \"myDatabase\" ... ");
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

       
        File dir = new File(destPath);
        if (!dir.exists() && !dir.mkdirs())
            throw new IOException("Directory doesnt exist and cannot be created:'" + destPath + "'");
       
        BabuDBConfig cfg = dbs.getConfig();
        dbs.getDBConfigFile().save(destPath + cfg.getDbCfgFile());
       
        for (DatabaseInternal db : dbsByName.values()) {
            db.dumpSnapshot(destPath);
        }
    }
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    public void tearDown() throws Exception {
    }
   
    @Test
    public void testConsistentWithSingleDB() throws Exception {
        BabuDB database = BabuDBFactory.createBabuDB(new BabuDBConfig(origDir, origDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, compression, maxNumRecs, maxBlockFileSize));
       
        Database db = database.getDatabaseManager().createDatabase("test", numIndices);
       
        // fill database with random entries
        for (int i = 0; i < numIndices; i++) {
            for (int e = 0; e < 100; e++) {
                int randnum = (int) (Math.random() * Integer.MAX_VALUE);
                final String key = String.valueOf(randnum);
                final String value = "VALUE_" + randnum;
                db.singleInsert(i, key.getBytes(), value.getBytes(),null).get();
            }
        }
       
        System.out.println("Creating backup database...");
        database.getDatabaseManager().dumpAllDatabases(backupDir);
             
        BabuDB babuBackup = BabuDBFactory.createBabuDB(new BabuDBConfig(backupDir, backupDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, compression, maxNumRecs, maxBlockFileSize));
       
        Database backupDB = babuBackup.getDatabaseManager().getDatabase("test");
       
        // check entries
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    @Test
    public void testCopyDatabase() throws Exception {
       
        final int NUMIDX = 5;
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0, SyncMode.ASYNC, 0,
            0, compression, maxNumRecs, maxBlockFileSize));
       
        Database db = database.getDatabaseManager().createDatabase("testDB", NUMIDX);
       
        // fill database with random entries
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    }
   
    @Test
    public void testLargeIndexWithConcurrentCheckpoint() throws Exception {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 1000, 0,
            SyncMode.ASYNC, 0, 0, compression, maxNumRecs, maxBlockFileSize, true, 1000, 7));
       
        Database db = database.getDatabaseManager().createDatabase("test", 1);
       
        final long entryCount = 50000;
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

    }
   
    @Test
    public void testShutdownRestart() throws Exception {
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
       
        Database db = database.getDatabaseManager().createDatabase("test", 3);
        DatabaseInsertGroup ig = db.createInsertGroup();
        ig.addInsert(0, "Yagga".getBytes(), "Brabbel".getBytes());
        ig.addInsert(1, "Brabbel".getBytes(), "Blupp".getBytes());
        ig.addInsert(2, "Blupp".getBytes(), "Blahh".getBytes());
        db.insert(ig, null).get();
       
        Database db2 = database.getDatabaseManager().createDatabase("test2", 1);
        ig = db2.createInsertGroup();
        ig.addInsert(0, "test".getBytes(), "test".getBytes());
        db2.insert(ig, null).get();
        database.getDatabaseManager().deleteDatabase("test2");
       
        database.shutdown();
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 0, 0, 0, SyncMode.ASYNC, 0,
            0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        db = database.getDatabaseManager().getDatabase("test");
        byte[] result = db.lookup(0, "Yagga".getBytes(), null).get();
        assertNotNull(result);
        String value = new String(result);
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

        database.shutdown();
    }
   
    @Test
    public void testReplayAfterCrash() throws Exception {
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 2);
        db.singleInsert(0, "Yagga".getBytes(), "Brabbel".getBytes(), null).get();
        database.getCheckpointer().checkpoint();
        byte[] result = db.lookup(0, "Yagga".getBytes(), null).get();
        String value = new String(result);
        assertEquals(value, "Brabbel");
       
        db.singleInsert(0, "Brabbel".getBytes(), "Blupp".getBytes(), null).get();
        result = db.lookup(0, "Brabbel".getBytes(), null).get();
        value = new String(result);
        assertEquals(value, "Blupp");
       
        db.singleInsert(0, "Blupp".getBytes(), "Blahh".getBytes(), null).get();
        result = db.lookup(0, "Blupp".getBytes(), null).get();
        value = new String(result);
        assertEquals(value, "Blahh");
       
        ((BabuDBImpl) database).__test_killDB_dangerous();
        Thread.sleep(500);
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 2, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        db = database.getDatabaseManager().getDatabase("test");
        result = db.lookup(0, "Yagga".getBytes(), null).get();
        assertNotNull(result);
        value = new String(result);
View Full Code Here

Examples of org.xtreemfs.babudb.config.BabuDBConfig

        database.shutdown();
    }
   
    @Test
    public void testShutdownAfterCheckpoint() throws Exception {
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 1, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        Database db = database.getDatabaseManager().createDatabase("test", 2);
        db.singleInsert(0, "Yagga".getBytes(), "Brabbel".getBytes(), null).get();
       
        byte[] result = db.lookup(0, "Yagga".getBytes(), null).get();
        String value = new String(result);
        assertEquals(value, "Brabbel");
       
        db.singleInsert(0, "Brabbel".getBytes(), "Blupp".getBytes(), null).get();
        result = db.lookup(0, "Brabbel".getBytes(), null).get();
        value = new String(result);
        assertEquals(value, "Blupp");
       
        db.singleInsert(0, "Blupp".getBytes(), "Blahh".getBytes(), null).get();
        result = db.lookup(0, "Blupp".getBytes(), null).get();
        value = new String(result);
        assertEquals(value, "Blahh");
       
        database.getCheckpointer().checkpoint();
        database.shutdown();
       
        database = BabuDBFactory.createBabuDB(new BabuDBConfig(baseDir, baseDir, 2, 0, 0,
            SyncMode.SYNC_WRITE, 0, 0, COMPRESSION, maxNumRecs, maxBlockFileSize, !MMAP, -1, LOG_LEVEL));
        db = database.getDatabaseManager().getDatabase("test");
        result = db.lookup(0, "Yagga".getBytes(), null).get();
        assertNotNull(result);
        value = new String(result);
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.