You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/09/30 18:29:40 UTC

fabric commit: updated refs/heads/master to f657a4c

Repository: couchdb-fabric
Updated Branches:
  refs/heads/master abec3c4ca -> f657a4c21


Return unauthorized error if encountered on any shard

We had a mismatch here that caused us to return an unpleasant 500
status code (after discarding lots of unauthorized events from each
shard).

The mismatch was introduced in "Teach fabric_util:get_db/2 about maintenance
mode".

I also simplified the open_shard function and tuple syntax for further
clarity in this critical section.


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/f657a4c2
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/f657a4c2
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/f657a4c2

Branch: refs/heads/master
Commit: f657a4c211d9f7e916be6e721a7474216e61a1e5
Parents: abec3c4
Author: Robert Newson <rn...@apache.org>
Authored: Tue Sep 30 17:24:59 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Sep 30 17:28:51 2014 +0100

----------------------------------------------------------------------
 src/fabric_rpc.erl  | 7 +------
 src/fabric_util.erl | 4 ++--
 2 files changed, 3 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/f657a4c2/src/fabric_rpc.erl
----------------------------------------------------------------------
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index b0b7776..cb25d7c 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -223,12 +223,7 @@ reset_validation_funs(DbName) ->
 
 open_shard(Name, Opts) ->
     set_io_priority(Name, Opts),
-    case couch_db:open(Name, Opts) of
-        {ok, Db} ->
-            rexi:reply({ok, {ok, Db}});
-        Error ->
-            rexi:reply(Error)
-    end.
+    rexi:reply(couch_db:open(Name, Opts)).
 
 %%
 %% internal

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/f657a4c2/src/fabric_util.erl
----------------------------------------------------------------------
diff --git a/src/fabric_util.erl b/src/fabric_util.erl
index 52cb496..c5249d1 100644
--- a/src/fabric_util.erl
+++ b/src/fabric_util.erl
@@ -180,9 +180,9 @@ get_shard([#shard{node = Node, name = Name} | Rest], Opts, Timeout, Factor) ->
     MFA = {fabric_rpc, open_shard, [Name, [{timeout, Timeout} | Opts]]},
     Ref = rexi:cast(Node, self(), MFA, [sync]),
     try
-        receive {Ref, {ok, {ok, Db}}} ->
+        receive {Ref, {ok, Db}} ->
             {ok, Db};
-        {Ref, {ok, {unauthorized, _} = Error}} ->
+        {Ref, {'rexi_EXIT', {{unauthorized, _} = Error, _}}} ->
             throw(Error);
         {Ref, _Else} ->
             get_shard(Rest, Opts, Timeout, Factor)