I asked a question here about fast inventory updates last week and I was recommended to use docValues with partial in-place updates. I think this will work well, but there is a problem I can't think of a good solution for.
Consider this scenario: InStock = 1 for a product. InStock changes to 0 which triggers a fast in-place update with docValues. But it also triggers a slow update that will rebuild the entire document. Let's say that takes 10 minutes because we do updates in batches. During that 5 minutes, InStock changes again to 1 which triggers a fast update to solr. So in Solr InStock=1 which is correct. The slow update finishes and overwrites InStock=0 which is incorrect. How can we deal with this situation?