Delete query and get() does not play together well

Hi,

I believe this has been covered before, but I cannot seem to find the old thread.

Whenever we run an integration/functional test, we flush testing bucket before running the tests. It is very hard to control behavior of bucket for testing.

  1. Issue delete from bucketName
  2. insert a document
  3. try to find the document with get() method.
  4. I get document does not exist exception. However, when I look up the document with a value with n1ql, then it works.

This happens both on 4.0 and 4.1.

Is there anyway to workaround this issue?

it’s impossible to run tests. I have to run each test one by one.

If you want a query to be consistent with respect to recent changes (or more accurately, with respect to the time the query is received), you should issue it with REQUEST_PLUS which is covered in the docs in various places. That should get you what you need at test time.

You may want to use it at deployment time too. Note that it takes more time, so consider carefully where you want to use it.

I actually use STATEMENT_PLUS now and having the same issue.

STATEMENT_PLUS would be appropriate through something maintaining a stateful connection to the REST service and routing all mutations and queries through it. When using a combination of interfaces like KV operations and query, REQUEST_PLUS will give you consistency. Can you try it?