Views Result Consistency


#1

Hi I was wondering if there is something at the .NET SDK that can tell the developer if a query to a View has to be retried using Stale.False, this is my scenario: I have a process running with goal is to generate a counter of new events on the database, the events views is always one or to events behind, I know i can use Stale.False every time I query de view, but nah could be potentially slow if the data base get big, so is there a way that the result acknowledges me about the view being in an Incomplete State ???

If that is not possible, there is a way to force via SDK to refresh the View, like in Elasticsearch you have a Refresh Method per Index, so you can call it every time you create a new document in case the index is not updated or inserted so often this kind of will work.

Thanks,


#2

The view is automatically updated on an interval. The server docs should have some details on adjusting that. Let me know if you cannot find it.

The problem with knowing “complete” or not is that it needs to be with respect to a change. It’s a global ordering problem you might say. Some solve this by retaining changes this particular client ‘actor’ made, and then applying that result on top of their view query results. That may not work if you want to know if it’s complete with respect to another actor.

Also, note that in N1QL, we have a feature, REQUEST_PLUS, that can scope this to the changes that this particular client instance knows about. We need to add some better documentation on that, but if you’d like more information, please let me know.


#3

@anibal

Here is some information on updating the view updateInterval: https://developer.couchbase.com/documentation/server/current/indexes/mapreduce-view-operation.html

As far as RequestPlus, I have written a blog post about using it with .NET (and the other N1QL scan consistency options) here: https://blog.couchbase.com/2016/june/new-to-couchbase-4.5-atplus - It’s not documentation, but it will help get you started if you decide to go down that route.