couchdb icon indicating copy to clipboard operation
couchdb copied to clipboard

enhance smoosh to cleanup search indexes when ddocs change

Open rnewson opened this issue 2 years ago • 4 comments

Overview

automate cleaning up search indexes (clouseau and nouveau) when design documents are updated.

Testing recommendations

TBD

Related Issues or Pull Requests

N/A

Checklist

  • [x] Code is written and works correctly
  • [ ] Changes are covered by tests
  • [ ] Any new configurable parameters are documented in rel/overlay/etc/default.ini
  • [ ] Documentation changes were made in the src/docs folder
  • [ ] Documentation changes were backported (separated PR) to affected branches

rnewson avatar Aug 04 '23 18:08 rnewson

I need to add tests to this and intend to, just wanted to show the work so far.

rnewson avatar Aug 04 '23 18:08 rnewson

Overall this looks like what we would want to happen: as soon as we update the ddoc we can clean up the old index data.

With the ddoc trigger one thing I was worried about is the case when we get a ddoc_updated on one node first, and not the others yet: we make a clustered call to get all the ddocs and get the signatures, what if that's stale since it happens concurrently with the ddoc_updated, would there be a chance we'd remove the new index file we just created? Maybe it's a low enough chance of happening that it's not a problem as long as it eventually sorts itself out. (We delete the newly building index file but then it gets rebuilt quickly anyway).

nickva avatar Aug 07 '23 15:08 nickva

that's an excellent point, we must ensure that cannot happen, at least not with any higher probability than the existing cleanup code for mrview.

rnewson avatar Aug 07 '23 15:08 rnewson

that's an excellent point, we must ensure that cannot happen, at least not with any higher probability than the existing cleanup code for mrview.

We could punt changing the trigger mechanism for later and just opt to run the nouveau and dreyfus cleanup as is, alongside mrview indexes?

nickva avatar Aug 17 '23 23:08 nickva