Skip to content

Commit 091b3e0

Browse files
committed
Replacing incrAndGet() -> getAndIncr()
This ensures there is a consistency between the index we maintain and the doc_index we see on the cluster. This is also required to fix the keyIndex error for targetVB doc_gen scenarios where we create one key with index=0 but the index we try to fetch is 1 due to incrAndGet()
1 parent f20a11a commit 091b3e0

2 files changed

Lines changed: 15 additions & 15 deletions

File tree

src/main/java/utils/docgen/DocumentGenerator.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public WorkLoadSettings get_work_load_settings() {
351351
}
352352

353353
public Tuple2<String, Object> next() {
354-
long temp = this.ws.dr.createItr.incrementAndGet();
354+
long temp = this.ws.dr.createItr.getAndIncrement();
355355
String k = null;
356356
Object v = null;
357357
try {
@@ -368,7 +368,7 @@ public Tuple2<String, Object> next() {
368368
}
369369

370370
public Tuple2<String, Object> nextRead() {
371-
long temp = this.ws.dr.readItr.incrementAndGet();
371+
long temp = this.ws.dr.readItr.getAndIncrement();
372372
String k = null;
373373
Object v = null;
374374
try {
@@ -385,7 +385,7 @@ public Tuple2<String, Object> nextRead() {
385385
}
386386

387387
public Tuple2<String, Object> nextUpdate() {
388-
long temp = this.ws.dr.updateItr.incrementAndGet();
388+
long temp = this.ws.dr.updateItr.getAndIncrement();
389389
String k = null;
390390
Object v = null;
391391
try {
@@ -402,7 +402,7 @@ public Tuple2<String, Object> nextUpdate() {
402402
}
403403

404404
public Tuple2<String, Object> nextExpiry() {
405-
long temp = this.ws.dr.expiryItr.incrementAndGet();
405+
long temp = this.ws.dr.expiryItr.getAndIncrement();
406406
String k = null;
407407
Object v = null;
408408
try {
@@ -425,16 +425,16 @@ public Tuple2<String, Object> nextExpiry() {
425425

426426
switch(op_type) {
427427
case "insert":
428-
temp = this.ws.dr.subdocInsertItr.incrementAndGet();
428+
temp = this.ws.dr.subdocInsertItr.getAndIncrement();
429429
break;
430430
case "upsert":
431-
temp = this.ws.dr.subdocUpsertItr.incrementAndGet();
431+
temp = this.ws.dr.subdocUpsertItr.getAndIncrement();
432432
break;
433433
case "remove":
434-
temp = this.ws.dr.subdocRemoveItr.incrementAndGet();
434+
temp = this.ws.dr.subdocRemoveItr.getAndIncrement();
435435
break;
436436
case "lookup":
437-
temp = this.ws.dr.subdocReadItr.incrementAndGet();
437+
temp = this.ws.dr.subdocReadItr.getAndIncrement();
438438
break;
439439
default:
440440
return null;
@@ -451,7 +451,7 @@ public Tuple2<String, Object> nextExpiry() {
451451
public Tuple2<String, List<LookupInSpec>>nextSubDocLookup() {
452452
String key = null;
453453
List<LookupInSpec> specs = null;
454-
long temp = this.ws.dr.subdocReadItr.incrementAndGet();
454+
long temp = this.ws.dr.subdocReadItr.getAndIncrement();
455455
try {
456456
key = (String) this.keyMethod.invoke(this.keys, temp);
457457
specs = (List<LookupInSpec>) this.subdocLookupMethod.invoke(this.vals, key);
@@ -507,7 +507,7 @@ public List<String> nextDeleteBatch() {
507507
List<String> docs = new ArrayList<String>();
508508
while (this.has_next_delete() && count<ws.batchSize*ws.deletes/100) {
509509
try {
510-
temp = this.ws.dr.deleteItr.incrementAndGet();
510+
temp = this.ws.dr.deleteItr.getAndIncrement();
511511
if (this.target_vbuckets != null && this.target_vbuckets.length > 0) {
512512
docs.add(this.generated_delete_keys.get(temp));
513513
} else {

src/main/java/utils/docgen/mongo/MongoDocumentGenerator.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public WorkLoadSettings get_work_load_settings() {
136136
}
137137

138138
public Tuple2<String, Object> next() {
139-
long temp = this.ws.dr.createItr.incrementAndGet();
139+
long temp = this.ws.dr.createItr.getAndIncrement();
140140
String k = null;
141141
Object v = null;
142142
try {
@@ -149,7 +149,7 @@ public Tuple2<String, Object> next() {
149149
}
150150

151151
public Tuple2<String, Object> nextRead() {
152-
long temp = this.ws.dr.readItr.incrementAndGet();
152+
long temp = this.ws.dr.readItr.getAndIncrement();
153153
String k = null;
154154
Object v = null;
155155
try {
@@ -162,7 +162,7 @@ public Tuple2<String, Object> nextRead() {
162162
}
163163

164164
public Tuple2<String, Object> nextUpdate() {
165-
long temp = this.ws.dr.updateItr.incrementAndGet();
165+
long temp = this.ws.dr.updateItr.getAndIncrement();
166166
String k = null;
167167
Object v = null;
168168
try {
@@ -175,7 +175,7 @@ public Tuple2<String, Object> nextUpdate() {
175175
}
176176

177177
public Tuple2<String, Object> nextExpiry() {
178-
long temp = this.ws.dr.expiryItr.incrementAndGet();
178+
long temp = this.ws.dr.expiryItr.getAndIncrement();
179179
String k = null;
180180
Object v = null;
181181
try {
@@ -237,7 +237,7 @@ public List<String> nextDeleteBatch() {
237237
List<String> docs = new ArrayList<String>();
238238
while (this.has_next_delete() && count<ws.batchSize*ws.deletes/100) {
239239
try {
240-
temp = this.ws.dr.deleteItr.incrementAndGet();
240+
temp = this.ws.dr.deleteItr.getAndIncrement();
241241
docs.add((String) this.keyMethod.invoke(this.keys, temp));
242242
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
243243
e.printStackTrace();

0 commit comments

Comments
 (0)