Views seem to lose their way
Hi there,
I have several views in production. Every once and a while I'll get a document returned for a view which *should not* be emitted by the map function. All data is flushed to disk, the document is verified to be updated correctly but the view still returns it.
For instance:
1/ I'll enter a document with the status "new";
2/ I'll have a "new" view which returns all "new" documents;
3/ The "new" view correctly returns the document created in 1/;
4/ I'll save the document with a status of "old";
5/ The "new" view will still return the document, even though the status should not be triggering an emit.
If I add a new view to the design document in question and re-publish the view created in 2/ it will then have the correct results, so it's not the document format or map error.
Any ideas?
No that's not the problem at all. The views have "leftover" records in them that never get updated or cleared. I'm talking about artifacts in the index that are left over *hours* after the document shoudl have been updated in the index. The views are being accessed with stale=false and after all docs have been flushed to disk.
This is *definitely* a bug.
Hello PGrigor,
If I understand correctly your problem you are in the typical behavior of the "eventually consistent" query engine, but we have solution for that.
To be sure that Couchbase server provide predictable fast access to the data most the operation are done asynchronously (write to the disk, index udpate, ...) The flip size of this is that sometimes the data you see in a query are not the result you expect. This is "normal behavior".
The solution to this is to control on your query the update of the index, you can do that using the "stale" parameter, I invite you to look at this page:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-views-writi...
So if you are using stale=false in your application you should see the new result (if the document has been saved on disk)
Let me know ...
Regards
Tug
@tgrall