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;
}
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();
}
}
Aggregations