Merge pull request #2560 from ajbeamon/java-bindingtester-error-retry

Add retry loop to Java binding tester instruction reader
This commit is contained in:
Vishesh Yadav 2020-01-23 09:54:43 -08:00 committed by GitHub
commit b5c1c8cdd0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 9 deletions

View File

@ -667,10 +667,7 @@ public class AsyncStackTester {
};
if(operations == null || ++currentOp == operations.size()) {
Transaction tr = db.createTransaction();
return tr.getRange(nextKey, endKey, 1000).asList()
.whenComplete((x, t) -> tr.close())
return db.readAsync(readTr -> readTr.getRange(nextKey, endKey, 1000).asList())
.thenComposeAsync(next -> {
if(next.size() < 1) {
//System.out.println("No key found after: " + ByteArrayUtil.printable(nextKey.getKey()));

View File

@ -547,18 +547,15 @@ public class StackTester {
@Override
void executeOperations() {
KeySelector begin = nextKey;
while(true) {
Transaction t = db.createTransaction();
List<KeyValue> keyValues = t.getRange(begin, endKey/*, 1000*/).asList().join();
t.close();
List<KeyValue> keyValues = db.read(readTr -> readTr.getRange(nextKey, endKey/*, 1000*/).asList().join());
if(keyValues.size() == 0) {
break;
}
//System.out.println(" * Got " + keyValues.size() + " instructions");
for(KeyValue next : keyValues) {
begin = KeySelector.firstGreaterThan(next.getKey());
nextKey = KeySelector.firstGreaterThan(next.getKey());
processOp(next.getValue());
instructionIndex++;
}