couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rnew...@apache.org
Subject git commit: Log problems opening database at ERROR level except for auto-created system dbs
Date Fri, 23 Mar 2012 14:06:55 GMT
Updated Branches:
  refs/heads/log_db_open_errors_as_errors [created] 1d13adcdc


Log problems opening database at ERROR level except for auto-created system dbs


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

Branch: refs/heads/log_db_open_errors_as_errors
Commit: 1d13adcdcc9e31b80c8c2c4d84bddbe8452e20ec
Parents: ba8fa86
Author: Robert Newson <rnewson@apache.org>
Authored: Fri Mar 23 14:06:22 2012 +0000
Committer: Robert Newson <rnewson@apache.org>
Committed: Fri Mar 23 14:06:22 2012 +0000

----------------------------------------------------------------------
 src/couchdb/couch_auth_cache.erl          |    2 +-
 src/couchdb/couch_db.erl                  |    2 +-
 src/couchdb/couch_file.erl                |    8 ++++++--
 src/couchdb/couch_replication_manager.erl |    2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/1d13adcd/src/couchdb/couch_auth_cache.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_auth_cache.erl b/src/couchdb/couch_auth_cache.erl
index 94adac8..c2472fd 100644
--- a/src/couchdb/couch_auth_cache.erl
+++ b/src/couchdb/couch_auth_cache.erl
@@ -371,7 +371,7 @@ get_user_props_from_db(UserName) ->
     ).
 
 ensure_users_db_exists(DbName, Options) ->
-    Options1 = [{user_ctx, #user_ctx{roles=[<<"_admin">>]}} | Options],
+    Options1 = [{user_ctx, #user_ctx{roles=[<<"_admin">>]}}, nologifmissing |
Options],
     case couch_db:open(DbName, Options1) of
     {ok, Db} ->
         ensure_auth_ddoc_exists(Db, <<"_design/_auth">>),

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1d13adcd/src/couchdb/couch_db.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl
index 2b45dd8..aabdb01 100644
--- a/src/couchdb/couch_db.erl
+++ b/src/couchdb/couch_db.erl
@@ -50,7 +50,7 @@ open_db_file(Filepath, Options) ->
     {error, enoent} ->
         % couldn't find file. is there a compact version? This can happen if
         % crashed during the file switch.
-        case couch_file:open(Filepath ++ ".compact") of
+        case couch_file:open(Filepath ++ ".compact", [nologifmissing]) of
         {ok, Fd} ->
             ?LOG_INFO("Found ~s~s compaction file, using as primary storage.", [Filepath,
".compact"]),
             ok = file:rename(Filepath ++ ".compact", Filepath),

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1d13adcd/src/couchdb/couch_file.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl
index 191225c..2128d80 100644
--- a/src/couchdb/couch_file.erl
+++ b/src/couchdb/couch_file.erl
@@ -58,8 +58,12 @@ open(Filepath, Options) ->
             {trap_exit, true} -> receive {'EXIT', Pid, _} -> ok end;
             {trap_exit, false} -> ok
             end,
-            ?LOG_DEBUG("Could not open file ~s: ~s",
-                [Filepath, file:format_error(Reason)]),
+            case {lists:member(nologifmissing, Options), Reason} of
+            {true, enoent} -> ok;
+            _ ->
+            ?LOG_ERROR("Could not open file ~s: ~s",
+                [Filepath, file:format_error(Reason)])
+            end,
             Error
         end;
     Error ->

http://git-wip-us.apache.org/repos/asf/couchdb/blob/1d13adcd/src/couchdb/couch_replication_manager.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_replication_manager.erl b/src/couchdb/couch_replication_manager.erl
index 7b998a8..0bdb7c6 100644
--- a/src/couchdb/couch_replication_manager.erl
+++ b/src/couchdb/couch_replication_manager.erl
@@ -572,7 +572,7 @@ zone(Hr, Min) ->
 ensure_rep_db_exists() ->
     DbName = ?l2b(couch_config:get("replicator", "db", "_replicator")),
     UserCtx = #user_ctx{roles = [<<"_admin">>, <<"_replicator">>]},
-    case couch_db:open_int(DbName, [sys_db, {user_ctx, UserCtx}]) of
+    case couch_db:open_int(DbName, [sys_db, {user_ctx, UserCtx}, nologifmissing]) of
     {ok, Db} ->
         Db;
     _Error ->


Mime
View raw message