We have an index that is indexed on meta().id where the
document key has a specific prefix, typically like:
CREATE INDEX my_index ON mybucket (meta().id, fieldA, fieldB) WHERE meta().id LIKE "A:%"
We query this index occasionally with a query like:
SELECT meta().id, fieldA, fieldB FROM mybucket WHERE meta().id LIKE "A:%"
At one point in time, in one incarnation of an installation we experienced an
unexpected result using the above query giving us at least two items in the
result set having the same meta().id but, at least, one of the other keys had
different values. Leading us to believe that maybe there was an (for us) unwanted
entry somehow remaining in the couchbase index.
To clarify, the query response contained something like:
We have only encountered this behaviour once that we know of and we have not
been able to recreate it since.
Couchbase 5.0.1 community edition, one node and one bucket. We have other
indexes, however non that includes any of the documents also in the index above.
Does anyone know if this is even possible and if so under which circumstances
would/could this state appear?
Post the explain and also try with latest versions.
Check what index it used and see if any mutations are pending. If required drop that index and re-create.
This query should have used primary index and this should not have possible.
Thanks for your reply! As I said we have not been able to recreate this state again, but we need to know if it is something that we should account for happening, but it seems like we shouldn’t have to then. The couchbase installation where we encountered this is long gone i’m afraid, but now we know that if it happens again there is something fishy going on… (And then we will see if any mutations are pending and dig into the logs e.t.c.)