allow skipping tablestats, update namer

This commit is contained in:
Jonathan Shook
2022-08-09 12:54:07 -05:00
parent 8b5052d393
commit e8b26b1040
2 changed files with 17 additions and 2 deletions

View File

@@ -20,12 +20,18 @@ import io.nosqlbench.cqlgen.api.CGModelTransformer;
import io.nosqlbench.cqlgen.api.CGTransformerConfigurable;
import io.nosqlbench.cqlgen.core.CGSchemaStats;
import io.nosqlbench.cqlgen.model.CqlModel;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Locale;
import java.util.Map;
public class CGGenStatsInjector implements CGModelTransformer, CGTransformerConfigurable {
private final static Logger logger = LogManager.getLogger(CGGenStatsInjector.class);
private CGSchemaStats schemaStats = null;
private String name;
@@ -51,6 +57,15 @@ public class CGGenStatsInjector implements CGModelTransformer, CGTransformerConf
String histogramPath = config.get("path").toString();
if (histogramPath != null) {
if (!Files.exists(Path.of(histogramPath))) {
logger.error("Unable to load tablestats file from '" + histogramPath + "' because it doesn't exists.");
Object onmissing = config.get("onmissing");
if (onmissing==null || !String.valueOf(onmissing).toLowerCase(Locale.ROOT).equals("skip")) {
throw new RuntimeException("Unable to continue. onmissing=" + onmissing.toString());
} else {
return;
}
}
CGSchemaStats schemaStats = null;
Path statspath = Path.of(histogramPath);
try {
@@ -61,7 +76,6 @@ public class CGGenStatsInjector implements CGModelTransformer, CGTransformerConf
e.printStackTrace();
throw new RuntimeException(e);
}
} else schemaStats = null;
} else {
throw new RuntimeException("stats injector requires a map for it's config value");

View File

@@ -57,6 +57,7 @@ model_transformers:
class: CGGenStatsInjector
config:
path: tablestats
onmissing: skip
# Uses nodetool histogram stats to weight reads and writes over all ops
# This depends on data from the stats injector above. If not provided,
@@ -93,7 +94,7 @@ model_transformers:
# This affects block names, op template names and so on, and also how
# op templates will be named in all logs and metric views.
naming_template: "[OPTYPE-][KEYSPACE-][TYPE-][NAME]"
naming_template: "[OPTYPE-][TYPE-][KEYSPACE-][TABLE-][NAME]"
# for more distinction in metric names if needed:
#naming_template: "[BLOCKNAME-][OPTYPE-][KEYSPACE-][TYPE-][NAME]"