couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kxe...@apache.org
Subject [1/2] couch-index commit: updated refs/heads/master to e15bed8
Date Tue, 12 May 2015 19:55:24 GMT
Repository: couchdb-couch-index
Updated Branches:
  refs/heads/master 0c5f25b1c -> e15bed80e


Return pending_updates field from couch_index:get_info/1

COUCHDB-2526


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/0905e9cc
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/0905e9cc
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/0905e9cc

Branch: refs/heads/master
Commit: 0905e9ccf9c3efa4a13aa7e45973fdb50c37e356
Parents: eb61626
Author: ILYA Khlopotov <iilyak@ca.ibm.com>
Authored: Mon Dec 22 14:04:44 2014 -0800
Committer: ILYA Khlopotov <iilyak@ca.ibm.com>
Committed: Mon Dec 22 14:04:44 2014 -0800

----------------------------------------------------------------------
 src/couch_index.erl | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/0905e9cc/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index b44d351..eae5f70 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -157,14 +157,20 @@ handle_call({get_state, ReqSeq}, From, State) ->
     end;
 handle_call(get_info, _From, State) ->
     #st{mod=Mod} = State,
-    {ok, Info0} = Mod:get(info, State#st.idx_state),
+    IdxState = State#st.idx_state,
+    {ok, Info0} = Mod:get(info, IdxState),
     IsUpdating = couch_index_updater:is_running(State#st.updater),
     IsCompacting = couch_index_compactor:is_running(State#st.compactor),
+    IdxSeq = Mod:get(update_seq, IdxState),
+    GetCommSeq = fun(Db) -> couch_db:get_committed_update_seq(Db) end,
+    DbName = Mod:get(db_name, IdxState),
+    CommittedSeq = couch_util:with_db(DbName, GetCommSeq),
     Info = Info0 ++ [
         {updater_running, IsUpdating},
         {compact_running, IsCompacting},
         {waiting_commit, State#st.committed == false},
-        {waiting_clients, length(State#st.waiters)}
+        {waiting_clients, length(State#st.waiters)},
+        {pending_updates, max(CommittedSeq - IdxSeq, 0)}
     ],
     {reply, {ok, Info}, State};
 handle_call(reset, _From, State) ->


Mime
View raw message