Teach fabric_util:get_db/2 about maintenance mode

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
2 files changed
tree: 198966ab09e42f50045b841d91db3b405b0161d0
  1. README.md
  2. include/
  3. priv/
  4. rebar.config
  5. src/
README.md

fabric

Fabric is a collection of proxy functions for CouchDB operations in a cluster. These functions are used in BigCouch as the remote procedure endpoints on each of the cluster nodes.

For example, creating a database is a straightforward task in standalone CouchDB, but for BigCouch, each node that will store a shard for the database needs to receive and execute a fabric function. The node handling the request also needs to compile the results from each of the nodes and respond accordingly to the client.

Fabric is used in conjunction with ‘Rexi’ which is also an application within BigCouch.

Getting Started

Fabric requires R13B03 or higher and can be built with rebar, which comes bundled in the repository.

License

Apache 2.0

Contact