From 993c89ec1fc2ae423118b5bb640b873b77bb4521 Mon Sep 17 00:00:00 2001 From: Rakshit Jain Date: Thu, 10 Nov 2022 14:32:36 +0530 Subject: [PATCH 1/6] minor --- .../featurebench/FeatureBenchWorker.java | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java index b7d835f59..7ef53c818 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java @@ -68,7 +68,7 @@ protected void initialize() { FileUtil.makeDirIfNotExists(outputDirectory); String explainDir = "ResultsForExplain"; FileUtil.makeDirIfNotExists(outputDirectory + "/" + explainDir); - String fileForExplain = explainDir + "/" + workloadName+"_"+ TimeUtil.getCurrentTimeString() + ".json"; + String fileForExplain = explainDir + "/" + workloadName + "_" + TimeUtil.getCurrentTimeString() + ".json"; PrintStream ps; String explain = "explain (analyze,verbose,costs,buffers) "; @@ -82,22 +82,24 @@ protected void initialize() { for (ExecuteRule er : executeRules) { for (Query query : er.getQueries()) { - String querystmt = query.getQuery(); - PreparedStatement stmt = null; - try { - stmt = conn.prepareStatement(explain + querystmt); - List baseUtils = query.getBaseUtils(); - for (int j = 0; j < baseUtils.size(); j++) { - try { - stmt.setObject(j + 1, baseUtils.get(j).get()); - } catch (SQLException | InvocationTargetException | IllegalAccessException | - ClassNotFoundException | NoSuchMethodException | InstantiationException e) { - throw new RuntimeException(e); + if (query.isSelectQuery() || query.isUpdateQuery()) { + String querystmt = query.getQuery(); + PreparedStatement stmt = null; + try { + stmt = conn.prepareStatement(explain + querystmt); + List baseUtils = query.getBaseUtils(); + for (int j = 0; j < baseUtils.size(); j++) { + try { + stmt.setObject(j + 1, baseUtils.get(j).get()); + } catch (SQLException | InvocationTargetException | IllegalAccessException | + ClassNotFoundException | NoSuchMethodException | InstantiationException e) { + throw new RuntimeException(e); + } } + explainDDLs.add(stmt); + } catch (SQLException e) { + throw new RuntimeException(e); } - explainDDLs.add(stmt); - } catch (SQLException e) { - throw new RuntimeException(e); } } @@ -132,7 +134,7 @@ public void writeExplain(PrintStream os, List explainDDLs) th } long explainEnd = System.currentTimeMillis(); jsonObject.put("ResultSet", data.toString()); - jsonObject.put("Time(ms) ",explainEnd-explainStart); + jsonObject.put("Time(ms) ", explainEnd - explainStart); summaryMap.put("ExplainDDL" + count, jsonObject); } os.println(JSONUtil.format(JSONUtil.toJSONString(summaryMap))); From dab1451ae46a9d13240b2cc244831fa21e097cbd Mon Sep 17 00:00:00 2001 From: Rakshit Jain Date: Thu, 10 Nov 2022 14:50:46 +0530 Subject: [PATCH 2/6] multi threading --- .../featurebench/FeatureBenchBenchmark.java | 70 ++++++++++--------- .../featurebench/FeatureBenchWorker.java | 2 +- .../featurebench/helpers/UtilToMethod.java | 20 ++++++ .../featurebench/utils/ArrayOfDates.java | 11 +++ .../benchmarks/featurebench/utils/Bounds.java | 8 +++ .../featurebench/utils/CurrentTime.java | 6 ++ .../featurebench/utils/CurrentTimeString.java | 7 ++ .../utils/CurrentTimeString14.java | 7 ++ .../utils/GenerateRandomString.java | 18 ++++- .../utils/OneNumberFromArray.java | 10 +++ .../utils/OneStringFromArray.java | 10 +++ .../featurebench/utils/PrimaryIntGen.java | 19 ++++- .../featurebench/utils/PrimaryStringGen.java | 17 ++++- .../featurebench/utils/RandDate.java | 8 +++ .../featurebench/utils/RandomAString.java | 11 +++ .../featurebench/utils/RandomBoolean.java | 7 ++ .../featurebench/utils/RandomDate.java | 15 +++- .../utils/RandomDateBtwYears.java | 12 ++++ .../featurebench/utils/RandomExpoFloat.java | 11 +++ .../featurebench/utils/RandomExpoInt.java | 11 +++ .../featurebench/utils/RandomExpoLong.java | 11 +++ .../featurebench/utils/RandomFixedPoint.java | 14 ++++ .../featurebench/utils/RandomInt.java | 12 ++++ .../featurebench/utils/RandomJson.java | 11 +++ .../featurebench/utils/RandomLong.java | 11 +++ .../utils/RandomNoWithDecimalPoints.java | 13 ++++ .../featurebench/utils/RandomNormalFloat.java | 11 +++ .../featurebench/utils/RandomNormalInt.java | 11 +++ .../featurebench/utils/RandomNormalLong.java | 11 +++ .../featurebench/utils/RandomNstring.java | 12 ++++ .../featurebench/utils/RandomNumber.java | 8 +++ .../utils/RandomNumberDefault.java | 11 ++- .../featurebench/utils/RandomString.java | 14 ++++ .../utils/RandomStringAlphabets.java | 9 +++ .../utils/RandomStringNumeric.java | 10 +++ .../utils/RandomStringTextArrayGen.java | 17 +++++ .../featurebench/utils/RandomUUID.java | 7 ++ .../utils/RowRandomBoundedInt.java | 12 ++++ .../utils/RowRandomBoundedLong.java | 11 +++ 39 files changed, 456 insertions(+), 40 deletions(-) diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchBenchmark.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchBenchmark.java index efb00e8d6..c21c0f09b 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchBenchmark.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchBenchmark.java @@ -52,10 +52,41 @@ protected List> makeWorkersImpl(int workcount) List> workers = new ArrayList<>(); HierarchicalConfiguration conf = workConf.getXmlConfig().configurationAt("microbenchmark"); - - List executeRules = new ArrayList<>(); List> confExecuteRules = conf.configurationsAt("properties/executeRules[" + workcount + "]/run"); String workloadName = conf.getString("properties/executeRules[" + workcount + "]/workload") != null ? conf.getString("properties/executeRules[" + workcount + "]/workload") : TimeUtil.getCurrentTimeString(); + + for (int i = 0; i < workConf.getTerminals(); ++i) { + FeatureBenchWorker worker = new FeatureBenchWorker(this, i); + worker.workloadClass = conf.getString("class"); + worker.config = conf.configurationAt("properties"); + worker.executeRules = configToExecuteRues(confExecuteRules, i, workConf.getTerminals()); + worker.workloadName = workloadName; + workers.add(worker); + } + return workers; + } + + @Override + protected List> makeWorkersImpl() throws IOException { + return null; + } + + @Override + protected Loader makeLoaderImpl() { + HierarchicalConfiguration conf = workConf.getXmlConfig().configurationAt("microbenchmark"); + FeatureBenchLoader loader = new FeatureBenchLoader(this); + loader.workloadClass = conf.getString("class"); + loader.config = conf.configurationAt("properties"); + return loader; + } + + @Override + protected Package getProcedurePackageImpl() { + return FeatureBench.class.getPackage(); + } + + private List configToExecuteRues(List> confExecuteRules, int workerId, int totalWorker) { + List executeRules = new ArrayList<>(); for (HierarchicalConfiguration confExecuteRule : confExecuteRules) { if (!confExecuteRule.containsKey("name")) { @@ -84,11 +115,11 @@ protected List> makeWorkersImpl(int workcount) if (bindingsList.containsKey("count")) { int count = bindingsList.getInt("count"); for (int i = 0; i < count; i++) { - UtilToMethod obj = new UtilToMethod(bindingsList.getString("util"), bindingsList.getList("params")); + UtilToMethod obj = new UtilToMethod(bindingsList.getString("util"), bindingsList.getList("params"),workerId,totalWorker); baseutils.add(obj); } } else { - UtilToMethod obj = new UtilToMethod(bindingsList.getString("util"), bindingsList.getList("params")); + UtilToMethod obj = new UtilToMethod(bindingsList.getString("util"), bindingsList.getList("params"),workerId,totalWorker); baseutils.add(obj); } } @@ -98,36 +129,7 @@ protected List> makeWorkersImpl(int workcount) rule.setQueries(queries); executeRules.add(rule); } - - - for (int i = 0; i < workConf.getTerminals(); ++i) { - FeatureBenchWorker worker = new FeatureBenchWorker(this, i); - worker.workloadClass = conf.getString("class"); - worker.config = conf.configurationAt("properties"); - worker.executeRules = executeRules; - worker.workloadName = workloadName; - workers.add(worker); - } - return workers; - } - - @Override - protected List> makeWorkersImpl() throws IOException { - return null; - } - - @Override - protected Loader makeLoaderImpl() { - HierarchicalConfiguration conf = workConf.getXmlConfig().configurationAt("microbenchmark"); - FeatureBenchLoader loader = new FeatureBenchLoader(this); - loader.workloadClass = conf.getString("class"); - loader.config = conf.configurationAt("properties"); - return loader; - } - - @Override - protected Package getProcedurePackageImpl() { - return FeatureBench.class.getPackage(); + return executeRules; } } \ No newline at end of file diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java index 7ef53c818..c2c41f90d 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchWorker.java @@ -107,7 +107,7 @@ protected void initialize() { try { writeExplain(ps, explainDDLs); } catch (SQLException e) { - throw new RuntimeException(e); + e.printStackTrace(); } } diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/helpers/UtilToMethod.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/helpers/UtilToMethod.java index 0b79f02b5..e4fb4eafe 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/helpers/UtilToMethod.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/helpers/UtilToMethod.java @@ -12,6 +12,26 @@ public class UtilToMethod { public Method run; public BaseUtil clsInstance; + public UtilToMethod(Object util, Object params, int workerId, int totalWorkers) { + String className = "com.oltpbenchmark.benchmarks.featurebench.utils." + util; + try { + Class cls = Class.forName(className); + if (params == null) { + params = new ArrayList<>(List.of()); + } + this.clsInstance = (BaseUtil) cls.getDeclaredConstructor( + List.class, int.class, int.class).newInstance((List) params, workerId, totalWorkers); + } catch (ClassNotFoundException | NoSuchMethodException e) { + e.printStackTrace(); + throw new RuntimeException(String.format("Oops! Are you sure that " + + "you provided the right utility function name: %s ? ", util)); + } catch (InvocationTargetException | InstantiationException | + IllegalAccessException e) { + e.printStackTrace(); + throw new RuntimeException(); + } + } + public UtilToMethod(Object util, Object params) { String className = "com.oltpbenchmark.benchmarks.featurebench.utils." + util; try { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/ArrayOfDates.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/ArrayOfDates.java index 8b476ffcf..9bf8a9a38 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/ArrayOfDates.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/ArrayOfDates.java @@ -21,6 +21,17 @@ public ArrayOfDates(List values) { throw new RuntimeException("Incorrect value for parameter " + this.getClass()); } + } + public ArrayOfDates(List values,int workerId,int totalWorkers) { + if (values.size() != 1) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.arraySize = ((Number) values.get(0)).intValue(); + if (arraySize <= 0) { + throw new RuntimeException("Incorrect value for parameter " + this.getClass()); + } + } @Override diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/Bounds.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/Bounds.java index 89228abbe..e3b854c3a 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/Bounds.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/Bounds.java @@ -30,6 +30,14 @@ public Bounds(List values) { this.currentValue = ((Number) values.get(0)).longValue(); this.levelsPerMagnitude = ((Number) values.get(1)).intValue(); } + public Bounds(List values,int workerId,int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.currentValue = ((Number) values.get(0)).longValue(); + this.levelsPerMagnitude = ((Number) values.get(1)).intValue(); + } @Override public Object run() { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTime.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTime.java index f7d5d0a5e..5372c8123 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTime.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTime.java @@ -20,6 +20,12 @@ public CurrentTime(List values) { + this.getClass()); } } + public CurrentTime(List values,int workerId, int totalWorkers) { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + } public Object run() { return new Timestamp(System.currentTimeMillis()); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString.java index 24f63f350..8b16dddb6 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString.java @@ -21,6 +21,13 @@ public CurrentTimeString(List values) { } DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); } + public CurrentTimeString(List values,int workerId, int totalWorkers) { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss"); + } public Object run() { return CurrentTimeString.DATE_FORMAT.format(new java.util.Date()); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString14.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString14.java index 6844b5b00..61709ac0f 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString14.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/CurrentTimeString14.java @@ -21,6 +21,13 @@ public CurrentTimeString14(List values) { } DATE_FORMAT_14 = new SimpleDateFormat("yyyyMMddHHmmss"); } + public CurrentTimeString14(List values,int workerId, int totalWorkers) { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + DATE_FORMAT_14 = new SimpleDateFormat("yyyyMMddHHmmss"); + } public Object run() { return CurrentTimeString14.DATE_FORMAT_14.format(new java.util.Date()); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/GenerateRandomString.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/GenerateRandomString.java index 2f5ca5dce..d795d4818 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/GenerateRandomString.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/GenerateRandomString.java @@ -23,7 +23,23 @@ public class GenerateRandomString implements BaseUtil { private ArrayList RandomStringGen; - GenerateRandomString(List values) { + + public GenerateRandomString(List values) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters " + + "for util function " + this.getClass()); + } + this.desiredLength = ((Number) values.get(0)).intValue(); + this.sizeOfStringArray = ((Number) values.get(1)).intValue(); + if (desiredLength < 0 || sizeOfStringArray <= 0) { + throw new RuntimeException("Please enter valid desired Length " + + "and size of string array for random picking"); + } + RandomStringGen = new ArrayList(); + this.generateList(); + } + + public GenerateRandomString(List values, int workerId, int totalWorkers) { if (values.size() != 2) { throw new RuntimeException("Incorrect number of parameters " + "for util function " + this.getClass()); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneNumberFromArray.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneNumberFromArray.java index d08beb15d..6d3de6841 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneNumberFromArray.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneNumberFromArray.java @@ -18,6 +18,16 @@ public OneNumberFromArray(List values) { listOfIntegers.add((Integer) value); } } + public OneNumberFromArray(List values,int workerId,int totalWorkers) { + if (values.size() == 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + listOfIntegers = new ArrayList<>(); + for (Object value : values) { + listOfIntegers.add((Integer) value); + } + } public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneStringFromArray.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneStringFromArray.java index f088260ba..a8a300262 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneStringFromArray.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/OneStringFromArray.java @@ -26,6 +26,16 @@ public OneStringFromArray(List values) { str.add((String) value); } } + public OneStringFromArray(List values,int workerId,int totalWorkers) { + if (values.size() == 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + str = new ArrayList<>(); + for (Object value : values) { + str.add((String) value); + } + } public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java index 5372320a4..33c32e375 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java @@ -16,9 +16,9 @@ Return type (Integer) :- Any value between 10 and 20 including these bounds. */ public class PrimaryIntGen implements BaseUtil { - private int currentValue; private final int upperRange; private final int lowerRange; + private int currentValue; public PrimaryIntGen(List values) { if (values.size() != 2) { @@ -33,6 +33,23 @@ public PrimaryIntGen(List values) { } } + public PrimaryIntGen(List values, int workerId, int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + int divide = (((Number) values.get(1)).intValue() - ((Number) values.get(0)).intValue()) / totalWorkers; + this.currentValue = ((Number) values.get(0)).intValue() - 1 + divide * workerId; + int upperRangeTemp = (((Number) values.get(0)).intValue() + (divide) * (workerId + 1) + (workerId == 0 ? 0 : 1)); + this.upperRange = Math.min(upperRangeTemp, ((Number) values.get(1)).intValue()); + this.lowerRange = ((Number) values.get(0)).intValue() + divide * (workerId) + (workerId == 0 ? 0 : 1); + System.out.println(this.lowerRange + " " + this.upperRange); + if (upperRange < lowerRange) { + throw new RuntimeException("Upper bound less than lower bound"); + } + + } + private int findNextHigherValue() { currentValue++; return currentValue; diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryStringGen.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryStringGen.java index 727f86224..f1899c546 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryStringGen.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryStringGen.java @@ -15,9 +15,9 @@ */ public class PrimaryStringGen implements BaseUtil { - private int currentValue; private final int desiredLength; private final int startNumber; + private int currentValue; private String key; public PrimaryStringGen(List values) { @@ -33,6 +33,21 @@ public PrimaryStringGen(List values) { } } + public PrimaryStringGen(List values, int workerId, int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + int divide = (((Number) values.get(1)).intValue() - ((Number) values.get(0)).intValue()) / totalWorkers; + this.startNumber = ((Number) values.get(0)).intValue() - 1 + divide * workerId; + this.currentValue = startNumber - 1; + int upperRangeTemp = (((Number) values.get(0)).intValue() + (divide) * (workerId + 1) + (workerId == 0 ? 0 : 1)); + this.desiredLength = Math.min(upperRangeTemp, ((Number) values.get(1)).intValue()); + if (desiredLength <= 0) { + throw new RuntimeException("Please use positive desired length for string primary keys"); + } + } + public String numberToIdString(long number) { StringBuilder baseNumberStr = new StringBuilder(String.valueOf(currentValue)); while (baseNumberStr.length() < desiredLength) { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandDate.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandDate.java index 6a43b48e1..9bc8faaf9 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandDate.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandDate.java @@ -17,6 +17,14 @@ public RandDate(List values) } } + public RandDate(List values,int workerId,int totalWorkers) + { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + + } + } @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomAString.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomAString.java index 8d6fcbda7..5846d4454 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomAString.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomAString.java @@ -28,6 +28,17 @@ public RandomAString(List values) { if (minimumLength > maximumLength || minimumLength == 0 && maximumLength == 0 || minimumLength < 0) throw new RuntimeException("Please enter correct bounds for max and min length"); } + public RandomAString(List values,int workerId,int totalWorkers) { + super((int) System.nanoTime()); + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.minimumLength = ((Number) values.get(0)).intValue(); + this.maximumLength = ((Number) values.get(1)).intValue(); + if (minimumLength > maximumLength || minimumLength == 0 && maximumLength == 0 || minimumLength < 0) + throw new RuntimeException("Please enter correct bounds for max and min length"); + } /** * @returns a random alphabetic string with length in range [minimum_length, diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomBoolean.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomBoolean.java index 1493dd861..4ba0dc3e5 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomBoolean.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomBoolean.java @@ -18,6 +18,13 @@ public RandomBoolean(List values) { } Random rd = new Random(); } + public RandomBoolean(List values,int workerId,int totalWorkers) { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + Random rd = new Random(); + } @Override public Object run() { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDate.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDate.java index 0a92c78b2..9f041e3a7 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDate.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDate.java @@ -15,9 +15,9 @@ Return type : (String):- 24-4-2014 */ public class RandomDate implements BaseUtil { - private Random rd; private final int yearlowerBound; private final int yearupperBound; + private Random rd; public RandomDate(List values) { @@ -33,6 +33,19 @@ public RandomDate(List values) { } + public RandomDate(List values, int workerId, int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + Random rnd = new Random(); + this.yearlowerBound = ((Number) values.get(0)).intValue(); + this.yearupperBound = ((Number) values.get(1)).intValue(); + if (yearlowerBound > yearupperBound || yearlowerBound == 0 && yearupperBound == 0 || yearlowerBound < 0) + throw new RuntimeException("Please enter correct bounds for max and min year"); + + } + @Override public Object run() { if (this.rd == null) { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDateBtwYears.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDateBtwYears.java index e4e4586cd..f11fee203 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDateBtwYears.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomDateBtwYears.java @@ -22,6 +22,18 @@ public RandomDateBtwYears(List values) { } } + public RandomDateBtwYears(List values,int workerId,int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.yearLowerBound = ((Number) values.get(0)).intValue(); + this.yearUpperBound = ((Number) values.get(1)).intValue(); + if (yearLowerBound > yearUpperBound) { + throw new RuntimeException("Please enter correct values for yearLowerBound and yearUpperBound"); + } + } + public static int createRandomIntBetween(int start, int end) { return start + (int) Math.round(Math.random() * (end - start)); } diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoFloat.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoFloat.java index ade17aca9..a2d202e11 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoFloat.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoFloat.java @@ -18,6 +18,17 @@ public RandomExpoFloat(List values) { this.deviation = ((Number) values.get(1)).doubleValue(); } + public RandomExpoFloat(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.center = ((Number) values.get(0)).doubleValue(); + this.deviation = ((Number) values.get(1)).doubleValue(); + } + /** * Returns a random exponential distribution float value with average equal to center */ diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoInt.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoInt.java index dba584646..da6ef03bd 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoInt.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoInt.java @@ -18,6 +18,17 @@ public RandomExpoInt(List values) { this.deviation = ((Number) values.get(1)).intValue(); } + public RandomExpoInt(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.center = ((Number) values.get(0)).intValue(); + this.deviation = ((Number) values.get(1)).intValue(); + } + /** * Returns a random exponential distribution int value with average equal to center */ diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoLong.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoLong.java index 7bc3e8f26..1544383f4 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoLong.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomExpoLong.java @@ -18,6 +18,17 @@ public RandomExpoLong(List values) { this.deviation = ((Number) values.get(1)).longValue(); } + public RandomExpoLong(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.center = ((Number) values.get(0)).longValue(); + this.deviation = ((Number) values.get(1)).longValue(); + } + /** * Returns a random exponential distribution long value with average equal to center */ diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomFixedPoint.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomFixedPoint.java index 717830ea2..433409258 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomFixedPoint.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomFixedPoint.java @@ -37,6 +37,20 @@ public RandomFixedPoint(List values) { throw new RuntimeException("Please enter a correct range for min and max values"); } + public RandomFixedPoint(List values, int workerId, int totalWorkers) { + + super((int) System.nanoTime()); + if (values.size() != 3) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.decimalPlaces = ((Number) values.get(0)).intValue(); + this.minimum = ((Number) values.get(1)).doubleValue(); + this.maximum = ((Number) values.get(2)).doubleValue(); + if (maximum < minimum) + throw new RuntimeException("Please enter a correct range for min and max values"); + } + public int number(int minimum, int maximum) { int range_size = maximum - minimum + 1; diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomInt.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomInt.java index 930e00692..e6c12fe5a 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomInt.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomInt.java @@ -32,6 +32,18 @@ public RandomInt(List values) { throw new RuntimeException("Please enter correct values for min and max"); } + public RandomInt(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.minimum = ((Number) values.get(0)).intValue(); + this.maximum = ((Number) values.get(1)).intValue(); + if (maximum < minimum) + throw new RuntimeException("Please enter correct values for min and max"); + } + @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomJson.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomJson.java index 9c952d2c7..3dc4f4b53 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomJson.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomJson.java @@ -26,6 +26,17 @@ public RandomJson(List values) { this.valueLength = ((Number) (int) values.get(3)).intValue(); } + public RandomJson(List values, int workerId, int totalWorkers) { + if (values.size() != 4) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.fields = ((Number) (int) values.get(0)).intValue(); + this.nestedness = ((Number) (int) values.get(1)).intValue(); + this.valueType = values.get(2); + this.valueLength = ((Number) (int) values.get(3)).intValue(); + } + @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomLong.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomLong.java index 90766a0e1..0c00a66c9 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomLong.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomLong.java @@ -28,6 +28,17 @@ public RandomLong(List values) { if (maximum < minimum) throw new RuntimeException("Please enter correct values for min and max"); } + public RandomLong(List values,int workerId,int totalWorkers) { + super((int) System.nanoTime()); + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.minimum = ((Number) values.get(0)).longValue(); + this.maximum = ((Number) values.get(1)).longValue(); + if (maximum < minimum) + throw new RuntimeException("Please enter correct values for min and max"); + } @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNoWithDecimalPoints.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNoWithDecimalPoints.java index 72ead61ca..1cd12a79e 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNoWithDecimalPoints.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNoWithDecimalPoints.java @@ -22,6 +22,19 @@ public RandomNoWithDecimalPoints(List values) { } } + public RandomNoWithDecimalPoints(List values, int workerId, int totalWorkers) { + if (values.size() != 3) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.lowerBound = ((Number) values.get(0)).intValue(); + this.upperBound = ((Number) values.get(1)).intValue(); + this.decimalPoints = ((Number) values.get(2)).intValue(); + if (lowerBound < 0 || upperBound < lowerBound || decimalPoints < 0) { + throw new RuntimeException("Incorrect parameters for random no with decimal points"); + } + } + @Override public Object run() { Random rnd = new Random(); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalFloat.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalFloat.java index 19c39f6ea..1b721feee 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalFloat.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalFloat.java @@ -19,6 +19,17 @@ public RandomNormalFloat(List values) { this.deviation = ((Number) values.get(1)).doubleValue(); } + public RandomNormalFloat(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.center = ((Number) values.get(0)).doubleValue(); + this.deviation = ((Number) values.get(1)).doubleValue(); + } + /** * Returns a random normal distribution float value with average equal to center */ diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalInt.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalInt.java index c8d788ef5..f7e6b56b5 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalInt.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalInt.java @@ -19,6 +19,17 @@ public RandomNormalInt(List values) { this.deviation = ((Number) values.get(1)).intValue(); } + public RandomNormalInt(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.center = ((Number) values.get(0)).intValue(); + this.deviation = ((Number) values.get(1)).intValue(); + } + /** * Returns a random normal distribution int value with average equal to center */ diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalLong.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalLong.java index 28deb2351..28f006a75 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalLong.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNormalLong.java @@ -18,6 +18,17 @@ public RandomNormalLong(List values) { this.deviation = ((Number) values.get(1)).longValue(); } + public RandomNormalLong(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.center = ((Number) values.get(0)).longValue(); + this.deviation = ((Number) values.get(1)).longValue(); + } + /** * Returns a random normal distribution long value with average equal to center */ diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNstring.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNstring.java index 8d5bd790e..f89c15436 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNstring.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNstring.java @@ -20,6 +20,18 @@ public RandomNstring(List values) { throw new RuntimeException("Please enter correct bounds for max and min length"); } + public RandomNstring(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.minimumLength = ((Number) values.get(0)).intValue(); + this.maximumLength = ((Number) values.get(1)).intValue(); + if (minimumLength > maximumLength || minimumLength == 0 && maximumLength == 0 || minimumLength < 0) + throw new RuntimeException("Please enter correct bounds for max and min length"); + } + /** * @returns a random numeric string with length in range [minimum_length, * maximum_length]. diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumber.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumber.java index 971833e15..dbe0c8246 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumber.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumber.java @@ -16,6 +16,14 @@ public RandomNumber(List values) { this.minimum = ((Number) values.get(0)).intValue(); this.maximum = ((Number) values.get(1)).intValue(); } + public RandomNumber(List values,int workerId,int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.minimum = ((Number) values.get(0)).intValue(); + this.maximum = ((Number) values.get(1)).intValue(); + } @Override public Object run() { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumberDefault.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumberDefault.java index d5f84fc6d..60feba45b 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumberDefault.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomNumberDefault.java @@ -7,7 +7,8 @@ public class RandomNumberDefault implements BaseUtil { private final int lowerBound = Integer.MIN_VALUE; - private final int upperBound = Integer.MAX_VALUE-1; + private final int upperBound = Integer.MAX_VALUE - 1; + public RandomNumberDefault(List values) { if (values.size() != 0) { @@ -17,6 +18,14 @@ public RandomNumberDefault(List values) { } + public RandomNumberDefault(List values, int workerId, int totalWorkers) { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + + } + @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { return ThreadLocalRandom.current().nextInt(lowerBound, upperBound + 1); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomString.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomString.java index c9c0d46c7..c26f4a10e 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomString.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomString.java @@ -25,6 +25,20 @@ public RandomString(List values) { throw new RuntimeException("Please enter correct min, max and no. of characters for random string"); } + public RandomString(List values, int workerId, int totalWorkers) { + super((int) System.nanoTime()); + if (values.size() != 4) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.minimumLength = ((Number) values.get(0)).intValue(); + this.maximumLength = ((Number) values.get(1)).intValue(); + this.base = (char) values.get(2); + this.numCharacters = ((Number) values.get(3)).intValue(); + if (maximumLength < minimumLength || numCharacters <= 0) + throw new RuntimeException("Please enter correct min, max and no. of characters for random string"); + } + public int number(int minimum, int maximum) { int range_size = maximum - minimum + 1; diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringAlphabets.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringAlphabets.java index 445c46e4c..51e00bf9f 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringAlphabets.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringAlphabets.java @@ -15,6 +15,15 @@ public RandomStringAlphabets(List values) { if (desiredLength <= 0) throw new RuntimeException("Please enter positive string length"); } + public RandomStringAlphabets(List values,int workerId,int totalWorkers) { + if (values.size() != 1) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.desiredLength = ((Number) values.get(0)).intValue(); + if (desiredLength <= 0) + throw new RuntimeException("Please enter positive string length"); + } @Override public Object run() { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringNumeric.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringNumeric.java index 4b6f763be..24e76622a 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringNumeric.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringNumeric.java @@ -15,6 +15,16 @@ public RandomStringNumeric(List values) { throw new RuntimeException("Please enter positive string length"); } + public RandomStringNumeric(List values, int workerId, int totalWorkers) { + if (values.size() != 1) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.desiredLength = ((Number) values.get(0)).intValue(); + if (desiredLength <= 0) + throw new RuntimeException("Please enter positive string length"); + } + @Override public Object run() { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringTextArrayGen.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringTextArrayGen.java index 3430d1d2a..129000ca2 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringTextArrayGen.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomStringTextArrayGen.java @@ -30,6 +30,23 @@ public RandomStringTextArrayGen(List values) { } + public RandomStringTextArrayGen(List values, int workerId, int totalWorkers) { + if (values.size() != 3) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + + } + this.arraySize = ((Number) values.get(0)).intValue(); + if (arraySize <= 0) + throw new RuntimeException("Please enter positive text array length"); + textArray = new String[arraySize]; + this.minLengthOfString = ((Number) values.get(1)).intValue(); + this.maxLengthOfString = ((Number) values.get(2)).intValue(); + if (minLengthOfString > maxLengthOfString || minLengthOfString < 0) + throw new RuntimeException("Please enter correct bounds for max and min length"); + + } + @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { for (int i = 0; i < arraySize; i++) { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomUUID.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomUUID.java index 4fb11d346..de08852e6 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomUUID.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RandomUUID.java @@ -13,6 +13,13 @@ public RandomUUID(List values) { } } + public RandomUUID(List values, int workerId, int totalWorkers) { + if (values.size() != 0) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + } + @Override public Object run() { UUID uuid = UUID.randomUUID(); diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedInt.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedInt.java index d90114ea9..246fb67c5 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedInt.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedInt.java @@ -21,6 +21,18 @@ public RowRandomBoundedInt(List values) { } + public RowRandomBoundedInt(List values, int workerId, int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.lowValue = ((Number) values.get(0)).intValue(); + this.highValue = ((Number) values.get(1)).intValue(); + if (lowValue > highValue) + throw new RuntimeException("Please enter correct value for max and min value"); + + } + @Override public Object run() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException { diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedLong.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedLong.java index 8309929e4..113e2f7cc 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedLong.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/RowRandomBoundedLong.java @@ -19,6 +19,17 @@ public RowRandomBoundedLong(List values) { throw new RuntimeException("Please enter correct value for max and min value"); } + public RowRandomBoundedLong(List values, int workerId, int totalWorkers) { + if (values.size() != 2) { + throw new RuntimeException("Incorrect number of parameters for util function " + + this.getClass()); + } + this.lowValue = ((Number) values.get(0)).longValue(); + this.highValue = ((Number) values.get(1)).longValue(); + if (lowValue > highValue) + throw new RuntimeException("Please enter correct value for max and min value"); + } + @Override public Object run() { return lowValue + (long) (Math.random() * (highValue - lowValue)); From 8d94dc06415ac5bff71f0c5ccdb530d416be196d Mon Sep 17 00:00:00 2001 From: Rakshit Jain Date: Thu, 10 Nov 2022 15:08:23 +0530 Subject: [PATCH 3/6] sout removed --- .../benchmarks/featurebench/utils/PrimaryIntGen.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java index 33c32e375..485f056f7 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/utils/PrimaryIntGen.java @@ -43,7 +43,6 @@ public PrimaryIntGen(List values, int workerId, int totalWorkers) { int upperRangeTemp = (((Number) values.get(0)).intValue() + (divide) * (workerId + 1) + (workerId == 0 ? 0 : 1)); this.upperRange = Math.min(upperRangeTemp, ((Number) values.get(1)).intValue()); this.lowerRange = ((Number) values.get(0)).intValue() + divide * (workerId) + (workerId == 0 ? 0 : 1); - System.out.println(this.lowerRange + " " + this.upperRange); if (upperRange < lowerRange) { throw new RuntimeException("Upper bound less than lower bound"); } From 8133a78acadcd11a4460eedc523b69d791d6b63d Mon Sep 17 00:00:00 2001 From: Rakshit Jain Date: Mon, 14 Nov 2022 19:23:03 +0530 Subject: [PATCH 4/6] done prefix --- .../demo/featurebench_count_sample.yaml | 2 +- .../demo/sample_featurebench_insert.yaml | 173 ++++++++++++++---- .../featurebench/FeatureBenchLoader.java | 8 +- 3 files changed, 147 insertions(+), 36 deletions(-) diff --git a/config/yugabyte/demo/featurebench_count_sample.yaml b/config/yugabyte/demo/featurebench_count_sample.yaml index e0850e223..67761c69f 100644 --- a/config/yugabyte/demo/featurebench_count_sample.yaml +++ b/config/yugabyte/demo/featurebench_count_sample.yaml @@ -27,7 +27,7 @@ microbenchmark: - DROP TABLE accounts1; - DROP TABLE accounts2; loadRules: - - table: accounts + - table_prefix: accounts count: 2 rows: 10 columns: diff --git a/config/yugabyte/demo/sample_featurebench_insert.yaml b/config/yugabyte/demo/sample_featurebench_insert.yaml index cb26126f0..7b3a598b6 100644 --- a/config/yugabyte/demo/sample_featurebench_insert.yaml +++ b/config/yugabyte/demo/sample_featurebench_insert.yaml @@ -6,60 +6,169 @@ password: batchsize: 128 isolation: TRANSACTION_REPEATABLE_READ loaderthreads: 1 -terminals: 2 +terminals: 4 works: work: - time_secs: 33 - rate: 1000 + time_secs: 20 + rate: unlimited warmup: 0 microbenchmark: class: com.oltpbenchmark.benchmarks.featurebench.customworkload.YBDefaultMicroBenchmark properties: - setAutoCommit: false + setAutoCommit: true create: - - DROP TABLE IF EXISTS inserttest; - - CREATE TABLE inserttest(id int,name text, primary key (id)) + - drop table if exists index_test_1; + - drop table if exists index_test_2; + - drop table if exists index_test_3; + - drop table if exists index_test_4; + - create table index_test_1 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create table index_test_2 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create table index_test_3 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create table index_test_4 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create index index_test_2_idx1 on index_test_2(col_int_1); + - create index index_test_3_idx1 on index_test_3(col_int_1); + - create index index_test_3_idx2 on index_test_3(col_int_2); + - create index index_test_3_idx3 on index_test_3(col_int_3); + - create index index_test_3_idx4 on index_test_3(col_int_4); + - create index index_test_3_idx5 on index_test_3(col_int_5); + - create index index_test_4_idx1 on index_test_4(col_int_1); + - create index index_test_4_idx2 on index_test_4(col_int_2); + - create index index_test_4_idx3 on index_test_4(col_int_3); + - create index index_test_4_idx4 on index_test_4(col_int_4); + - create index index_test_4_idx5 on index_test_4(col_int_5); + - create index index_test_4_idx6 on index_test_4(col_int_6); + - create index index_test_4_idx7 on index_test_4(col_int_7); + - create index index_test_4_idx8 on index_test_4(col_int_8); + - create index index_test_4_idx9 on index_test_4(col_int_9); + - create index index_test_4_idx10 on index_test_4(col_int_10); loadRules: - - table: inserttest - rows: 10 + - table_prefix: index_test_ + count: 4 + rows: 1000 columns: - name: id util: PrimaryIntGen params: - 1 - - 10 - - name: name + - 1000000 + - name: col_int_ + count: 10 + util: RandomNumber + params: + - 1 + - 1000000 + - name: col_varchar_ + count: 3 util: RandomAString params: - - 5 - - 5 + - 20 + - 20 + - name: col_date + util: RandomAString + params: + - 20 + - 20 + - name: col_boolean + util: RandomBoolean executeRules: - - workload: scanG4_yb_pkey_INclause_rangescan_increasing_rows_1row - run: - - name: pkey_INclause_rangescan_increasing_rows_1row_test - weight: 100 - queries: - - query: select * from inserttest where id IN (?) - bindings: - - count: 1 - util: PrimaryIntGen - params: [ 1, 1000000 ] - - -# executeRules: -# - workload: InsertScan + - workload: no_index + run: + - name: Insert_without_index_test + weight: 100 + queries: + - query: INSERT INTO index_test_1 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + bindings: + - util: PrimaryIntGen + params: + - 10001 + - 10000000 + - util: RandomNumber + count: 10 + params: + - 1 + - 1000000 + - util: RandomAString + count: 3 + params: + - 20 + - 20 + - util: RandomAString + params: + - 20 + - 20 + - util: RandomBoolean +# - workload: 1_index_test +# run: +# - name: Insert_with_1_index_test +# weight: 100 +# queries: +# - query: INSERT INTO index_test_2 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +# bindings: +# - util: PrimaryIntGen +# params: +# - 1000001 +# - 1100000 +# - util: RandomNumber +# count: 10 +# params: +# - 1 +# - 1000000 +# - util: RandomAString +# count: 3 +# params: +# - 20 +# - 20 +# - util: RandomAString +# params: +# - 20 +# - 20 +# - util: RandomBoolean +# - workload: 5_index_test # run: -# - name: Inserts +# - name: Insert_with_5_index_test # weight: 100 # queries: -# - query: INSERT INTO inserttest(id,name) values(? , ?); +# - query: INSERT INTO index_test_3 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) # bindings: # - util: PrimaryIntGen # params: +# - 1000001 +# - 1100000 +# - util: RandomNumber +# count: 10 +# params: +# - 1 +# - 1000000 +# - util: RandomAString +# count: 3 +# params: +# - 20 +# - 20 +# - util: RandomAString +# params: +# - 20 # - 20 -# - 100000 +# - util: RandomBoolean +# - workload: 10_index_test +# run: +# - name: Insert_with_10_index_test +# weight: 100 +# queries: +# - query: INSERT INTO index_test_4 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +# bindings: +# - util: PrimaryIntGen +# params: +# - 1000001 +# - 1100000 +# - util: RandomNumber +# count: 10 +# params: +# - 1 +# - 1000000 # - util: RandomAString +# count: 3 # params: -# - 4 -# - 4 - +# - 20 +# - 20 +# - util: CurrentTime +# - util: RandomBoolean \ No newline at end of file diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java index d9a878100..0826cc71f 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java @@ -119,20 +119,22 @@ private void loadRulesYaml(ArrayList loaderThreads) throws ClassNo } columns.add(column); } - if (loadRuleConfig.containsKey("count")) { + if (loadRuleConfig.containsKey("count") && loadRuleConfig.containsKey("table_prefix")) { for (int i = 0; i < loadRuleConfig.getInt("count"); i++) { - String[] tableNames = loadRuleConfig.getString("table").split(","); + String[] tableNames = loadRuleConfig.getString("table_prefix").split(","); for (String tableName : tableNames) { loaderThreads.add(new GeneratorYaml((tableName.strip() + String.valueOf(i + 1)), loadRuleConfig.getLong("rows"), columns)); } } - } else { + } else if(loadRuleConfig.containsKey("table")){ String[] tableNames = loadRuleConfig.getString("table").split(","); for (String tableName : tableNames) { loaderThreads.add(new GeneratorYaml(tableName.strip(), loadRuleConfig.getLong("rows"), columns)); } + }else{ + LOG.error("Proper Configuration Not Provided"); } } } From d223c16bfa27c113d01782b798d2fde59de23d3c Mon Sep 17 00:00:00 2001 From: Rakshit Jain Date: Mon, 14 Nov 2022 19:23:03 +0530 Subject: [PATCH 5/6] done prefix --- .../demo/featurebench_count_sample.yaml | 2 +- .../demo/sample_featurebench_insert.yaml | 173 ++++++++++++++---- .../featurebench/FeatureBenchLoader.java | 8 +- 3 files changed, 147 insertions(+), 36 deletions(-) diff --git a/config/yugabyte/demo/featurebench_count_sample.yaml b/config/yugabyte/demo/featurebench_count_sample.yaml index e0850e223..67761c69f 100644 --- a/config/yugabyte/demo/featurebench_count_sample.yaml +++ b/config/yugabyte/demo/featurebench_count_sample.yaml @@ -27,7 +27,7 @@ microbenchmark: - DROP TABLE accounts1; - DROP TABLE accounts2; loadRules: - - table: accounts + - table_prefix: accounts count: 2 rows: 10 columns: diff --git a/config/yugabyte/demo/sample_featurebench_insert.yaml b/config/yugabyte/demo/sample_featurebench_insert.yaml index cb26126f0..7b3a598b6 100644 --- a/config/yugabyte/demo/sample_featurebench_insert.yaml +++ b/config/yugabyte/demo/sample_featurebench_insert.yaml @@ -6,60 +6,169 @@ password: batchsize: 128 isolation: TRANSACTION_REPEATABLE_READ loaderthreads: 1 -terminals: 2 +terminals: 4 works: work: - time_secs: 33 - rate: 1000 + time_secs: 20 + rate: unlimited warmup: 0 microbenchmark: class: com.oltpbenchmark.benchmarks.featurebench.customworkload.YBDefaultMicroBenchmark properties: - setAutoCommit: false + setAutoCommit: true create: - - DROP TABLE IF EXISTS inserttest; - - CREATE TABLE inserttest(id int,name text, primary key (id)) + - drop table if exists index_test_1; + - drop table if exists index_test_2; + - drop table if exists index_test_3; + - drop table if exists index_test_4; + - create table index_test_1 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create table index_test_2 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create table index_test_3 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create table index_test_4 (id bigint, col_int_1 int, col_int_2 int, col_int_3 int, col_int_4 int, col_int_5 int, col_int_6 int, col_int_7 int, col_int_8 int, col_int_9 int, col_int_10 int, col_varchar_1 varchar(20), col_varchar_2 varchar(20), col_varchar_3 varchar(20), col_date text, col_boolean boolean, primary key (id asc)) + - create index index_test_2_idx1 on index_test_2(col_int_1); + - create index index_test_3_idx1 on index_test_3(col_int_1); + - create index index_test_3_idx2 on index_test_3(col_int_2); + - create index index_test_3_idx3 on index_test_3(col_int_3); + - create index index_test_3_idx4 on index_test_3(col_int_4); + - create index index_test_3_idx5 on index_test_3(col_int_5); + - create index index_test_4_idx1 on index_test_4(col_int_1); + - create index index_test_4_idx2 on index_test_4(col_int_2); + - create index index_test_4_idx3 on index_test_4(col_int_3); + - create index index_test_4_idx4 on index_test_4(col_int_4); + - create index index_test_4_idx5 on index_test_4(col_int_5); + - create index index_test_4_idx6 on index_test_4(col_int_6); + - create index index_test_4_idx7 on index_test_4(col_int_7); + - create index index_test_4_idx8 on index_test_4(col_int_8); + - create index index_test_4_idx9 on index_test_4(col_int_9); + - create index index_test_4_idx10 on index_test_4(col_int_10); loadRules: - - table: inserttest - rows: 10 + - table_prefix: index_test_ + count: 4 + rows: 1000 columns: - name: id util: PrimaryIntGen params: - 1 - - 10 - - name: name + - 1000000 + - name: col_int_ + count: 10 + util: RandomNumber + params: + - 1 + - 1000000 + - name: col_varchar_ + count: 3 util: RandomAString params: - - 5 - - 5 + - 20 + - 20 + - name: col_date + util: RandomAString + params: + - 20 + - 20 + - name: col_boolean + util: RandomBoolean executeRules: - - workload: scanG4_yb_pkey_INclause_rangescan_increasing_rows_1row - run: - - name: pkey_INclause_rangescan_increasing_rows_1row_test - weight: 100 - queries: - - query: select * from inserttest where id IN (?) - bindings: - - count: 1 - util: PrimaryIntGen - params: [ 1, 1000000 ] - - -# executeRules: -# - workload: InsertScan + - workload: no_index + run: + - name: Insert_without_index_test + weight: 100 + queries: + - query: INSERT INTO index_test_1 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) + bindings: + - util: PrimaryIntGen + params: + - 10001 + - 10000000 + - util: RandomNumber + count: 10 + params: + - 1 + - 1000000 + - util: RandomAString + count: 3 + params: + - 20 + - 20 + - util: RandomAString + params: + - 20 + - 20 + - util: RandomBoolean +# - workload: 1_index_test +# run: +# - name: Insert_with_1_index_test +# weight: 100 +# queries: +# - query: INSERT INTO index_test_2 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +# bindings: +# - util: PrimaryIntGen +# params: +# - 1000001 +# - 1100000 +# - util: RandomNumber +# count: 10 +# params: +# - 1 +# - 1000000 +# - util: RandomAString +# count: 3 +# params: +# - 20 +# - 20 +# - util: RandomAString +# params: +# - 20 +# - 20 +# - util: RandomBoolean +# - workload: 5_index_test # run: -# - name: Inserts +# - name: Insert_with_5_index_test # weight: 100 # queries: -# - query: INSERT INTO inserttest(id,name) values(? , ?); +# - query: INSERT INTO index_test_3 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) # bindings: # - util: PrimaryIntGen # params: +# - 1000001 +# - 1100000 +# - util: RandomNumber +# count: 10 +# params: +# - 1 +# - 1000000 +# - util: RandomAString +# count: 3 +# params: +# - 20 +# - 20 +# - util: RandomAString +# params: +# - 20 # - 20 -# - 100000 +# - util: RandomBoolean +# - workload: 10_index_test +# run: +# - name: Insert_with_10_index_test +# weight: 100 +# queries: +# - query: INSERT INTO index_test_4 (id, col_int_1, col_int_2, col_int_3, col_int_4, col_int_5, col_int_6, col_int_7, col_int_8, col_int_9, col_int_10, col_varchar_1, col_varchar_2, col_varchar_3, col_date, col_boolean) values (?, ?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) +# bindings: +# - util: PrimaryIntGen +# params: +# - 1000001 +# - 1100000 +# - util: RandomNumber +# count: 10 +# params: +# - 1 +# - 1000000 # - util: RandomAString +# count: 3 # params: -# - 4 -# - 4 - +# - 20 +# - 20 +# - util: CurrentTime +# - util: RandomBoolean \ No newline at end of file diff --git a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java index d9a878100..0826cc71f 100644 --- a/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java +++ b/src/main/java/com/oltpbenchmark/benchmarks/featurebench/FeatureBenchLoader.java @@ -119,20 +119,22 @@ private void loadRulesYaml(ArrayList loaderThreads) throws ClassNo } columns.add(column); } - if (loadRuleConfig.containsKey("count")) { + if (loadRuleConfig.containsKey("count") && loadRuleConfig.containsKey("table_prefix")) { for (int i = 0; i < loadRuleConfig.getInt("count"); i++) { - String[] tableNames = loadRuleConfig.getString("table").split(","); + String[] tableNames = loadRuleConfig.getString("table_prefix").split(","); for (String tableName : tableNames) { loaderThreads.add(new GeneratorYaml((tableName.strip() + String.valueOf(i + 1)), loadRuleConfig.getLong("rows"), columns)); } } - } else { + } else if(loadRuleConfig.containsKey("table")){ String[] tableNames = loadRuleConfig.getString("table").split(","); for (String tableName : tableNames) { loaderThreads.add(new GeneratorYaml(tableName.strip(), loadRuleConfig.getLong("rows"), columns)); } + }else{ + LOG.error("Proper Configuration Not Provided"); } } } From 96fb66f300a400716156490ba1c962d3a14f6cbf Mon Sep 17 00:00:00 2001 From: Rakshit Jain Date: Mon, 14 Nov 2022 19:26:58 +0530 Subject: [PATCH 6/6] Merge branch 'table-prefix' of https://github.com/yugabyte/benchbase into table-prefix --- config/yugabyte/demo/featurebench_count_sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/yugabyte/demo/featurebench_count_sample.yaml b/config/yugabyte/demo/featurebench_count_sample.yaml index 67761c69f..c67f2e23a 100644 --- a/config/yugabyte/demo/featurebench_count_sample.yaml +++ b/config/yugabyte/demo/featurebench_count_sample.yaml @@ -27,7 +27,7 @@ microbenchmark: - DROP TABLE accounts1; - DROP TABLE accounts2; loadRules: - - table_prefix: accounts + - table_prefix: accounts count: 2 rows: 10 columns: