mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
modify logger calls for computable messages via closures
This commit is contained in:
@@ -110,7 +110,7 @@ public abstract class Cqld4BaseOpDispenser extends BaseOpDispenser<Cqld4CqlOp, C
|
||||
|
||||
private Statement showstmt(Statement stmt, boolean input) {
|
||||
String query = cqlFor(stmt, new StringBuilder());
|
||||
logger.info("CQL(SIMPLE): " + query);
|
||||
logger.info(() -> "CQL(SIMPLE): " + query);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class Cqld4CoreOpMapper implements OpMapper<Op> {
|
||||
|
||||
TypeAndTarget<CqlD4OpType, String> target = op.getTypeAndTarget(CqlD4OpType.class, String.class, "type", "stmt");
|
||||
|
||||
logger.info("Using " + target.enumId + " statement form for '" + op.getName());
|
||||
logger.info(() -> "Using " + target.enumId + " statement form for '" + op.getName());
|
||||
|
||||
return switch (target.enumId) {
|
||||
case raw -> new CqlD4RawStmtMapper(adapter, sessionFunc, target.targetFunction).apply(op);
|
||||
|
||||
@@ -103,7 +103,7 @@ public class Cqld4FluentGraphOpMapper implements OpMapper<Op> {
|
||||
try {
|
||||
loader.loadClass(candidateName);
|
||||
classNames.add(candidateName);
|
||||
logger.debug("added import " + candidateName);
|
||||
logger.debug(() -> "added import " + candidateName);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Class '" + candidateName + "' was not found for fluent imports.");
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RingAnalyzer implements BundledApp {
|
||||
CommandLine cli = new CommandLine(cfg);
|
||||
CommandLine.ParseResult cl = cli.parseArgs(args);
|
||||
|
||||
logger.info("filename: " + cfg.filename);
|
||||
logger.info(() -> "filename: " + cfg.filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ public class BindingsAccumulator {
|
||||
accumulated.forEach((k,v) -> {
|
||||
inverted.computeIfAbsent(v,def -> new HashSet<>()).add(k);
|
||||
});
|
||||
logger.info("computed " + accumulated.size() + " raw bindings, consisting of " + inverted.size() + " unique definitions.");
|
||||
logger.info(() -> "computed " + accumulated.size() + " raw bindings, consisting of " + inverted.size() + " unique definitions.");
|
||||
return accumulated;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ public class CGTextTransformers implements Consumer<List<Map<String, ?>>>, Suppl
|
||||
Object cfgvalues = cfgmap.get("config");
|
||||
if (cfgvalues != null) {
|
||||
configurable.accept((cfgvalues));
|
||||
logger.info("configured transformer with " + cfgvalues);
|
||||
logger.info(() -> "configured transformer with " + cfgvalues);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ public class CGWorkloadExporter implements BundledApp {
|
||||
@Override
|
||||
public int applyAsInt(String[] args) {
|
||||
|
||||
logger.info("running CQL workload exporter with args:" + Arrays.toString(args));
|
||||
logger.info(() -> "running CQL workload exporter with args:" + Arrays.toString(args));
|
||||
|
||||
if (args.length == 0) {
|
||||
throw new RuntimeException("Usage example: PROG filepath.cql filepath.yaml");
|
||||
@@ -195,7 +195,7 @@ public class CGWorkloadExporter implements BundledApp {
|
||||
private String loadFile(Path path) {
|
||||
try {
|
||||
String ddl = Files.readString(path);
|
||||
logger.info("read " + ddl.length() + " character DDL file");
|
||||
logger.info(() -> "read " + ddl.length() + " character DDL file");
|
||||
return ddl;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@@ -348,7 +348,7 @@ public class CGWorkloadExporter implements BundledApp {
|
||||
blockdata.put("ops", ops);
|
||||
for (CqlTable table : model.getTableDefs()) {
|
||||
if (table.getClusteringColumns().size() == 0) {
|
||||
logger.debug("skipping table " + table.getFullName() + " for scan since there are no clustering columns");
|
||||
logger.debug(() -> "skipping table " + table.getFullName() + " for scan since there are no clustering columns");
|
||||
}
|
||||
ops.put(
|
||||
namer.nameFor(table, "optype", "scan", "blockname", blockname),
|
||||
|
||||
@@ -75,18 +75,18 @@ public class CqlModel {
|
||||
|
||||
CqlKeyspaceDef ksdef = getKeyspace(statsKeyspacename);
|
||||
if (ksdef !=null) {
|
||||
logger.debug("setting keyspace stats for '" + statsKeyspacename + "'");
|
||||
logger.debug(() -> "setting keyspace stats for '" + statsKeyspacename + "'");
|
||||
ksdef.setStats(keyspaceStats);
|
||||
keyspaceStats.getKeyspaceTables().forEach((tbname, tbstats) -> {
|
||||
CqlTable table = ksdef.getTable(tbname);
|
||||
if (table != null) {
|
||||
table.setStats(tbstats);
|
||||
} else {
|
||||
logger.debug(" skipping table '" + statsKeyspacename + "." + tbname + ", since it was not found in the model.");
|
||||
logger.debug(() -> " skipping table '" + statsKeyspacename + "." + tbname + ", since it was not found in the model.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.debug(" skipping keyspace stats for '" + statsKeyspacename + "'");
|
||||
logger.debug(() -> " skipping keyspace stats for '" + statsKeyspacename + "'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ public class CqlModelBuilder extends CqlParserBaseListener {
|
||||
@Override
|
||||
public void exitEveryRule(ParserRuleContext ctx) {
|
||||
if ((counted++ & 0b11111111111111) == 0b10000000000000) {
|
||||
logger.trace("parsed " + counted + " elements...");
|
||||
logger.trace(() -> "parsed " + counted + " elements...");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CqlModelBuilder extends CqlParserBaseListener {
|
||||
ParseTree parent = node.getParent();
|
||||
String errorNodeType = parent.getClass().getSimpleName();
|
||||
|
||||
logger.info("PARSE ERROR: " + errorNodeType + "\n" + node.getSourceInterval());
|
||||
logger.info(() -> "PARSE ERROR: " + errorNodeType + "\n" + node.getSourceInterval());
|
||||
|
||||
super.visitErrorNode(node);
|
||||
}
|
||||
|
||||
@@ -42,9 +42,9 @@ public class CqlModelParser {
|
||||
public static CqlModel parse(Path path) {
|
||||
try {
|
||||
String ddl = Files.readString(path);
|
||||
logger.info("read " + ddl.length() + " character DDL file, parsing");
|
||||
logger.info(() -> "read " + ddl.length() + " character DDL file, parsing");
|
||||
CqlModel parsed = parse(ddl, null);
|
||||
logger.info("parsed cql model: " + parsed.getSummaryLine());
|
||||
logger.info(() -> "parsed cql model: " + parsed.getSummaryLine());
|
||||
return parsed;
|
||||
|
||||
} catch (IOException e) {
|
||||
@@ -85,7 +85,7 @@ public class CqlModelParser {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.warn("Error while parsing flow:" + e.getMessage());
|
||||
logger.warn(() -> "Error while parsing flow:" + e.getMessage());
|
||||
throw e;
|
||||
// return new ParseResult(e);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ public class CGGenStatsInjector implements CGModelTransformer, CGTransformerConf
|
||||
String histogramPath = config.get("path").toString();
|
||||
if (histogramPath != null) {
|
||||
if (!Files.exists(Path.of(histogramPath))) {
|
||||
logger.info("No tablestats file was found. at '" + histogramPath + "'.");
|
||||
logger.info(() -> "No tablestats file was found. at '" + histogramPath + "'.");
|
||||
Object onmissing = config.get("onmissing");
|
||||
if (onmissing==null || !String.valueOf(onmissing).toLowerCase(Locale.ROOT).equals("skip")) {
|
||||
logger.error("Unable to load tablestats file from '" + histogramPath + "' because it doesn't exists, and onmissing!=skip.");
|
||||
|
||||
@@ -61,10 +61,10 @@ public class CGKeyspaceFilter implements CGModelTransformer, CGTransformerConfig
|
||||
action = pattern.apply(keyspace);
|
||||
switch (action) {
|
||||
case add:
|
||||
logger.debug("including all definitions in " + keyspace + " with inclusion pattern " + pattern);
|
||||
logger.debug(() -> "including all definitions in " + keyspace + " with inclusion pattern " + pattern);
|
||||
break;
|
||||
case remove:
|
||||
logger.info("removing all definitions in " + keyspace + " with exclusion pattern " + pattern);
|
||||
logger.info(() -> "removing all definitions in " + keyspace + " with exclusion pattern " + pattern);
|
||||
model.removeKeyspaceDef(keyspace);
|
||||
case inderminate:
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class CGModelTransformers implements
|
||||
Object cfgvalues = cfgmap.get("config");
|
||||
if (cfgvalues !=null ) {
|
||||
configurable.accept((cfgvalues));
|
||||
logger.info("configured transformer with " + cfgvalues);
|
||||
logger.info(() -> "configured transformer with " + cfgvalues);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ public class CGRegexReplacer implements CGTextTransformer, CGTransformerConfigur
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(sb, replacement);
|
||||
// if (matcher.end() - matcher.start() > 10000) {
|
||||
// logger.info("whoops");
|
||||
// logger.info(()-> "whoops");
|
||||
// }
|
||||
// logger.info("matcher:[" + matcher.group(0) + "][" + matcher.group(1) + "][" + matcher.group(2) + "][" + matcher.group(3));
|
||||
// logger.info(String.format("\tat %2.2f%%", (float) ((float) matcher.start() / (float) s.length())));
|
||||
|
||||
@@ -52,7 +52,7 @@ public class CGUdtReplacer implements CGModelTransformer {
|
||||
String[] words = typedef.split("\\W+");
|
||||
for (String word : words) {
|
||||
if (word.toLowerCase(Locale.ROOT).equals(searchFor.toLowerCase(Locale.ROOT))) {
|
||||
logger.info("replacing '" + typedef + "' with blob");
|
||||
logger.info(() -> "replacing '" + typedef + "' with blob");
|
||||
coldef.setTypeDef("blob");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class UnusedTableRemover implements CGModelTransformer, CGTransformerConf
|
||||
String weightedOpsSpec = table.getTableAttributes().getAttribute("weighted_ops");
|
||||
double weightedOps = Double.parseDouble(weightedOpsSpec);
|
||||
if (weightedOps < minimumThreshold) {
|
||||
logger.info(String.format(
|
||||
logger.info(() -> String.format(
|
||||
"removing table " + table.getKeyspace().getName() + "." + table.getName() + " with minimum weighted_ops of %1.5f under %1.5f",
|
||||
weightedOps, minimumThreshold)
|
||||
);
|
||||
|
||||
@@ -72,7 +72,7 @@ public class NameCache {
|
||||
if (this.path.equals(path)) {
|
||||
logger.debug("mapfile unchanged '" + path + "'");
|
||||
} else {
|
||||
logger.info("mapfile changed from '" + this.path + "' to '" + path + "'");
|
||||
logger.info(() -> "mapfile changed from '" + this.path + "' to '" + path + "'");
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user