summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2012-03-23 14:06:22 +0000
committerRobert Newson <rnewson@apache.org>2012-11-13 13:32:42 +0000
commitbbb6b95d64278dc64beb165c53e7f81bc0c9a79e (patch)
treef72264576453c1d735fec6523ebb9507eb4ad173
parent5dbd53babd8523254c85d0e833fd14e713c441d1 (diff)
downloadcouchdb-bbb6b95d64278dc64beb165c53e7f81bc0c9a79e.tar.gz
Log problems opening database at ERROR level except for auto-created system dbs
-rw-r--r--src/couch_replicator/src/couch_replicator_manager.erl2
-rw-r--r--src/couchdb/couch_auth_cache.erl2
-rw-r--r--src/couchdb/couch_db.erl2
-rw-r--r--src/couchdb/couch_file.erl8
4 files changed, 9 insertions, 5 deletions
diff --git a/src/couch_replicator/src/couch_replicator_manager.erl b/src/couch_replicator/src/couch_replicator_manager.erl
index 15d625545..fec44df6e 100644
--- a/src/couch_replicator/src/couch_replicator_manager.erl
+++ b/src/couch_replicator/src/couch_replicator_manager.erl
@@ -579,7 +579,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 ->
diff --git a/src/couchdb/couch_auth_cache.erl b/src/couchdb/couch_auth_cache.erl
index f90a5bef2..42ccd4436 100644
--- a/src/couchdb/couch_auth_cache.erl
+++ b/src/couchdb/couch_auth_cache.erl
@@ -386,7 +386,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">>),
diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl
index 81e97f2fe..96f6719b0 100644
--- a/src/couchdb/couch_db.erl
+++ b/src/couchdb/couch_db.erl
@@ -51,7 +51,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),
diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl
index e00b0f002..54ff69346 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 ->