Having inconsistent problems when trying to Include( ... ) in a query between a DocumentStore and an EmbeddedableDocumentStore

31 views
Skip to first unread message

Justin A

unread,
Apr 30, 2012, 1:12:18 AM4/30/12
to rav...@googlegroups.com
Hi folks,

I'm trying to get a list of docs, and include two other different root aggregates. When I do this with a DocumentStore, it's working. When I try and do this with an EmbeddableDocumentStore, I get an error about 30 session limit, etc (which is 'Safe By Default'). No, increasing the MaxNumberOfRequestsPerSession is not a proper answer, here. I love the fact that this is erroring ... assuming I wasn't trying to .Include(..);

So I'm not sure what to do?

Lets break down the issue to confirm that, what I'm saying is actually happening.
NOTE: i'm just using Take(2) here but it's when i make this Take(9999) or a larger number, that's when the error occurs.

1. No Include.
var query = DocumentSession.Query<LogEntries_TextBanList.ReduceResultLogEntries_TextBanList>()
                           .Take(2)
                           .ToArray();

Output:
Request #  59: GET     -    47 ms - <default>  - 200 - /indexes/LogEntries/TextBanList?query=&start=0&pageSize=2&aggregation=
None
        Query:
        Time: 46 ms
        Index: LogEntries/TextBanList
        Results: 2 returned out of 133 total.

Request #  60: GET     -     0 ms - <default>  - 200 - /docs/GameServers/3
Request #  61: GET     -     0 ms - <default>  - 200 - /docs/LogEntries/6
Request #  62: GET     -     0 ms - <default>  - 200 - /docs/GameServers/2
Request #  63: GET     -     0 ms - <default>  - 200 - /docs/LogEntries/3

Great :) No include means it does -another- roundtrip to the DB.

2. With Includes + DocumentStore (say, in an MVC app)
var query = DocumentSession
                .Query<LogEntries_TextBanList.ReduceResultLogEntries_TextBanList>()
                .Customize(x => x.Include("GameServerId"))
                .Customize(x => x.Include("LogEntryId"));

Output:
Request #  81: GET     -    60 ms - <default>  - 200 - /indexes/LogEntries/TextBanList?query=&start=0&pageSize=2&aggregation=
None&include=GameServerId&include=LogEntryId
        Query:
        Time: 46 ms
        Index: LogEntries/TextBanList
        Results: 2 returned out of 133 total.

Nice also.

3. Embbeded Store fails
And when I try that with the Embedded one, it's failing:


So the return results shows me one of the LogEntry's I need to Load. So lets see if it exists?

yep. they exist.

I also did the following: 

var asdsad = results.OrderBy(x => x.LogEntryId).Select(x => x.LogEntryId).ToArray();

and it returned lots of results and all the Id's were in the format: LogEntry/<some number>

and now .. when I goto the next line, I get my 30 max errors...

var bans = (from q in results
            orderby q.CreatedOn
            select new
                    {
                        // snipped //
                        GameServerName = DocumentSession.Load<GameServer>(q.GameServerId).Name,
                        ClientName = DocumentSession.Load<LogEntry>(q.LogEntryId).ClientName,
                        ClientIpAndPort = DocumentSession.Load<LogEntry>(q.LogEntryId).ClientIpAndPort,
                        // snipped //
                    }).ToList();

I just don't get it :(

Works with the DS, not with the Embedded DS.

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2012, 1:16:18 AM4/30/12
to rav...@googlegroups.com
In embedded, includes are ignored, that is why you are seeing this issue.

Justin A

unread,
Apr 30, 2012, 1:27:32 AM4/30/12
to rav...@googlegroups.com
... Previously, on JabbR ...

HAHA!

So .. Embedded ignores Includes. Definitely didn't see that coming! 

So this means when I use embedded mode for testing my controllers ... I have fail :(

So .. would the solution for a -TEST- project (and I want to emphasis the TEST part of that :P) is to set the MaxNumberOfRequestsPerSession to something large?

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2012, 1:50:20 AM4/30/12
to rav...@googlegroups.com
Yes

Oren Eini (Ayende Rahien)

unread,
Apr 30, 2012, 1:50:31 AM4/30/12
to rav...@googlegroups.com
Or run it in a test through the http pipeline

Bryan Johns

unread,
Apr 30, 2012, 7:12:25 PM4/30/12
to rav...@googlegroups.com
In a recent thread where a user was having problems with includes with
embedded Oren said:

> In embedded, includes are ignored...

I'm curious why this is the case. The availability of includes, or lack
thereof, would lead to possibly drastically different decisions in how the
object model was designed. This would make it more difficult for an
application to scale up from embedded to server. Here's a concrete
example:

I've been considering using RavenDB for my personal web site and blog. My
current hosting plan doesn't include any feature that would let me install
RavenDB server so I would start out with embedded. Since includes are not
available in embedded, what would be the best way to model a typical blog
so that if it became popular I could scale up from embedded to a server
with the minimum amount of pain?

--
Bryan Johns
K4GDW

"The unforgivable crime is soft hitting. Do not hit at all if it can be
avoided; but never hit softly." --Theodore Roosevelt
> <http://i.imgur.com/d8Vc3.png>
>
> So the return results shows me one of the LogEntry's I need to
> Load. So lets see if it exists?
>
> <http://i.imgur.com/utpzS.png>
>
> <http://i.imgur.com/wRqzT.png>

Oren Eini (Ayende Rahien)

unread,
May 1, 2012, 12:09:29 AM5/1/12
to rav...@googlegroups.com
Bryan,
Basically, as designed, Includes are merely a way to reduce number of request to the server. When you are running in embedded, you are not making any requests to the server.
That is why we ignore it.

Note that there are already tickets open to support lazy & include using embedded.
Reply all
Reply to author
Forward
0 new messages