kocolosk commented on issue #3750: URL: https://github.com/apache/couchdb/issues/3750#issuecomment-920902849
I don't have a complete answer for that one. You probably noticed that the values show up in a consistent order with q=1, so it has something to do with the way that rows from different shards are collated in the coordinator. We do that by merging each incoming row into a sorted list of rows from all shards using the standard ejson comparator function [here](https://github.com/apache/couchdb/blob/3.x/src/fabric/src/fabric_view_map.erl#L192-L200). That merge implementation seems to preserve the "arrival order" when inserting rows that compare equal, but if it did not I think we'd have our culprit. When q=1 we are sending rows out as soon as we get them, but when q>1 the coordinator might end up reordering equal rows from the same shard in that list while waiting for at least one row from all the other shards. I still think that's probably the spot where this reordering is happening, just can't prove it yet. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
