mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
fix backing store bug on activity def cycles, remove too-early log init
This commit is contained in:
@@ -60,6 +60,6 @@ public class Sequence<T> implements OpSequence<T> {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return Arrays.toString(this.seq);
|
||||
return "seq len="+seq.length + ", LUT=" + Arrays.toString(this.seq);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -343,12 +343,15 @@ public class SimpleActivity extends NBBaseComponent implements Activity {
|
||||
getParams().setSilently("stride", stride);
|
||||
}
|
||||
|
||||
// CYCLES
|
||||
Optional<String> cyclesOpt = getParams().getOptionalString("cycles");
|
||||
if (cyclesOpt.isEmpty()) {
|
||||
String cycles = getParams().getOptionalString("stride").orElseThrow();
|
||||
logger.info(() -> "defaulting cycles to " + cycles + " (the stride length)");
|
||||
// getParams().set("cycles", getParams().getOptionalString("stride").orElseThrow());
|
||||
activityDef.setCycles(cycles);
|
||||
// getParams().setSilently("cycles", getParams().getOptionalString("stride").orElseThrow());
|
||||
this.getActivityDef().setCycles(getParams().getOptionalString("stride").orElseThrow());
|
||||
// getParams().set("cycles", getParams().getOptionalString("stride").orElseThrow());
|
||||
} else {
|
||||
if (0 == activityDef.getCycleCount()) {
|
||||
throw new RuntimeException(
|
||||
@@ -532,19 +535,19 @@ public class SimpleActivity extends NBBaseComponent implements Activity {
|
||||
List<OpTemplate> unfilteredOps = opsDocList.getOps();
|
||||
List<OpTemplate> filteredOps = opsDocList.getOps(tagfilter);
|
||||
|
||||
if (filteredOps.isEmpty()) {
|
||||
if (0 == filteredOps.size()) {
|
||||
// There were no ops, and it *wasn't* because they were all filtered out.
|
||||
// In this case, let's try to synthesize the ops as long as at least a default driver was provided
|
||||
// But if there were no ops, and there was no default driver provided, we can't continue
|
||||
// There were no ops, and it was because they were all filtered out
|
||||
if (!unfilteredOps.isEmpty()) {
|
||||
if (0 < unfilteredOps.size()) {
|
||||
throw new BasicError("There were no active op templates with tag filter '"
|
||||
+ tagfilter + "', since all " + unfilteredOps.size() + " were filtered out.");
|
||||
}
|
||||
if (defaultDriverAdapter.isPresent() && defaultDriverAdapter.get() instanceof SyntheticOpTemplateProvider sotp) {
|
||||
filteredOps = sotp.getSyntheticOpTemplates(opsDocList, this.activityDef.getParams());
|
||||
Objects.requireNonNull(filteredOps);
|
||||
if (filteredOps.isEmpty()) {
|
||||
if (0 == filteredOps.size()) {
|
||||
throw new BasicError("Attempted to create synthetic ops from driver '" + defaultDriverAdapter.get().getAdapterName() + '\'' +
|
||||
" but no ops were created. You must provide either a workload or an op parameter. Activities require op templates.");
|
||||
}
|
||||
|
||||
@@ -118,11 +118,15 @@ public class AtomicInput extends NBBaseComponent implements Input, ActivityDefOb
|
||||
|
||||
cycles_max.set(cyclesSpec.last_exclusive());
|
||||
if (cycles_min.get() != cyclesSpec.first_inclusive()) {
|
||||
logger.info(() -> "resetting cycle value to new start: cycle[" + cycles_min.get() + "->" + cyclesSpec.first_inclusive() + "] " +
|
||||
logger.info(() -> "resetting first cycle (inclusive) value to: cycle[" + cycles_min.get() + "->" + cyclesSpec.first_inclusive() + "] " +
|
||||
" start[" + cycle_value.get() + "->" + cycles_min.get() + "]");
|
||||
cycles_min.set(cyclesSpec.first_inclusive());
|
||||
cycle_value.set(cycles_min.get());
|
||||
}
|
||||
if (cycles_max.get() != cyclesSpec.last_exclusive()) {
|
||||
logger.info(() -> "resetting last cycle (exclusive) value to: cycle[" + cycles_max.get() + "->" + cyclesSpec.last_exclusive() + "]");
|
||||
cycles_max.set(cyclesSpec.last_exclusive());
|
||||
}
|
||||
|
||||
recycles_max.set(recyclesSpec.last_exclusive());
|
||||
if (recycles_min.get() != recyclesSpec.first_inclusive()) {
|
||||
@@ -131,6 +135,11 @@ public class AtomicInput extends NBBaseComponent implements Input, ActivityDefOb
|
||||
recycles_min.set(recyclesSpec.first_inclusive());
|
||||
recycle_value.set(recyclesSpec.first_inclusive());
|
||||
}
|
||||
if (recycles_max.get() != recyclesSpec.last_exclusive()) {
|
||||
logger.info(() -> "resetting last recycle (exclusive) value to: recycle[" + recycles_max.get() + "->" + recyclesSpec.last_exclusive() + "]");
|
||||
recycles_max.set(recyclesSpec.last_exclusive());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public long getStartedAtMillis() {
|
||||
|
||||
@@ -66,6 +66,13 @@ public class AtomicInputTest {
|
||||
assertThat(segment).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testThatOneCycleAndOneRecycleYieldsOneTotal() {
|
||||
AtomicInput input = new AtomicInput(root, ActivityDef.parseActivityDef("alias=foo;cycles=1;recycles=1"));
|
||||
CycleSegment segment = input.getInputSegment(1);
|
||||
assertThat(segment).isNotNull();
|
||||
assertThat(segment.nextCycle()).isEqualTo(0L);
|
||||
}
|
||||
@Test
|
||||
public void testThatCycleAndRecycleOffsetsWork() {
|
||||
AtomicInput input = new AtomicInput(root, ActivityDef.parseActivityDef("alias=foo;cycles=310..330;recycles=37..39"));
|
||||
|
||||
@@ -181,6 +181,9 @@ public class ParameterMap extends ConcurrentHashMap<String, Object> implements B
|
||||
|
||||
|
||||
public void set(String paramName, Object newValue) {
|
||||
if (paramName.equals("cycles")) {
|
||||
logger.warn("Setting 'cycles' on the parameter map is likely causing a bug in your activity. Call setCycles on the def instead.");
|
||||
}
|
||||
super.put(paramName, String.valueOf(newValue));
|
||||
logger.info(() -> "setting param " + paramName + "=" + newValue);
|
||||
markMutation();
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.regex.Pattern;
|
||||
|
||||
public class MapLabels implements NBLabels {
|
||||
|
||||
private final static Logger logger = LogManager.getLogger(MapLabels.class);
|
||||
// private final static Logger logger = LogManager.getLogger(MapLabels.class);
|
||||
private final Map<String,String> labels;
|
||||
|
||||
public MapLabels(final Map<String, String> labels) {
|
||||
@@ -147,9 +147,9 @@ public class MapLabels implements NBLabels {
|
||||
sanitized = sanitized.replaceAll("-", "_");
|
||||
sanitized = sanitized.replaceAll("[^a-zA-Z0-9_]+", "");
|
||||
|
||||
if (!word.equals(sanitized)) {
|
||||
logger.warn("The identifier or value '" + word + "' was sanitized to '" + sanitized + "' to be compatible with monitoring systems. You should probably change this to make diagnostics easier.");
|
||||
}
|
||||
// if (!word.equals(sanitized)) {
|
||||
// logger.warn("The identifier or value '" + word + "' was sanitized to '" + sanitized + "' to be compatible with monitoring systems. You should probably change this to make diagnostics easier.");
|
||||
// }
|
||||
return sanitized;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user