Duplicate/Missing Records
When the response is large spanning over multiple pages, we can see duplicate records. This also causes some of the records to be missing.
Assemblies affected
OData WebApi lib 6.1.0
Expected result
There should be no duplicate/missing records
Actual result
Some records are missing. And some records are duplicated. The duplicates are in different pages.
Is the underyling data being updated, perhaps by a different process, during the course of fetching? This can cause duplicate/missed records if the paging is implemented using top/skip. A better implementation (which we should apply to WebAPI OData) would be to build a query that fetches records beyond the last record retrieved by value, rather than by position.
No, the underlying data is not updated. The Pagination is being achieved by setting the ODataQuerySettings. But I noticed that, if the query has 1 or 2 orderby queries, there are no more missing/duplicate records. So, we are using that as an interim solution. But, I believe this issue is coming from the ODATA library and should be fixed.
Any updates on this? seems its long time but here we are in June 2019 and we just observed this strange behavior ..not sure how long we can trust Odata paging mechanism.
I even tried appending explicit order by clause just in case thats done different in every next page metadata URL request but again not quite sure how its been persisted up to DB between multiple requests. we have max limit of 100 records which means for 10000 records results in 100 page results.
Long story short ; records are duplicated and its disappointing to even think to go back w/ odata
@anilraut30 value based paging will be available with the next WebAPI release. Can you share your code where you are appending the additional clause? If it is not part of the request then it will not get carry forwarded to the nextlink.
@KanishManuja-MS I'm just appending $count=true just to cross validate the records and there is no specific filter or order need as such as long as we get all records and no duplicate and no missing records in final consolidated unique set. The problem is record set is huge and logic makes hundreds of next page Odata requests , appends to List and then dump into csv file
Also, tried using appending orderby filter on key parameter - still the same issue.
Interestingly when I created unique hashset of keys in-memory , then I get unique records but them many hundred records goes missing which means duplicates aren't extra but replacing legitimate unique records going missing
what do you suggest - cross check EF Core Queries been executed for every next-page its executing against database?