nickva opened a new pull request, #6032:
URL: https://github.com/apache/couchdb/pull/6032

   The idea of doc/shard grouping and rotation was that different databases 
would start their workers on different copies, spread those uniformly and 
consistently by `{Range, DbName}`.
   
   However, the order of entries were actually dependent on `dict:to_list/1` 
internals. So, if `dict` was changed to return sorted items, like for instance 
maps do, we'd end up suddently breaking the supposedly randomized spread (I 
found this out by actually trying to use a map there instead of a dict).
   
   To fix this, make the rotation explicit. Group the entries first, then sort 
each group, and then rotate by `{Range, DbName}`.
   
   While at it make it so we don't have to duplicate the main rotate function 
in tests and use the actual function we intend to test.
   
   Add some explicit tests for this behavior. One downside is those tests rely 
on the exact rotate_list/2 implementation (`crc32(?term_to_binary/1`) so if 
that changes we'll know and have to update the test.
   


-- 
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]

Reply via email to