You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/02/03 16:50:48 UTC

[1/2] couch-index commit: updated refs/heads/COUCHDB-3287-pluggable-storage-engines to 4e779f2 [Forced Update!]

Repository: couchdb-couch-index
Updated Branches:
  refs/heads/COUCHDB-3287-pluggable-storage-engines 1424c46c7 -> 4e779f239 (forced update)


Remove public db record

COUCHDB-3288


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

Branch: refs/heads/COUCHDB-3287-pluggable-storage-engines
Commit: 81bcb1f843df55bdb6e9c82837f589489ebbea09
Parents: f0a6854
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Feb 1 15:27:04 2017 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 1 17:27:10 2017 -0600

----------------------------------------------------------------------
 src/couch_index_server.erl            | 18 +++++++++---------
 src/couch_index_util.erl              |  2 +-
 test/couch_index_compaction_tests.erl |  3 ++-
 3 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/81bcb1f8/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl
index 4e86f5e..cbdfbe7 100644
--- a/src/couch_index_server.erl
+++ b/src/couch_index_server.erl
@@ -60,14 +60,13 @@ validate(DbName, DDoc) ->
     lists:foreach(ValidateFun, EnabledIndexers).
 
 
-get_index(Module, #db{name = <<"shards/", _/binary>> = DbName}, DDoc) ->
-    case is_record(DDoc, doc) of
-        true -> get_index(Module, DbName, DDoc, nil);
-        false -> get_index(Module, DbName, DDoc)
-    end;
+get_index(Module, <<"shards/", _/binary>> = DbName, DDoc)
+        when is_binary(DbName), is_record(DDoc, doc) ->
+    get_index(Module, DbName, DDoc, nil);
 get_index(Module, <<"shards/", _/binary>> = DbName, DDoc) ->
     {Pid, Ref} = spawn_monitor(fun() ->
-        exit(fabric:open_doc(mem3:dbname(DbName), DDoc, [ejson_body, ?ADMIN_CTX]))
+        OpenOpts = [ejson_body, ?ADMIN_CTX],
+        exit(fabric:open_doc(mem3:dbname(DbName), DDoc, OpenOpts))
     end),
     receive {'DOWN', Ref, process, Pid, {ok, Doc}} ->
         get_index(Module, DbName, Doc, nil);
@@ -77,9 +76,10 @@ get_index(Module, <<"shards/", _/binary>> = DbName, DDoc) ->
         erlang:demonitor(Ref, [flush]),
         {error, timeout}
     end;
-
-get_index(Module, DbName, DDoc) ->
-    get_index(Module, DbName, DDoc, nil).
+get_index(Module, DbName, DDoc) when is_binary(DbName) ->
+    get_index(Module, DbName, DDoc, nil);
+get_index(Module, Db, DDoc) ->
+    get_index(Module, couch_db:name(Db), DDoc).
 
 
 get_index(Module, DbName, DDoc, Fun) when is_binary(DbName) ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/81bcb1f8/src/couch_index_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_util.erl b/src/couch_index_util.erl
index 5694641..dcb33b5 100644
--- a/src/couch_index_util.erl
+++ b/src/couch_index_util.erl
@@ -25,7 +25,7 @@ root_dir() ->
 index_dir(Module, DbName) when is_binary(DbName) ->
     DbDir = "." ++ binary_to_list(DbName) ++ "_design",
     filename:join([root_dir(), DbDir, Module]);
-index_dir(Module, #db{}=Db) ->
+index_dir(Module, Db) ->
     index_dir(Module, couch_db:name(Db)).
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/81bcb1f8/test/couch_index_compaction_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_index_compaction_tests.erl b/test/couch_index_compaction_tests.erl
index 0787151..18dd9ff 100644
--- a/test/couch_index_compaction_tests.erl
+++ b/test/couch_index_compaction_tests.erl
@@ -23,7 +23,8 @@ setup() ->
     ?assertNot(is_opened(Db)),
     {Db, IndexerPid}.
 
-fake_index(#db{name = DbName} = Db) ->
+fake_index(Db) ->
+    DbName = couch_db:name(Db),
     ok = meck:new([test_index], [non_strict]),
     ok = meck:expect(test_index, init, ['_', '_'], {ok, 10}),
     ok = meck:expect(test_index, open, fun(_Db, State) ->


[2/2] couch-index commit: updated refs/heads/COUCHDB-3287-pluggable-storage-engines to 4e779f2

Posted by da...@apache.org.
Update API for use with pluggable storage engines

COUCHDB-3287


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

Branch: refs/heads/COUCHDB-3287-pluggable-storage-engines
Commit: 4e779f239e1f259ebb50948ad26ec21aac1135d3
Parents: 81bcb1f
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Feb 10 18:14:07 2016 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Fri Feb 3 10:48:54 2017 -0600

----------------------------------------------------------------------
 src/couch_index_updater.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/4e779f23/src/couch_index_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_updater.erl b/src/couch_index_updater.erl
index ad48f40..bf31460 100644
--- a/src/couch_index_updater.erl
+++ b/src/couch_index_updater.erl
@@ -166,7 +166,7 @@ update(Idx, Mod, IdxState) ->
             end
         end,
 
-        Proc = fun(DocInfo, _, {IdxStateAcc, _}) ->
+        Proc = fun(DocInfo, {IdxStateAcc, _}) ->
             case CommittedOnly and (GetSeq(DocInfo) > DbCommittedSeq) of
                 true ->
                     {stop, {IdxStateAcc, false}};
@@ -180,7 +180,7 @@ update(Idx, Mod, IdxState) ->
 
         {ok, InitIdxState} = Mod:start_update(Idx, PurgedIdxState, NumChanges),
         Acc0 = {InitIdxState, true},
-        {ok, _, Acc} = couch_db:enum_docs_since(Db, CurrSeq, Proc, Acc0, []),
+        {ok, Acc} = couch_db:fold_changes(Db, CurrSeq, Proc, Acc0, []),
         {ProcIdxSt, SendLast} = Acc,
 
         % If we didn't bail due to hitting the last committed seq we need
@@ -198,7 +198,7 @@ update(Idx, Mod, IdxState) ->
 
 
 purge_index(Db, Mod, IdxState) ->
-    DbPurgeSeq = couch_db:get_purge_seq(Db),
+    {ok, DbPurgeSeq} = couch_db:get_purge_seq(Db),
     IdxPurgeSeq = Mod:get(purge_seq, IdxState),
     if
         DbPurgeSeq == IdxPurgeSeq ->