Skip to content

Commit e2b40ad

Browse files
committed
Adding target_vb loading + iterations support to default cmd line loader
1 parent 7b9c24f commit e2b40ad

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

src/main/java/Loader.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ public static void main(String[] args) throws IOException {
196196
Option mutation_timeout = new Option("mutation_timeout", true, "");
197197
options.addOption(mutation_timeout);
198198

199+
Option target_vbuckets_option = new Option("target_vbuckets", true, "Target vbuckets (comma-separated list of positive integers)");
200+
options.addOption(target_vbuckets_option);
201+
202+
Option iterations_option = new Option("iterations", true, "Number of iterations to run");
203+
options.addOption(iterations_option);
204+
205+
Option total_vbuckets_option = new Option("total_vbuckets", true, "Total number of vbuckets (default: 1024)");
206+
options.addOption(total_vbuckets_option);
207+
199208
Option maxTTL = new Option("maxTTL", true, "Expiry Time");
200209
options.addOption(maxTTL);
201210

@@ -241,6 +250,19 @@ public static void main(String[] args) throws IOException {
241250
cmd.getOptionValue("mutate_field",""),
242251
Integer.parseInt(cmd.getOptionValue("mutation_timeout","0")));
243252

253+
int[] targetVbuckets = new int[0]; // Default to empty array
254+
String targetVbucketsStr = cmd.getOptionValue("target_vbuckets");
255+
if (targetVbucketsStr != null && !targetVbucketsStr.trim().isEmpty()) {
256+
String[] vbucketStrings = targetVbucketsStr.split(",");
257+
targetVbuckets = new int[vbucketStrings.length];
258+
for (int i = 0; i < vbucketStrings.length; i++) {
259+
targetVbuckets[i] = Integer.parseInt(vbucketStrings[i].trim());
260+
}
261+
}
262+
263+
int iterations = Integer.parseInt(cmd.getOptionValue("iterations", "1"));
264+
int totalVbuckets = Integer.parseInt(cmd.getOptionValue("total_vbuckets", "1024"));
265+
244266
HashMap<String, Number> dr = new HashMap<String, Number>();
245267
dr.put(DRConstants.create_s, Long.parseLong(cmd.getOptionValue(DRConstants.create_s, "0")));
246268
dr.put(DRConstants.create_e, Long.parseLong(cmd.getOptionValue(DRConstants.create_e, "0")));
@@ -261,7 +283,7 @@ public static void main(String[] args) throws IOException {
261283
ws.dr = range;
262284
DocumentGenerator dg = null;
263285
try {
264-
dg = new DocumentGenerator(ws, ws.keyType, ws.valueType);
286+
dg = new DocumentGenerator(ws, ws.keyType, ws.valueType, iterations, totalVbuckets, targetVbuckets);
265287
} catch (ClassNotFoundException e1) {
266288
e1.printStackTrace();
267289
}

0 commit comments

Comments
 (0)