mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
Merge branch 'main' of github.com:nosqlbench/nosqlbench
This commit is contained in:
@@ -53,7 +53,7 @@ public class RunStateImage {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isNonOther(RunState... runStates) {
|
public boolean isNoneOther(RunState... runStates) {
|
||||||
int[] scan = Arrays.copyOf(counts, counts.length);
|
int[] scan = Arrays.copyOf(counts, counts.length);
|
||||||
for (RunState runState : runStates) {
|
for (RunState runState : runStates) {
|
||||||
scan[runState.ordinal()]=0;
|
scan[runState.ordinal()]=0;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public class RunStateImageTest {
|
|||||||
assertThat(image.is(RunState.Starting)).isTrue();
|
assertThat(image.is(RunState.Starting)).isTrue();
|
||||||
assertThat(image.isTimeout()).isFalse();
|
assertThat(image.isTimeout()).isFalse();
|
||||||
assertThat(image.is(RunState.Errored)).isFalse();
|
assertThat(image.is(RunState.Errored)).isFalse();
|
||||||
assertThat(image.isNonOther(RunState.Starting, RunState.Running)).isTrue();
|
assertThat(image.isNoneOther(RunState.Starting, RunState.Running)).isTrue();
|
||||||
RunState maxState = image.getMaxState();
|
RunState maxState = image.getMaxState();
|
||||||
assertThat(maxState).isEqualTo(RunState.values()[RunState.Running.ordinal()]);
|
assertThat(maxState).isEqualTo(RunState.values()[RunState.Running.ordinal()]);
|
||||||
RunState minState = image.getMinState();
|
RunState minState = image.getMinState();
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void alignMotorStateToIntendedActivityState() {
|
private synchronized void alignMotorStateToIntendedActivityState() {
|
||||||
RunState intended = activity.getRunState();
|
RunState intended = activity.getRunState();
|
||||||
logger.trace(() -> "ADJUSTING to INTENDED " + intended);
|
logger.trace(() -> "ADJUSTING to INTENDED " + intended);
|
||||||
switch (intended) {
|
switch (intended) {
|
||||||
|
|||||||
@@ -45,44 +45,48 @@ import static org.assertj.core.api.Assertions.fail;
|
|||||||
class ActivityExecutorTest {
|
class ActivityExecutorTest {
|
||||||
private static final Logger logger = LogManager.getLogger(ActivityExecutorTest.class);
|
private static final Logger logger = LogManager.getLogger(ActivityExecutorTest.class);
|
||||||
|
|
||||||
@Test
|
// TODO: Design review of this mechanism
|
||||||
synchronized void testRestart() {
|
// @Test
|
||||||
ActivityDef activityDef = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;op=initdelay:initdelay=5000;");
|
// synchronized void testRestart() {
|
||||||
new ActivityTypeLoader().load(activityDef);
|
// ActivityDef activityDef = ActivityDef.parseActivityDef("driver=diag;alias=test-restart;cycles=1000;cyclerate=10;op=initdelay:initdelay=5000;");
|
||||||
|
// new ActivityTypeLoader().load(activityDef);
|
||||||
final Activity activity = new DelayedInitActivity(activityDef);
|
//
|
||||||
InputDispenser inputDispenser = new CoreInputDispenser(activity);
|
// final Activity activity = new DelayedInitActivity(activityDef);
|
||||||
ActionDispenser adisp = new CoreActionDispenser(activity);
|
// InputDispenser inputDispenser = new CoreInputDispenser(activity);
|
||||||
OutputDispenser tdisp = CoreServices.getOutputDispenser(activity).orElse(null);
|
// ActionDispenser adisp = new CoreActionDispenser(activity);
|
||||||
|
// OutputDispenser tdisp = CoreServices.getOutputDispenser(activity).orElse(null);
|
||||||
final MotorDispenser<?> mdisp = new CoreMotorDispenser(activity, inputDispenser, adisp, tdisp);
|
//
|
||||||
activity.setActionDispenserDelegate(adisp);
|
// final MotorDispenser<?> mdisp = new CoreMotorDispenser(activity, inputDispenser, adisp, tdisp);
|
||||||
activity.setOutputDispenserDelegate(tdisp);
|
// activity.setActionDispenserDelegate(adisp);
|
||||||
activity.setInputDispenserDelegate(inputDispenser);
|
// activity.setOutputDispenserDelegate(tdisp);
|
||||||
activity.setMotorDispenserDelegate(mdisp);
|
// activity.setInputDispenserDelegate(inputDispenser);
|
||||||
|
// activity.setMotorDispenserDelegate(mdisp);
|
||||||
final ExecutorService executor = Executors.newCachedThreadPool();
|
//
|
||||||
ActivityExecutor activityExecutor = new ActivityExecutor(activity, "test-restart");
|
// final ExecutorService executor = Executors.newCachedThreadPool();
|
||||||
final Future<ExecutionResult> future = executor.submit(activityExecutor);
|
// ActivityExecutor activityExecutor = new ActivityExecutor(activity, "test-restart");
|
||||||
try {
|
// final Future<ExecutionResult> future = executor.submit(activityExecutor);
|
||||||
activityDef.setThreads(1);
|
// try {
|
||||||
activityExecutor.startActivity();
|
// activityDef.setThreads(1);
|
||||||
activityExecutor.stopActivity();
|
// activityExecutor.startActivity();
|
||||||
activityExecutor.startActivity();
|
// Thread.sleep(100L);
|
||||||
activityExecutor.stopActivity();
|
// activityExecutor.stopActivity();
|
||||||
future.get();
|
// Thread.sleep(100L);
|
||||||
} catch (Exception e) {
|
// activityExecutor.startActivity();
|
||||||
throw new RuntimeException(e);
|
// Thread.sleep(100L);
|
||||||
}
|
// activityExecutor.stopActivity();
|
||||||
executor.shutdown();
|
// future.get();
|
||||||
assertThat(inputDispenser.getInput(10).getInputSegment(3)).isNotNull();
|
// } catch (Exception e) {
|
||||||
|
// throw new RuntimeException(e);
|
||||||
}
|
// }
|
||||||
|
// executor.shutdown();
|
||||||
|
// assertThat(inputDispenser.getInput(10).getInputSegment(3)).isNotNull();
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
synchronized void testDelayedStartSanity() {
|
synchronized void testDelayedStartSanity() {
|
||||||
|
|
||||||
final ActivityDef activityDef = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;initdelay=2000;");
|
final ActivityDef activityDef = ActivityDef.parseActivityDef("driver=diag;alias=test-delayed-start;cycles=1000;initdelay=2000;");
|
||||||
new ActivityTypeLoader().load(activityDef);
|
new ActivityTypeLoader().load(activityDef);
|
||||||
|
|
||||||
final Activity activity = new DelayedInitActivity(activityDef);
|
final Activity activity = new DelayedInitActivity(activityDef);
|
||||||
@@ -118,7 +122,7 @@ class ActivityExecutorTest {
|
|||||||
@Test
|
@Test
|
||||||
synchronized void testNewActivityExecutor() {
|
synchronized void testNewActivityExecutor() {
|
||||||
|
|
||||||
ActivityDef activityDef = ActivityDef.parseActivityDef("driver=diag;alias=test;cycles=1000;initdelay=5000;");
|
ActivityDef activityDef = ActivityDef.parseActivityDef("driver=diag;alias=test-dynamic-params;cycles=1000;initdelay=5000;");
|
||||||
new ActivityTypeLoader().load(activityDef);
|
new ActivityTypeLoader().load(activityDef);
|
||||||
|
|
||||||
getActivityMotorFactory(motorActionDelay(999), new AtomicInput(activityDef));
|
getActivityMotorFactory(motorActionDelay(999), new AtomicInput(activityDef));
|
||||||
|
|||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2022 nosqlbench
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package io.nosqlbench.engine.core.experimental;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.CompletionStage;
|
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
|
|
||||||
public class CompletableTests {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testCompletionStages() {
|
|
||||||
CompletableFuture<Object> f = new CompletableFuture<>();
|
|
||||||
ExecutorService executorService = Executors.newCachedThreadPool();
|
|
||||||
CompletableFuture<Object> objectCompletableFuture = f.completeAsync(() -> "foo", executorService);
|
|
||||||
boolean bar = objectCompletableFuture.complete("bar");
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
28
scripts/.delete-tags
Executable file
28
scripts/.delete-tags
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
printf "WARNING:\n"
|
||||||
|
printf " This will remove any tags which were known to be stale as of 5.17.0\n"
|
||||||
|
printf " Only these will be kept:\n"
|
||||||
|
printf " - 5.*\n"
|
||||||
|
printf " - nb-5.*\n"
|
||||||
|
printf " - nosqlbench-5.*\n"
|
||||||
|
printf " - nosqlbench-4.17.20+\n"
|
||||||
|
printf " - nosqlbench-4.15.100+\n"
|
||||||
|
printf " FURTHER: This removes all your local tags first and then synchronizes\n"
|
||||||
|
printf " from origin. If you have any special tags only on local, it will remove them.\n"
|
||||||
|
printf " If you do NOT want to do this, hit control-c now!\n"
|
||||||
|
read response
|
||||||
|
|
||||||
|
#delete all the remote tags with the pattern your looking for ...
|
||||||
|
git tag \
|
||||||
|
| grep -v '5\.' \
|
||||||
|
| grep -v 'nosqlbench-5\.' \
|
||||||
|
| grep -v 'nb-5\.' \
|
||||||
|
| grep -v 'nosqlbench-4\.17\.[23][0-9]' \
|
||||||
|
| grep -v 'nosqlbench-4\.15\.10[0-9]' \
|
||||||
|
| xargs -n 1 -I% git push origin :refs/tags/%
|
||||||
|
|
||||||
|
# delete all your local tags
|
||||||
|
git tag | xargs -I% git tag -d %
|
||||||
|
|
||||||
|
# fetch the remote tags which still remain
|
||||||
|
git fetch
|
||||||
Reference in New Issue
Block a user