cloudant/fabric — pull request #156 by mikewallace1979 (2014-09-11 11:15:23+00:00)
Title: Teach fabric_util:get_db/2 about maintenance mode

This commit is a backport of:

- 88ff6d323f904425f5130a237ce712b68ac70dfb

From:

- https://git-wip-us.apache.org/repos/asf/couchdb-fabric.git

BugzID: 34360

If the node servicing a request does not have a shard for the db
involved then fabric_util:get_db/2 can return a shard from a node
which is in maintenance mode. If that node is a replacement node
that has not yet been brought into the cluster then the security
object will be empty.

Because fabric:get_security/2 calls fabric_util:get_db/2 and is in
the code path for authorizing requests at the HTTP layer, this can
result in live nodes returning 403s.

This commit replaces an rpc:call/4 with a rexi:cast/4 and adds
a new rpc endpoint in fabric_rpc for opening single shards. This
uses set_io_priority which will reply with a rexi_EXIT if
maintenance mode is set.

Closes COUCHDB-2325