diff options
author | Damien F. Katz <damien@apache.org> | 2010-06-23 19:11:50 +0000 |
---|---|---|
committer | Damien F. Katz <damien@apache.org> | 2010-06-23 19:11:50 +0000 |
commit | feb18bd6efc40126bdb4af390419223e10ef134d (patch) | |
tree | 0833e401ab28327acf5f377bb929fe8d351502c8 /src/couchdb/couch_file.erl | |
parent | 918f8bf54a4aeffc3c0ef4ad1fa31ce93bbc1346 (diff) |
Authentication caching, to avoid repeated opening and closing of the users database for each request requiring authentication. COUCHDB-807
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@957314 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_file.erl')
-rw-r--r-- | src/couchdb/couch_file.erl | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index fe524e24..8c82272d 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -231,16 +231,14 @@ init({Filepath, Options, ReturnPid, Ref}) -> {ok, 0} = file:position(Fd, 0), ok = file:truncate(Fd), ok = file:sync(Fd), - couch_stats_collector:track_process_count( - {couchdb, open_os_files}), + maybe_track_open_os_files(Options), {ok, #file{fd=Fd}}; false -> ok = file:close(Fd), init_status_error(ReturnPid, Ref, file_exists) end; false -> - couch_stats_collector:track_process_count( - {couchdb, open_os_files}), + maybe_track_open_os_files(Options), {ok, #file{fd=Fd}} end; Error -> @@ -252,7 +250,7 @@ init({Filepath, Options, ReturnPid, Ref}) -> {ok, Fd_Read} -> {ok, Fd} = file:open(Filepath, [read, append, raw, binary]), ok = file:close(Fd_Read), - couch_stats_collector:track_process_count({couchdb, open_os_files}), + maybe_track_open_os_files(Options), {ok, Length} = file:position(Fd, eof), {ok, #file{fd=Fd, eof=Length}}; Error -> @@ -260,6 +258,13 @@ init({Filepath, Options, ReturnPid, Ref}) -> end end. +maybe_track_open_os_files(FileOptions) -> + case lists:member(sys_db, FileOptions) of + true -> + ok; + false -> + couch_stats_collector:track_process_count({couchdb, open_os_files}) + end. terminate(_Reason, _Fd) -> ok. |