Delete statement no finishing before function return

Continuing the discussion from N1QL DELETE DML Statement:

@perrin.bignoli is seeing a statement return without completing. is there additional code needed to make this call sync as opposed to async.

public static Observable executeQueryAsString(AsyncBucket bucket, String queryAsString) {
return bucket.query(N1qlQuery.simple(queryAsString))
.flatMap(result → result.rows()
.map(row → new JsonObject(row.value().toString()))
.collect(JsonArray::new, JsonArray::add));
}

@cihangirb

I figured out what was happening. The testing apparatus was inserting the 70k entries directly before the query statement was executed, so I believe that the re-indexing operation had not yet completed when the query was executed. When I added ScanConsistency.REQUEST_PLUS to the N1QLParams, the DELETEs began working as I expected. Thanks!

Best,
Perrin

1 Like