Ensure doc groups are sorted before merging them
Ensure doc groups are sorted before merging them

We had been implicitly assuming that clients send us sorted groups, but
unsurprisingly that's not always the case. The additional sorting here
should be redundant, but the consequences of merging unsorted groups are
severe -- we can end up with uniqueness violations on the primary key in
the database -- and so we add an additional sort here.

COUCHDB-2735

ngpestelos/couchdb-couch,ngpestelos/couchdb-couch,fkaempfer/couchdb,cloudant/couchdb-couch,KlausTrainer/couchdb-couch,smithsz/couchdb-couch,cloudant/couchdb-couch,fkaempfer/couchdb,smithsz/couchdb-couch,fkaempfer/couchdb,fkaempfer/couchdb,ngpestelos/couchdb-couch,apache/couchdb-couch,alanning/couchdb-couch,fkaempfer/couchdb,alanning/couchdb-couch,KlausTrainer/couchdb-couch,smithsz/couchdb-couch,apache/couchdb-couch,alanning/couchdb-couch,KlausTrainer/couchdb-couch,cloudant/couchdb-couch,apache/couchdb-couch,fkaempfer/couchdb