You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2015/04/24 01:50:51 UTC
[1/2] couchdb-cassim git commit: Handle deleted and other unexpected
responses
Repository: couchdb-cassim
Updated Branches:
refs/heads/2657-fix-cassim-fabric-calls 0c3f04509 -> 47ed4c461
Handle deleted and other unexpected responses
Project: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/commit/e67d7ee6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/tree/e67d7ee6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/diff/e67d7ee6
Branch: refs/heads/2657-fix-cassim-fabric-calls
Commit: e67d7ee66ba49e027e1a20c140499b3b15ccda09
Parents: 0c3f045
Author: Russell Branca <ch...@apache.org>
Authored: Thu Apr 23 23:45:28 2015 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Thu Apr 23 23:45:28 2015 +0000
----------------------------------------------------------------------
src/cassim_metadata_cache.erl | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/e67d7ee6/src/cassim_metadata_cache.erl
----------------------------------------------------------------------
diff --git a/src/cassim_metadata_cache.erl b/src/cassim_metadata_cache.erl
index b6ad486..12f2a06 100644
--- a/src/cassim_metadata_cache.erl
+++ b/src/cassim_metadata_cache.erl
@@ -195,17 +195,25 @@ load_meta_from_db(DbName, MetaId) ->
Args = [DbName, MetaId, []],
Timeout = cache_timeout(),
case couch_util:with_proc(fabric, open_doc, Args, Timeout) of
- {ok, {ok, Doc}} ->
+ {ok, {ok, #doc{}=Doc}} ->
couch_doc:to_json_obj(Doc, []);
+ {ok, {not_found, deleted}} ->
+ deleted;
{ok, {not_found, missing}} ->
undefined;
{error, {database_does_not_exist, _}} ->
undefined;
{error, timeout} ->
- couch_log:notice("timeout retrieving metadata doc ~s", [MetaId]),
+ couch_log:notice(
+ "timeout retrieving metadata doc [~s/]~s",
+ [DbName, MetaId]
+ ),
{error, timeout};
- {error, Error} ->
- {error, Error}
+ Resp ->
+ couch_log:notice(
+ "unexpected response retrieving metadata doc [~s/]~s: ~s",
+ [DbName, MetaId, Resp]),
+ {error, Resp}
end.
[2/2] couchdb-cassim git commit: Add get_security retry logic for
handling conflicts
Posted by ch...@apache.org.
Add get_security retry logic for handling conflicts
Project: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/commit/47ed4c46
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/tree/47ed4c46
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-cassim/diff/47ed4c46
Branch: refs/heads/2657-fix-cassim-fabric-calls
Commit: 47ed4c4619b4be547d3804f33218ed32261167c3
Parents: e67d7ee
Author: Russell Branca <ch...@apache.org>
Authored: Thu Apr 23 23:50:18 2015 +0000
Committer: Russell Branca <ch...@apache.org>
Committed: Thu Apr 23 23:50:18 2015 +0000
----------------------------------------------------------------------
src/cassim_security.erl | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-cassim/blob/47ed4c46/src/cassim_security.erl
----------------------------------------------------------------------
diff --git a/src/cassim_security.erl b/src/cassim_security.erl
index 796cd67..c094c85 100644
--- a/src/cassim_security.erl
+++ b/src/cassim_security.erl
@@ -52,14 +52,30 @@ get_security(DbName, Options) ->
end.
-get_security_doc(DbName0) when is_binary(DbName0) ->
+get_security_doc(DbName) when is_binary(DbName) ->
+ RetryCnt = config:get_integer("cassim", "get_security_retries", 3),
+ get_security_doc(DbName, RetryCnt).
+
+
+get_security_doc(DbName, RetryCnt) when RetryCnt =< 0 ->
+ couch_log:error(
+ "Exhausted retry limit loading security doc for db ~s", [DbName]
+ ),
+ throw({retries_limit_exhaused, "Exhaused security doc retry limit"});
+get_security_doc(DbName0, RetryCnt) ->
DbName = mem3:dbname(DbName0),
MetaId = cassim_metadata_cache:security_meta_id(DbName),
case cassim_metadata_cache:load_meta(MetaId) of
undefined ->
SecProps = fabric:get_security(DbName),
- {ok, SecDoc} = migrate_security_props(DbName, SecProps),
- SecDoc;
+ try migrate_security_props(DbName, SecProps) of
+ {ok, SecDoc} ->
+ SecDoc
+ catch conflict ->
+ get_security_doc(DbName0, RetryCnt-1)
+ end;
+ %% TODO: handle deleted case?
+ %% deleted ->
{error, Error} ->
throw(Error);
SecProps ->