ChristopherRabotin / bungiesearch

UNMAINTAINED CODE -- Elasticsearch-dsl-py django wrapper with mapping generator
BSD 3-Clause "New" or "Revised" License
68 stars 20 forks source link

sort model_items queryset by PK when indexing #130

Closed terite closed 8 years ago

terite commented 8 years ago

While indexing objects, mutltiple queries are made with offsets and limits. Without an explicit order, multiple queries can potentially return the same rows. This is likely to happen if there are other database writes happening during indexing.

Ordering unordered querysets by primary key will help avoid models missing from the index

If you have any idea how to test this, I'm all ears.

diwu1989 commented 8 years ago

this one is actually fairly important to production at-scale usage, would definitely like to see this one merged

ChristopherRabotin commented 8 years ago

That's is actually a very good point you raise. At @Sparrho we would actually manually request the ordering but having it embedded is better.