use of org.voltdb.compiler.deploymentfile.CommandLogType.Frequency in project voltdb by VoltDB.
the class CatalogUtil method populateDefaultDeployment.
public static void populateDefaultDeployment(DeploymentType deployment) {
//partition detection
PartitionDetectionType pd = deployment.getPartitionDetection();
if (pd == null) {
pd = new PartitionDetectionType();
deployment.setPartitionDetection(pd);
}
//heartbeat
if (deployment.getHeartbeat() == null) {
HeartbeatType hb = new HeartbeatType();
deployment.setHeartbeat(hb);
}
SslType ssl = deployment.getSsl();
if (ssl == null) {
ssl = new SslType();
deployment.setSsl(ssl);
}
//httpd
HttpdType httpd = deployment.getHttpd();
if (httpd == null) {
httpd = new HttpdType();
// Find next available port starting with the default
httpd.setPort(Constants.HTTP_PORT_AUTO);
deployment.setHttpd(httpd);
}
//jsonApi
HttpdType.Jsonapi jsonApi = httpd.getJsonapi();
if (jsonApi == null) {
jsonApi = new HttpdType.Jsonapi();
httpd.setJsonapi(jsonApi);
}
//snapshot
if (deployment.getSnapshot() == null) {
SnapshotType snap = new SnapshotType();
snap.setEnabled(false);
deployment.setSnapshot(snap);
}
//Security
if (deployment.getSecurity() == null) {
SecurityType sec = new SecurityType();
deployment.setSecurity(sec);
}
//Paths
if (deployment.getPaths() == null) {
PathsType paths = new PathsType();
deployment.setPaths(paths);
}
//create paths entries
PathsType paths = deployment.getPaths();
if (paths.getVoltdbroot() == null) {
PathsType.Voltdbroot root = new PathsType.Voltdbroot();
paths.setVoltdbroot(root);
}
//snapshot
if (paths.getSnapshots() == null) {
PathsType.Snapshots snap = new PathsType.Snapshots();
paths.setSnapshots(snap);
}
if (paths.getCommandlog() == null) {
//cl
PathsType.Commandlog cl = new PathsType.Commandlog();
paths.setCommandlog(cl);
}
if (paths.getCommandlogsnapshot() == null) {
//cl snap
PathsType.Commandlogsnapshot clsnap = new PathsType.Commandlogsnapshot();
paths.setCommandlogsnapshot(clsnap);
}
if (paths.getExportoverflow() == null) {
//export overflow
PathsType.Exportoverflow exp = new PathsType.Exportoverflow();
paths.setExportoverflow(exp);
}
if (paths.getDroverflow() == null) {
final PathsType.Droverflow droverflow = new PathsType.Droverflow();
paths.setDroverflow(droverflow);
}
//Command log info
if (deployment.getCommandlog() == null) {
boolean enabled = false;
if (MiscUtils.isPro()) {
enabled = true;
}
CommandLogType cl = new CommandLogType();
cl.setEnabled(enabled);
Frequency freq = new Frequency();
cl.setFrequency(freq);
deployment.setCommandlog(cl);
}
//System settings
SystemSettingsType ss = deployment.getSystemsettings();
if (deployment.getSystemsettings() == null) {
ss = new SystemSettingsType();
deployment.setSystemsettings(ss);
}
SystemSettingsType.Elastic sse = ss.getElastic();
if (sse == null) {
sse = new SystemSettingsType.Elastic();
ss.setElastic(sse);
}
SystemSettingsType.Query query = ss.getQuery();
if (query == null) {
query = new SystemSettingsType.Query();
ss.setQuery(query);
}
SystemSettingsType.Snapshot snap = ss.getSnapshot();
if (snap == null) {
snap = new SystemSettingsType.Snapshot();
ss.setSnapshot(snap);
}
SystemSettingsType.Temptables tt = ss.getTemptables();
if (tt == null) {
tt = new SystemSettingsType.Temptables();
ss.setTemptables(tt);
}
ResourceMonitorType rm = ss.getResourcemonitor();
if (rm == null) {
rm = new ResourceMonitorType();
ss.setResourcemonitor(rm);
}
ResourceMonitorType.Memorylimit mem = rm.getMemorylimit();
if (mem == null) {
mem = new ResourceMonitorType.Memorylimit();
rm.setMemorylimit(mem);
}
}
use of org.voltdb.compiler.deploymentfile.CommandLogType.Frequency in project voltdb by VoltDB.
the class CatalogUtil method setCommandLogInfo.
/*
* Command log element is created in setPathsInfo
*/
private static void setCommandLogInfo(Catalog catalog, CommandLogType commandlog) {
int fsyncInterval = 200;
int maxTxnsBeforeFsync = Integer.MAX_VALUE;
org.voltdb.catalog.CommandLog config = catalog.getClusters().get("cluster").getLogconfig().add("log");
Frequency freq = commandlog.getFrequency();
if (freq != null) {
long maxTxnsBeforeFsyncTemp = freq.getTransactions();
if (maxTxnsBeforeFsyncTemp < 1 || maxTxnsBeforeFsyncTemp > Integer.MAX_VALUE) {
throw new RuntimeException("Invalid command log max txns before fsync (" + maxTxnsBeforeFsync + ") specified. Supplied value must be between 1 and (2^31 - 1) txns");
}
maxTxnsBeforeFsync = (int) maxTxnsBeforeFsyncTemp;
fsyncInterval = freq.getTime();
if (fsyncInterval < 1 | fsyncInterval > 5000) {
throw new RuntimeException("Invalid command log fsync interval(" + fsyncInterval + ") specified. Supplied value must be between 1 and 5000 milliseconds");
}
}
config.setEnabled(commandlog.isEnabled());
config.setSynchronous(commandlog.isSynchronous());
config.setFsyncinterval(fsyncInterval);
config.setMaxtxns(maxTxnsBeforeFsync);
config.setLogsize(commandlog.getLogsize());
}
Aggregations