couchdb icon indicating copy to clipboard operation
couchdb copied to clipboard

Fix: Ken drops databases on nodedown

Open Harshit-jain-57 opened this issue 3 weeks ago • 0 comments

Description

This PR fixes an issue where Ken (the background indexer) would drop a database from its indexing queue if fabric:design_docs/1 returned a nodedown or maintenance_mode error.

Previously, these errors were caught and treated as an empty list of design documents ({ok, []}), causing Ken to believe there was nothing to index and removing the database from the pending queue.

Changes

  • Modified ken_server:design_docs/1 to propagate {error, {nodedown, ...}} and {error, {maintenance_mode, ...}} instead of swallowing them.
  • Modified ken_server:update_db_indexes/2 to handle these specific errors by exiting with resubmit. This triggers Ken's built-in retry mechanism, ensuring the database is added back to the queue to be retried later.

Testing

  • Added a reproduction test case in src/ken/test/ken_repro_test.erl (if applicable to include in PR).
  • Verified that nodedown errors now trigger a resubmit instead of a silent drop.

Fixes #5392<!-- Thank you for your contribution!

 Please file this form by replacing the Markdown comments
 with your text. If a section needs no action - remove it.

 Also remember, that CouchDB uses the Review-Then-Commit (RTC) model
 of code collaboration. Positive feedback is represented +1 from committers
 and negative is a -1. The -1 also means veto, and needs to be addressed
 to proceed. Once there are no objections, the PR can be merged by a
 CouchDB committer.

 See: http://couchdb.apache.org/bylaws.html#decisions for more info. -->

Overview

Testing recommendations

Related Issues or Pull Requests

Checklist

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

Harshit-jain-57 avatar Dec 04 '25 18:12 Harshit-jain-57