cabify/couchdb-admin

remove_node command check system databases

vitovitolo opened this issue · 0 comments

Problem

In CouchDB system dbs and docs starts with an underscore (eg: _id, _rev, _global_changes, _replicator, _users, etc).

The command remove_node retrieves all databases in a CouchDB custer in order to check it's shards.

For some reason the command couldn't finish properly throwing an error

# couchdb-admin --server node1.example.com --admin user --password xxxx remove_node --node node1.example.com
2018/01/10 15:36:43  info Removing node...          node=node1.example.com
2018/01/10 15:36:43  info Checking that node does not own any shard... node=couchdb@node1.example.com
2018/01/10 15:36:43 error Couldn't remove node!     error=Could not access the _global_changes database node=node1.example.com

The user has admin privileges in CouchDB.

Proposals

  • Filter system databases when retrieve /_all_dbs endpoint before checking it's shard.
  • Delete shard checking when deleting a node: sometimes it's don't necessary remove all it's shards first