couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [01/12] couch-index commit: updated refs/heads/1994-merge-rcouch to 7c1666b
Date Thu, 13 Feb 2014 00:01:14 GMT
Updated Branches:
  refs/heads/1994-merge-rcouch 4a5a0e372 -> 7c1666ba7 (forced update)


add supports of view changes in the _changes API

Now when the option `seq_indexed=true` is set in the design doc, the
view filter in _changes will use it to retrieve the results. Compared to
the current way, using a view index will be faster to retrieve changes.
It also gives the possibility to filter changes by key or get changes in
a key range. All the view options can be used.

Note 1: if someone is trying to filter a changes with view options when
the views are not indexed by sequence, a 400 error will be returned.
Note 2: The changes will only be returned when the view is updated if
seq_indexed=true


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/7d713ef6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/7d713ef6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/7d713ef6

Branch: refs/heads/1994-merge-rcouch
Commit: 7d713ef6522a0ab939aa357d15a84e34ac80f5a1
Parents: ebb85be
Author: benoitc <bchesneau@gmail.com>
Authored: Fri Feb 7 15:38:34 2014 +0100
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Wed Feb 12 17:58:22 2014 -0600

----------------------------------------------------------------------
 src/couch_index.erl        | 13 ++++++++++---
 src/couch_index_server.erl |  7 -------
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/7d713ef6/src/couch_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_index.erl b/src/couch_index.erl
index c48c066..b9ae567 100644
--- a/src/couch_index.erl
+++ b/src/couch_index.erl
@@ -254,12 +254,12 @@ handle_cast(delete, State) ->
     DbName = Mod:get(db_name, IdxState),
     DDocId = Mod:get(idx_name, IdxState),
 
-    ok = Mod:delete(IdxState),
-
     %% notify about the index deletion
     couch_index_event:notify({index_delete,
                               {DbName, DDocId, Mod}}),
 
+    ok = Mod:delete(IdxState),
+
     {stop, normal, State};
 handle_cast(ddoc_updated, State) ->
     #st{mod = Mod, idx_state = IdxState, waiters = Waiters} = State,
@@ -319,7 +319,14 @@ handle_info(commit, State) ->
             {noreply, State}
     end;
 handle_info({'DOWN', _, _, _Pid, _}, #st{mod=Mod, idx_state=IdxState}=State) ->
-    Args = [Mod:get(db_name, IdxState), Mod:get(idx_name, IdxState)],
+    DbName = Mod:get(db_name, IdxState),
+    DDocId = Mod:get(idx_name, IdxState),
+
+    %% notify to event listeners that the index has been
+    %% updated
+    couch_index_event:notify({index_delete, {DbName, DDocId, Mod}}),
+
+    Args = [DbName, DDocId],
     ?LOG_INFO("Index shutdown by monitor notice for db: ~s idx: ~s", Args),
     catch send_all(State#st.waiters, shutdown),
     {stop, normal, State#st{waiters=[]}}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/7d713ef6/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl
index facde14..86791db 100644
--- a/src/couch_index_server.erl
+++ b/src/couch_index_server.erl
@@ -159,8 +159,6 @@ reset_indexes(DbName, Root) ->
         MRef = erlang:monitor(process, Pid),
         gen_server:cast(Pid, delete),
         receive {'DOWN', MRef, _, _, _} -> ok end,
-        couch_index_event:notify({index_delete,
-                                  {DbName, DDocId, couch_mrview_index}}),
         rem_from_ets(DbName, Sig, DDocId, Pid)
     end,
     lists:foreach(Fun, ets:lookup(?BY_DB, DbName)),
@@ -195,11 +193,6 @@ update_notify({ddoc_updated, {DbName, DDocId}}) ->
         fun({_DbName, {_DDocId, Sig}}) ->
             case ets:lookup(?BY_SIG, {DbName, Sig}) of
                 [{_, IndexPid}] ->
-                    %% notify to event listeners that the index has been
-                    %% updated
-                    couch_index_event:notify({index_update,
-                                              {DbName, DDocId,
-                                               couch_mrview_index}}),
                     (catch gen_server:cast(IndexPid, ddoc_updated));
                 [] ->
                     ok


Mime
View raw message