Details
-
Bug
-
Resolution: Fixed
-
Critical
-
4.0.0
-
Security Level: Public
-
Untriaged
-
Unknown
Description
Preface: I've marked it as a blocker for DP because I think it needs awareness and decisions on how we are proceeding for DP. Feel free to lower the priority once we know what to do.
I'm on build 1757.
As part of the DP docs, the SDK team is working on RYOW examples in each language. The Java code looks like this:
|
public static void main(String[] args) { |
// Connect to the Cluster |
Cluster cluster = CouchbaseCluster.create();
|
// Open the travel-sample bucket |
Bucket bucket = cluster.openBucket("travel-sample"); |
|
// Create a new airline (document) |
bucket.upsert(JsonDocument.create("airline_000", JsonObject.create() |
.put("id", "000") |
.put("type", "airline") |
.put("name", "Couchbase Airways") |
.put("iata", "CBX") |
.put("icao", "CBX") |
.put("callsign", "COUCH-BASE") |
.put("country", "United States") |
));
|
|
// Perform the Query |
QueryResult result = bucket.query(
|
Query.simple(select("*").from(i(bucket.name())).where(x("iata").eq(s("CBX"))), |
QueryParams.build().consistency(ScanConsistency.REQUEST_PLUS))
|
);
|
|
// Prints |
// [{"country":"United States","iata":"CBX",...,"icao":"CBX","id":"000","type":"airline"}] |
System.out.println(result.allRows());
|
}
|
Now here is the problem: when using GSI on an index (I've used a primary index, but I don't think it matters), the result returns an empty row set, which means for some reason the previous write was not reflected in the query.
When I use a view-backed index all works as expected.
The misbehaving index in question is (out put from system:indexes):
"indexes": {
|
"datastore_id": "http://127.0.0.1:8091",
|
"id": "8e3a7900de0b7b73",
|
"index_key": [],
|
"keyspace_id": "travel-sample",
|
"name": "def_primary",
|
"namespace_id": "default",
|
"state": "online",
|
"using": "gsi"
|
}
|
.. when I do the query a second time the result shows up, which indicates there is indeed a time gap. Why does 2i does not pick up the latest and greatest sequence numbers when I issue a query with Request_plus?