Commit 14c74c39 authored by Daniel Seybold's avatar Daniel Seybold

updated TPC-C for cockroachdb to the lastest version

parent e400e2c8
Pipeline #74056 passed with stage
in 21 minutes and 41 seconds
......@@ -52,10 +52,12 @@ ADD lib/ycsb_0.15/jdbc-binding/jdbc-binding-0.15.0.jar /opt/workloads/ycsb/jdbc-
###### CockroachDB loadgen for TPC-C ######
# downlaod cockroachdb loadgen
RUN mkdir /opt/workloads/cockroach-loadgen/
RUN cd /opt/workloads/cockroach-loadgen
RUN wget https://edge-binaries.cockroachdb.com/cockroach/workload.LATEST -O loadgen.sh
RUN chmod +x loadgen.sh
RUN mkdir /opt/workloads/cockroach/
RUN cd /opt/workloads/cockroach
RUN wget https://binaries.cockroachdb.com/cockroach-v19.2.4.linux-amd64.tgz
RUN tar fxvz cockroach-v19.2.4.linux-amd64.tgz
RUN mv cockroach-v19.2.4.linux-amd64 binary
RUN rm cockroach-v19.2.4.linux-amd64.tgz
###### TSBS by Timescale ######
......
......@@ -41,7 +41,7 @@ public class WorkloadApiServiceImpl extends WorkloadApiService {
//TPC-C constants
private final String TPCC_RESULT_FOLDER = "TPCC/";
private static final String TPCC_BINARY = "./loadgen.sh";
private static final String TPCC_BINARY = "./cockroach";
//TSBS constants
private final String TSBS_RESULT_FOLDER = "/tmp/"; // TODO CHANGE
......@@ -111,22 +111,71 @@ public class WorkloadApiServiceImpl extends WorkloadApiService {
Properties properties = WorkloadApiProperties.getInstance().getProperties();
String binariyDirectory =
properties.getProperty(WorkloadApiProperties.WORKLOAD_BINARIES_FOLDER) + "cockroach/binary";
String resultFileName =
properties.getProperty(WorkloadApiProperties.WORKLOAD_RESULTS_FOLDER) + TPCC_RESULT_FOLDER
+ taskId + ".txt";
//Init the workload
Long workloadTimestamp = System.currentTimeMillis();
LOGGER.debug("Creating TPC-C init command...");
String initCommand = TPCCCommandBuilder.buildInitCommand(workload.getDbEndpoints(),TPCC_BINARY);
initCommand += " &> " + resultFileName;
workloadProcess
.startWorkload(binariyDirectory, UNIX_SHELL, UNIX_COMMAND_PARAM, initCommand, taskId,
workloadTimestamp);
WorkloadProcessInstance workloadProcessInstance = new WorkloadProcessInstance();
workloadProcessInstance.setTimestamp(BigDecimal.valueOf(workloadProcess.getStartTimestamp()));
workloadProcessInstance.setProcessId(workloadProcess.getProcessId());
if (workloadProcess.isRunning()) {
LOGGER.debug("WorkloadPrcess started!");
workloadProcessInstance.setProcessStatus(ProcessStatus.RUNNING);
} else {
if (workloadProcess.getExitCode() != 0) {
LOGGER.debug("workloadPrcess exited with " + workloadProcess.getExitCode()
+ " Incorrect command provided? Command: " + initCommand);
workloadProcessInstance.setProcessStatus(ProcessStatus.ERROR);
return Response.ok().entity(workloadProcessInstance).build();
} else {
LOGGER.debug(
"workloadPrcess already finished, incorrect command provided? Command: " + initCommand);
workloadProcessInstance.setProcessStatus(ProcessStatus.IDLE);
return Response.ok().entity(workloadProcessInstance).build();
}
}
// wait until init process is finished
while (workloadProcess.isRunning()){
try {
LOGGER.debug("Waiting for TPC-C init to be finished, checking again in 5s...");
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
LOGGER.debug("TPC-C init finished, now starting the TPC-C execution!");
//Run the workload
workloadTimestamp = System.currentTimeMillis();
String startCommand = "";
startCommand = TPCCCommandBuilder.buildStartCommand(workload.getTpccWorkloadConfig(), workload.getDbEndpoints(), TPCC_BINARY);
startCommand += " &>> " + resultFileName;
String resultFileName =
properties.getProperty(WorkloadApiProperties.WORKLOAD_RESULTS_FOLDER) + TPCC_RESULT_FOLDER
+ taskId + ".txt";
startCommand += " &> " + resultFileName;
String binariyDirectory =
properties.getProperty(WorkloadApiProperties.WORKLOAD_BINARIES_FOLDER) + "cockroach-loadgen";
workloadProcess
.startWorkload(binariyDirectory, UNIX_SHELL, UNIX_COMMAND_PARAM, startCommand, taskId,
workloadTimestamp);
WorkloadProcessInstance workloadProcessInstance = new WorkloadProcessInstance();
workloadProcessInstance = new WorkloadProcessInstance();
workloadProcessInstance.setTimestamp(BigDecimal.valueOf(workloadProcess.getStartTimestamp()));
workloadProcessInstance.setProcessId(workloadProcess.getProcessId());
if (workloadProcess.isRunning()) {
......
......@@ -23,7 +23,7 @@ public class TPCCCommandBuilder {
checkNotNull(dbEndpoints);
checkNotNull(tpccBinary);
String startCommand = tpccBinary + " run tpcc ";
String startCommand = tpccBinary + " workload run tpcc ";
startCommand += buildWorklaodCommand(workload);
......@@ -32,6 +32,15 @@ public class TPCCCommandBuilder {
return startCommand;
}
public static String buildInitCommand(DBEndpoints dbEndpoints, String tpccBinary){
String initCommand = tpccBinary + " workload init tpcc ";
initCommand += buildConnectionUrl(dbEndpoints);
return initCommand;
}
private static String buildWorklaodCommand(TPCCWorkloadConfig workload){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment