From 594e19a52490629bd2e538161a2e1b1ccb29a833 Mon Sep 17 00:00:00 2001 From: Paul Joseph Davis Date: Tue, 13 Oct 2009 23:13:16 +0000 Subject: Add more information to the view info objects. View info is available at the URL: http://127.0.0.1:5984/db_name/_design/ddocid/_info New fields include: updater_running [true|false] : Whether the view is being built waiting_commit [true|false] : Whether this view is a head of db commits waiting_clients [integer] : How many clients are waiting on this view update_seq [integer] : The update sequence that has been indexed purge_seq [integer] : The purge sequence that has been processed Other fields for reference: signature [string] : The md5 signature of the design document's functions language [string] : The language of the design document disk_size [integer] : Number of bytes the view file occupies on disk compact_running [boolean] : Whether the view is currently being compacted git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@824970 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_view_group.erl | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) (limited to 'src/couchdb/couch_view_group.erl') diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl index 2a757c55..6589bc6a 100644 --- a/src/couchdb/couch_view_group.erl +++ b/src/couchdb/couch_view_group.erl @@ -145,11 +145,8 @@ handle_call({request_group, RequestSeq}, From, waiting_list=[{From, RequestSeq}|WaitList] }, infinity}; -handle_call(request_group_info, _From, #group_state{ - group = Group, - compactor_pid = CompactorPid - } = State) -> - GroupInfo = get_group_info(Group, CompactorPid), +handle_call(request_group_info, _From, State) -> + GroupInfo = get_group_info(State), {reply, {ok, GroupInfo}, State}. handle_cast({start_compact, CompactFun}, #group_state{compactor_pid=nil} @@ -467,17 +464,32 @@ open_db_group(DbName, GroupId) -> Else end. -get_group_info(#group{ +get_group_info(State) -> + #group_state{ + group=Group, + updater_pid=UpdaterPid, + compactor_pid=CompactorPid, + waiting_commit=WaitingCommit, + waiting_list=WaitersList + } = State, + #group{ fd = Fd, sig = GroupSig, - def_lang = Lang - }, CompactorPid) -> + def_lang = Lang, + current_seq=CurrentSeq, + purge_seq=PurgeSeq + } = Group, {ok, Size} = couch_file:bytes(Fd), [ {signature, ?l2b(hex_sig(GroupSig))}, {language, Lang}, {disk_size, Size}, - {compact_running, CompactorPid /= nil} + {updater_running, UpdaterPid /= nil}, + {compact_running, CompactorPid /= nil}, + {waiting_commit, WaitingCommit}, + {waiting_clients, length(WaitersList)}, + {update_seq, CurrentSeq}, + {purge_seq, PurgeSeq} ]. % maybe move to another module -- cgit v1.2.3