-
Notifications
You must be signed in to change notification settings - Fork 135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MaxNodeCount exceeded #579
Comments
Hi, I think you could find a little more help in https://github.com/OData/WebApi/ since Restier is depending on that for queries. Also there is a chance that this is a bug (just a random thought) |
Hi, Figures it's not a bug. Long story short, for an expression like "(Id eq 1) or (Id eq 2) or (Id eq 3)" Thus you touch the limit of 100 nodes by using 20 ORs (20*5-1=99), i.e. by fetching only 20 IDs TLDR:
This way expression "Id eq 1" is:
When you add them up with "OR" operator, like "Id eq 1 or Id eq 2", you get:
So the sequences is:
Resulting formula for n > 0: 4 x (n - 1) + (n - 2) = 5n-1, where n is a number of OR operators |
@Eddy-Shterenberg Thank you for the explanation. |
According to Eddy-Shterenberg's explanation 4 x (n - 1) + (n - 2) = 5n - 6, where a n is number operand sets of filter (number of OR operators is (n - 2)). If n is a number of filter values then the formula becomes 4 x n + (n - 1) = 5n - 1 But research was very useful! Thanks! |
I'm going to go ahead and close this since it's not a bug, but we'll document the issue for people that run across the error in the future. Thanks! :) |
I'm having basically the same problem as #545 in a .NET BreezeJS app, but that resolution doesn't really make sense to me. I would rather avoid the problem altogether than just raise the limit until it gets hit again. I also don't understand why it's happening in the first place.
There aren't 100 nodes in that query, or mine, so how does the limit get hit, or what does "node" mean? This says it's the number of nodes in the filter tree:
https://msdn.microsoft.com/en-us/library/system.web.http.odata.query.odatavalidationsettings.maxnodecount(v=vs.118).aspx
But, in my query, with only 16 "or Id = x" clauses and a 17th "& OtherId = x" clause, 17 total, I wouldn't expect to hit a 100 node limit. Perhaps worse, I can't predict it, since it doesn't seem to make sense; e.g. I can't do "if I have X IDs to look up, do it differently", since I can't determine what X should be, since it doesn't seem to add up or match the limit as far as I can tell. If I raise it from 100 to 200, does that mean I can actually do 34? o_O
I've got to be missing something...
Edit: Yep! A 200 limit lets me do 34 IDs. I suppose I could raise it to a limit of 1000 to get 100 IDs.
I wonder if it is including expansions in the node list, like if the ID I'm looking up is on a child entity, even though it's a root-level property in my view model, but in EF it's on a child, it's including those "nodes"...
The text was updated successfully, but these errors were encountered: