mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Skip inserts on counter tables, simplify multi-block tag predicates
This commit is contained in:
parent
fbd8947e7a
commit
e79b09ace7
@ -153,15 +153,15 @@ public class CGWorkloadExporter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Object txtr = cfgmap.get("text_transformers");
|
Object txtr = cfgmap.get("text_transformers");
|
||||||
if (txtr!=null) {
|
if (txtr != null) {
|
||||||
textTransformers.accept((List<Map<String,?>>) cfgmap.get("text_transformers"));
|
textTransformers.accept((List<Map<String, ?>>) cfgmap.get("text_transformers"));
|
||||||
}
|
}
|
||||||
|
|
||||||
String ddl;
|
String ddl;
|
||||||
try {
|
try {
|
||||||
ddl = Files.readString(srcpath);
|
ddl = Files.readString(srcpath);
|
||||||
logger.info("read " + ddl.length() + " character DDL file, parsing");
|
logger.info("read " + ddl.length() + " character DDL file, parsing");
|
||||||
if (textTransformers!=null) {
|
if (textTransformers != null) {
|
||||||
ddl = textTransformers.process(ddl);
|
ddl = textTransformers.process(ddl);
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -318,16 +318,16 @@ public class CGWorkloadExporter {
|
|||||||
|
|
||||||
put("default",
|
put("default",
|
||||||
new LinkedHashMap<>() {{
|
new LinkedHashMap<>() {{
|
||||||
put("schema", "run driver=cql tags=block:schema-.* threads===UNDEF cycles===UNDEF");
|
put("schema", "run driver=cql tags=block:schema.* threads===UNDEF cycles===UNDEF");
|
||||||
put("rampup", "run driver=cql tags=block:rampup-.* threads=auto cycles===TEMPLATE(rampup-cycles,10000)");
|
put("rampup", "run driver=cql tags=block:rampup.* threads=auto cycles===TEMPLATE(rampup-cycles,10000)");
|
||||||
put("main", "run driver=cql tags=block:main-.* threads=auto cycles===TEMPLATE(main-cycles,10000)");
|
put("main", "run driver=cql tags=block:main.* threads=auto cycles===TEMPLATE(main-cycles,10000)");
|
||||||
}});
|
}});
|
||||||
|
|
||||||
put("truncate", "run driver=cql tags=block:truncate-.* threads===UNDEF cycles===UNDEF");
|
put("truncate", "run driver=cql tags=block:truncate.* threads===UNDEF cycles===UNDEF");
|
||||||
put("schema-keyspaces", "run driver=cql tags=block:schema-keyspaces threads===UNDEF cycles===UNDEF");
|
put("schema-keyspaces", "run driver=cql tags=block:schema-keyspaces threads===UNDEF cycles===UNDEF");
|
||||||
put("schema-types", "run driver=cql tags=block:schema-types threads===UNDEF cycles===UNDEF");
|
put("schema-types", "run driver=cql tags=block:schema-types threads===UNDEF cycles===UNDEF");
|
||||||
put("schema-tables", "run driver=cql tags=block:schema-tables threads===UNDEF cycles===UNDEF");
|
put("schema-tables", "run driver=cql tags=block:schema-tables threads===UNDEF cycles===UNDEF");
|
||||||
put("drop", "run driver=cql tags=block:drop-.* threads===UNDEF cycles===UNDEF");
|
put("drop", "run driver=cql tags=block:drop.* threads===UNDEF cycles===UNDEF");
|
||||||
put("drop-tables", "run driver=cql tags=block:drop-tables threads===UNDEF cycles===UNDEF");
|
put("drop-tables", "run driver=cql tags=block:drop-tables threads===UNDEF cycles===UNDEF");
|
||||||
put("drop-types", "run driver=cql tags=block:drop-types threads===UNDEF cycles===UNDEF");
|
put("drop-types", "run driver=cql tags=block:drop-types threads===UNDEF cycles===UNDEF");
|
||||||
put("drop-keyspaces", "run driver=cql tags=block:drop-keyspaces threads===UNDEF cycles===UNDEF");
|
put("drop-keyspaces", "run driver=cql tags=block:drop-keyspaces threads===UNDEF cycles===UNDEF");
|
||||||
@ -403,14 +403,16 @@ public class CGWorkloadExporter {
|
|||||||
Map<String, Object> ops = new LinkedHashMap<>();
|
Map<String, Object> ops = new LinkedHashMap<>();
|
||||||
blockdata.put("ops", ops);
|
blockdata.put("ops", ops);
|
||||||
for (CqlTable table : model.getTableDefs()) {
|
for (CqlTable table : model.getTableDefs()) {
|
||||||
ops.put(
|
if (!isCounterTable(table)) {
|
||||||
namer.nameFor(table, "optype", "insert", "blockname", blockname),
|
ops.put(
|
||||||
Map.of(
|
namer.nameFor(table, "optype", "insert", "blockname", blockname),
|
||||||
"prepared", genInsertSyntax(table),
|
Map.of(
|
||||||
"timeout", timeouts.get("insert"),
|
"prepared", genInsertSyntax(table),
|
||||||
"ratio", writeRatioFor(table)
|
"timeout", timeouts.get("insert"),
|
||||||
)
|
"ratio", writeRatioFor(table)
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return blockdata;
|
return blockdata;
|
||||||
}
|
}
|
||||||
@ -447,18 +449,18 @@ public class CGWorkloadExporter {
|
|||||||
|
|
||||||
private Binding dividedBinding(CqlColumnDef columnDef, CqlTable tableDef) {
|
private Binding dividedBinding(CqlColumnDef columnDef, CqlTable tableDef) {
|
||||||
CGTableStats stats = tableDef.getTableAttributes();
|
CGTableStats stats = tableDef.getTableAttributes();
|
||||||
if (stats==null) {
|
if (stats == null) {
|
||||||
return bindings.forColumn(columnDef);
|
return bindings.forColumn(columnDef);
|
||||||
}
|
}
|
||||||
String partitionsSpec = stats.getAttribute("Number of partitions (estimate)");
|
String partitionsSpec = stats.getAttribute("Number of partitions (estimate)");
|
||||||
if (partitionsSpec==null) {
|
if (partitionsSpec == null) {
|
||||||
}
|
}
|
||||||
double estimatedPartitions = Double.parseDouble(partitionsSpec);
|
double estimatedPartitions = Double.parseDouble(partitionsSpec);
|
||||||
long modulo = (long)(estimatedPartitions*=partitionMultiplier);
|
long modulo = (long) (estimatedPartitions *= partitionMultiplier);
|
||||||
if (modulo==0) {
|
if (modulo == 0) {
|
||||||
return bindings.forColumn(columnDef);
|
return bindings.forColumn(columnDef);
|
||||||
}
|
}
|
||||||
modulo = quantizeModuloByMagnitude(modulo,1);
|
modulo = quantizeModuloByMagnitude(modulo, 1);
|
||||||
logger.debug("Set partition modulo for " + tableDef.getFullName() + " to " + modulo);
|
logger.debug("Set partition modulo for " + tableDef.getFullName() + " to " + modulo);
|
||||||
Binding binding = bindings.forColumn(columnDef, "Mod(" + modulo + "L); ");
|
Binding binding = bindings.forColumn(columnDef, "Mod(" + modulo + "L); ");
|
||||||
return binding;
|
return binding;
|
||||||
@ -467,12 +469,12 @@ public class CGWorkloadExporter {
|
|||||||
public static long quantizeModuloByMagnitude(long modulo, int significand) {
|
public static long quantizeModuloByMagnitude(long modulo, int significand) {
|
||||||
double initial = modulo;
|
double initial = modulo;
|
||||||
double log10 = Math.log10(initial);
|
double log10 = Math.log10(initial);
|
||||||
int zeroes = (int)log10;
|
int zeroes = (int) log10;
|
||||||
zeroes = Math.max(1,zeroes-(significand-1));
|
zeroes = Math.max(1, zeroes - (significand - 1));
|
||||||
long fractional = (long) Math.pow(10,zeroes);
|
long fractional = (long) Math.pow(10, zeroes);
|
||||||
long partial = ((long)initial/fractional) * fractional;
|
long partial = ((long) initial / fractional) * fractional;
|
||||||
long nextPartial = partial+fractional;
|
long nextPartial = partial + fractional;
|
||||||
if (Math.abs(initial-partial)<=Math.abs(initial-nextPartial)) {
|
if (Math.abs(initial - partial) <= Math.abs(initial - nextPartial)) {
|
||||||
return partial;
|
return partial;
|
||||||
} else {
|
} else {
|
||||||
return nextPartial;
|
return nextPartial;
|
||||||
|
Loading…
Reference in New Issue
Block a user