summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_server.erl
diff options
context:
space:
mode:
authorDamien F. Katz <damien@apache.org>2009-05-06 19:11:10 +0000
committerDamien F. Katz <damien@apache.org>2009-05-06 19:11:10 +0000
commit4b5e0a20aa087dd26df644c0432627aa3e5826d4 (patch)
tree1494b164fdef4004bff44aa39edbc2f1bf60d8f3 /src/couchdb/couch_server.erl
parent887c9b1a8b551272c3ca06906cfdc4fb901830a8 (diff)
First cut at _changes api. Update the by_id and by_seq indexes to contain update seq numbers and pointers to bodies on disk, for use in the _changes api. This is a new file version, but the code can continue to serve the old 0.9 version without problems, though certain features in the _changes api will not be able to work. Upgrade to new file version (from 1 to 2) by compacting the file. Also fixed bugs with how the stats api tracks open databases.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@772406 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_server.erl')
-rw-r--r--src/couchdb/couch_server.erl7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/couchdb/couch_server.erl b/src/couchdb/couch_server.erl
index 870d0d76..c1908629 100644
--- a/src/couchdb/couch_server.erl
+++ b/src/couchdb/couch_server.erl
@@ -183,8 +183,7 @@ maybe_close_lru_db(#server{dbs_open=NumOpen, max_dbs_open=MaxOpen}=Server)
maybe_close_lru_db(#server{dbs_open=NumOpen}=Server) ->
% must free up the lru db.
case try_close_lru(now()) of
- ok ->
- couch_stats_collector:decrement({couchdb, open_databases}),
+ ok ->
{ok, Server#server{dbs_open=NumOpen - 1}};
Error -> Error
end.
@@ -238,7 +237,6 @@ handle_call({open, DbName, Options}, _From, Server) ->
true = ets:insert(couch_dbs_by_pid, {MainPid, DbName}),
true = ets:insert(couch_dbs_by_lru, {LruTime, DbName}),
DbsOpen = Server2#server.dbs_open + 1,
- couch_stats_collector:increment({couchdb, open_databases}),
{reply, {ok, MainPid},
Server2#server{dbs_open=DbsOpen}};
Error ->
@@ -274,7 +272,6 @@ handle_call({create, DbName, Options}, _From, Server) ->
true = ets:insert(couch_dbs_by_pid, {MainPid, DbName}),
true = ets:insert(couch_dbs_by_lru, {LruTime, DbName}),
DbsOpen = Server2#server.dbs_open + 1,
- couch_stats_collector:increment({couchdb, open_databases}),
couch_db_update_notifier:notify({created, DbName}),
{reply, {ok, MainPid},
Server2#server{dbs_open=DbsOpen}};
@@ -304,7 +301,6 @@ handle_call({delete, DbName, _Options}, _From, Server) ->
true = ets:delete(couch_dbs_by_name, DbName),
true = ets:delete(couch_dbs_by_pid, Pid),
true = ets:delete(couch_dbs_by_lru, LruTime),
- couch_stats_collector:decrement({couchdb, open_databases}),
Server#server{dbs_open=Server#server.dbs_open - 1}
end,
case file:delete(FullFilepath) of
@@ -334,7 +330,6 @@ handle_info({'EXIT', Pid, _Reason}, #server{dbs_open=DbsOpen}=Server) ->
true = ets:delete(couch_dbs_by_pid, Pid),
true = ets:delete(couch_dbs_by_name, DbName),
true = ets:delete(couch_dbs_by_lru, LruTime),
- couch_stats_collector:decrement({couchdb, open_databases}),
{noreply, Server#server{dbs_open=DbsOpen - 1}};
handle_info(Info, _Server) ->
exit({unknown_message, Info}).