Search in sources :

Example 1 with BookkeeperCommitLogManager

use of herddb.cluster.BookkeeperCommitLogManager in project herddb by diennea.

the class ReplicatedLogtestcase method startDBManager.

protected DBManager startDBManager(String nodeId) throws Exception {
    File nodeDirectory = new File(folder.getRoot(), nodeId + "");
    nodeDirectory.mkdirs();
    Path path = nodeDirectory.toPath();
    ZookeeperMetadataStorageManager metadataStorageManager = new ZookeeperMetadataStorageManager(testEnv.getAddress(), testEnv.getTimeout(), "/tests");
    BookkeeperCommitLogManager commitLogManager = new BookkeeperCommitLogManager(metadataStorageManager, new ServerConfiguration());
    FileDataStorageManager dataStorageManager = new FileDataStorageManager(path);
    System.setErr(System.out);
    DBManager manager = new DBManager(nodeId, metadataStorageManager, dataStorageManager, commitLogManager, folder.newFolder().toPath(), null);
    manager.start();
    return manager;
}
Also used : Path(java.nio.file.Path) ZookeeperMetadataStorageManager(herddb.cluster.ZookeeperMetadataStorageManager) ServerConfiguration(herddb.server.ServerConfiguration) FileDataStorageManager(herddb.file.FileDataStorageManager) BookkeeperCommitLogManager(herddb.cluster.BookkeeperCommitLogManager) File(java.io.File)

Example 2 with BookkeeperCommitLogManager

use of herddb.cluster.BookkeeperCommitLogManager in project herddb by diennea.

the class Server method buildCommitLogManager.

private CommitLogManager buildCommitLogManager() {
    switch(mode) {
        case ServerConfiguration.PROPERTY_MODE_LOCAL:
            return new MemoryCommitLogManager();
        case ServerConfiguration.PROPERTY_MODE_STANDALONE:
            Path logDirectory = this.baseDirectory.resolve(configuration.getString(ServerConfiguration.PROPERTY_LOGDIR, ServerConfiguration.PROPERTY_LOGDIR_DEFAULT));
            return new FileCommitLogManager(logDirectory, 64 * 1024 * 1024);
        case ServerConfiguration.PROPERTY_MODE_CLUSTER:
            BookkeeperCommitLogManager bkmanager = new BookkeeperCommitLogManager((ZookeeperMetadataStorageManager) this.metadataStorageManager, configuration);
            bkmanager.setAckQuorumSize(configuration.getInt(ServerConfiguration.PROPERTY_BOOKKEEPER_ACKQUORUMSIZE, ServerConfiguration.PROPERTY_BOOKKEEPER_ACKQUORUMSIZE_DEFAULT));
            bkmanager.setEnsemble(configuration.getInt(ServerConfiguration.PROPERTY_BOOKKEEPER_ENSEMBLE, ServerConfiguration.PROPERTY_BOOKKEEPER_ENSEMBLE_DEFAULT));
            bkmanager.setWriteQuorumSize(configuration.getInt(ServerConfiguration.PROPERTY_BOOKKEEPER_WRITEQUORUMSIZE, ServerConfiguration.PROPERTY_BOOKKEEPER_WRITEQUORUMSIZE_DEFAULT));
            long ledgersRetentionPeriod = configuration.getLong(ServerConfiguration.PROPERTY_BOOKKEEPER_LEDGERS_RETENTION_PERIOD, ServerConfiguration.PROPERTY_BOOKKEEPER_LEDGERS_RETENTION_PERIOD_DEFAULT);
            bkmanager.setLedgersRetentionPeriod(ledgersRetentionPeriod);
            long checkPointperiod = configuration.getLong(ServerConfiguration.PROPERTY_CHECKPOINT_PERIOD, ServerConfiguration.PROPERTY_CHECKPOINT_PERIOD_DEFAULT);
            if (checkPointperiod > 0 && ledgersRetentionPeriod > 0) {
                long limit = ledgersRetentionPeriod / 2;
                if (checkPointperiod > limit) {
                    throw new RuntimeException(ServerConfiguration.PROPERTY_CHECKPOINT_PERIOD + "=" + checkPointperiod + " must be less then " + ServerConfiguration.PROPERTY_BOOKKEEPER_LEDGERS_RETENTION_PERIOD + "/2=" + limit);
                }
            }
            return bkmanager;
        default:
            throw new RuntimeException();
    }
}
Also used : Path(java.nio.file.Path) FileCommitLogManager(herddb.file.FileCommitLogManager) MemoryCommitLogManager(herddb.mem.MemoryCommitLogManager) BookkeeperCommitLogManager(herddb.cluster.BookkeeperCommitLogManager)

Aggregations

BookkeeperCommitLogManager (herddb.cluster.BookkeeperCommitLogManager)2 Path (java.nio.file.Path)2 ZookeeperMetadataStorageManager (herddb.cluster.ZookeeperMetadataStorageManager)1 FileCommitLogManager (herddb.file.FileCommitLogManager)1 FileDataStorageManager (herddb.file.FileDataStorageManager)1 MemoryCommitLogManager (herddb.mem.MemoryCommitLogManager)1 ServerConfiguration (herddb.server.ServerConfiguration)1 File (java.io.File)1