Has anyone had a M/R script process the same resul...
# suitescript
c
Has anyone had a M/R script process the same result twice? I have verified the number of getInputData records and it matches the summarize count. One record out of 5,674 ran twice and a separate single record was skipped. This seems like a very odd underlying bug.
a
are you just returning a search / query from your GID stage?
c
Just a query.
a
you're not preloading the results and paginating it yourself or something?
you have an orderby in your query? ๐Ÿ™‚
c
Copy code
return {
	type: 'suiteql',
	query: qry,
	params: [date]
};
No order by...
a
so idk what exactly it does to initiate the map stages, but given that they only like to handle 1k/4k results at once and you have > 4k that would make me suspicious of it
if its effectively running the query twice to get 2x4k up to results it might be switching up the order slightly and so one of the first 4k landed in the 2nd 4k and vice versa
i think orderby internalid or equivalent would hopefully fix that
i'm totally guessing though, i have no definitive info on this
c
I'll give the
order by
a shot, there is a complicated
group by
on the query, if the underlying system is paginating the stage and the db isn't returning the same exact result order for some reason I suppose it's possible that it dups a record.
a
ugh yeah group by I assume is handled similarly to summary saved searches which do tend to just have more weird issues
m
How does your M/R handle server restarts?
k
@Chris have reviewed the query results to make sure the one of the results isnโ€™t in there twice?
c
@michoel It doesn't handle server restarts. I'll look into that. In this particular event, the duplicated events happened in the same second on the timeline. However, I'm not sure what the cpu clock does during a restart. If the clock pauses during a restart, this might be the issue.
@Keith Fetterman Yeah, I went through the getInputData query multiple times thinking I had a duplicate.
s
I've seen this duplicates problem with the 'paged' apis in other script types.
๐Ÿ’ฏ 1
j
I have had results appear last on page one and first one page two (and another result end up missing) when doing an order by in a saved search where two results would have the same place in the order. e.g. if ordering by number and the results are 1, 2(a), 2(b), 3, I got on page one 1 and 2(a), and on page two 2(a) and 3 (no sign of 2(b) anywhere). This was several years back though and in the UI. It makes me not trust their ordering / pagination tho.
c
Forcing the result set into a specific order seems to have worked. An identical re-run didn't have the error.
๐Ÿ™Œ 3
Adding an
order by
also seems to speed things up quite a bit.