RavenDB 4.0 How to avoid getting stale results and getting data in stream

49 views
Skip to first unread message

Rajesh Bawri

unread,
Nov 9, 2017, 9:51:50 AM11/9/17
to RavenDB - 2nd generation document database
Hi,

Issue: At times it happen that the custom indexes are getting built on a collection and in the meantime, user queries on the collection with that index, then how should we handle it that  we don't get stale results.

There is an option to add "Customize(a => a.WaitForNonStaleResults())" in the query to get correct results, but then I cannot use session.Advanced.Stream(query) over the results in order to avoid getting all the data at one go.

Let me know if my understanding is correct.  And, is there a way to get both the cases in place.( not getting stale results and avoid getting all the documents at one go).

Thanks,
Rajesh

Oren Eini (Ayende Rahien)

unread,
Nov 9, 2017, 10:35:25 AM11/9/17
to ravendb
What is the meaning of waiting for the index staleness in a stream? What is the scenario that you are looking at right now?

The usual manner is to do a query with page size of 0 and no stale, and then stream.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Rajesh Bawri

unread,
Nov 9, 2017, 11:23:32 AM11/9/17
to RavenDB - 2nd generation document database

Hi
 
What I meant is while the indexes are getting generated on server and user shoot a query , then how to make sure that user don't get stale results/data
 
How can we programmatically get both (the correct results and in stream) ?
 
I was getting run time error when I was using "Customize(a => a.WaitForNonStaleResults())" in my query and session.Advanced.Stream(query).
 
TIA 
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

Oren Eini (Ayende Rahien)

unread,
Nov 9, 2017, 3:30:12 PM11/9/17
to ravendb
What was the error?
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Rajesh Bawri

unread,
Nov 9, 2017, 10:54:24 PM11/9/17
to RavenDB - 2nd generation document database
Hi

Please find the below the stack trace and the message which I get when both of them are present.

Message:
Since Stream() does not wait for indexing (by design), streaming query with WaitForNonStaleResults is not supported.

StackTrace:
 
at Raven.Client.Documents.Session.Operations.StreamOperation.CreateRequest(IndexQuery query)
   at
Raven.Client.Documents.Session.DocumentSession.Stream[T](IDocumentQuery`1 query)
   at RavenDBClient.EnumerableExtensions.<ConvertStream>d__2`
1.MoveNext() in D:\RavenWork\RavenDBClient\RavenDBClient\EnumerableExtensions.cs:line 80
   at
System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at
System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at RavenDBClient.UseCases.SkyUseCase9() in D:\RavenWork\RavenDBClient\RavenDBClient\UseCases.cs:line 49

Rajesh

Oren Eini (Ayende Rahien)

unread,
Nov 10, 2017, 5:08:06 AM11/10/17
to ravendb
First run the query _without_ the stream.
Then run the query with the stream.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages