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/04/18 20:53:39 UTC

[couchdb] branch COUCHDB-3378-fix-mango-full-text-detection updated (4c35008 -> db2f19b)

This is an automated email from the ASF dual-hosted git repository.

davisp pushed a change to branch COUCHDB-3378-fix-mango-full-text-detection
in repository https://gitbox.apache.org/repos/asf/couchdb.git.

     omits  4c35008   Fix mango full text detection
      adds  c0fda54   Fix mem3_sync_event_listener unit test
      adds  e367575   Merge pull request #482 from apache/COUCHDB-3380-fix-mem3-sync-event-listener-unit-tests
      adds  d754c8c   Fix couch_auth_cache reinitialization logic
      adds  3f0f806   Merge pull request #481 from apache/COUCHDB-3379-fix-couch-auth-cache-reinit
       new  db2f19b   Fix mango full text detection

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (4c35008)
            \
             N -- N -- N   refs/heads/COUCHDB-3378-fix-mango-full-text-detection (db2f19b)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omits" are not gone; other references still
refer to them.  Any revisions marked "discards" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "adds" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/src/couch_auth_cache.erl        | 17 ++++-------------
 src/mango/rebar.config.script             |  6 ++----
 src/mem3/src/mem3_sync_event_listener.erl |  2 +-
 3 files changed, 7 insertions(+), 18 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].

[couchdb] 01/01: Fix mango full text detection

Posted by da...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

davisp pushed a commit to branch COUCHDB-3378-fix-mango-full-text-detection
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit db2f19b8b40c12420070612acc3ed7faed45b819
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Thu Apr 6 12:10:08 2017 -0500

    Fix mango full text detection
    
    The check for whether full text support in mango is available was broken
    in that the mango_cursor_text module is only compiled if dreyfus exists
    while the check to use the module was a runtime check. Thus is a user
    were to add dreyfus after mango had been compiled it would have led to a
    runtime error when we attempted to use a module that didn't exist.
    
    This changes the check to a compile time check in both places. And now
    that its a compile time define we can remove the need to rename source
    files around which causes problems with source control seeing that file
    change depending on local configuration.
    
    COUCHDB-3378
---
 src/mango/rebar.config.script                      | 23 ++++++++++------------
 src/mango/src/mango_cursor.erl                     | 21 +++++++++++++-------
 ...or_text.erl.nocompile => mango_cursor_text.erl} |  4 ++++
 3 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/src/mango/rebar.config.script b/src/mango/rebar.config.script
index 3b046f4..d62cc69 100644
--- a/src/mango/rebar.config.script
+++ b/src/mango/rebar.config.script
@@ -10,18 +10,15 @@
 % License for the specific language governing permissions and limitations under
 % the License.
 
-DreyfusAppFile  = filename:join(filename:dirname(SCRIPT),
-    "../dreyfus/src/dreyfus.app.src"),
-RenameFile = filename:join(filename:dirname(SCRIPT),
-    "src/mango_cursor_text.erl"),
-CursorFile = filename:join(filename:dirname(SCRIPT),
-    "src/mango_cursor_text.erl.nocompile"),
 
-case filelib:is_regular(DreyfusAppFile) of
-    true ->
-        file:rename(CursorFile, RenameFile);
-    false ->
-        ok
-end,
+HaveDreyfus = code:lib_dir(dreyfus) /= {error, bad_name}.
+
+if not HaveDreyfus -> CONFIG; true ->
+    CurrOpts = case lists:keyfind(erl_opts, 1, CONFIG) of
+        {erl_opts, Opts} -> Opts;
+        false -> []
+    end,
+    NewOpts = [{d, 'HAVE_DREYFUS'} | CurrOpts],
+    lists:keystore(erl_opts, 1, CONFIG, {erl_opts, NewOpts})
+end.
 
-CONFIG.
diff --git a/src/mango/src/mango_cursor.erl b/src/mango/src/mango_cursor.erl
index 911ecdb..cf71790 100644
--- a/src/mango/src/mango_cursor.erl
+++ b/src/mango/src/mango_cursor.erl
@@ -26,6 +26,19 @@
 -include("mango_cursor.hrl").
 
 
+-ifdef(HAVE_DREYFUS).
+-define(CURSOR_MODULES, [
+    mango_cursor_view,
+    mango_cursor_text,
+    mango_cursor_special
+]).
+-else.
+-define(CURSOR_MODULES, [
+    mango_cursor_view,
+    mango_cursor_special
+]).
+-endif.
+
 -define(SUPERVISOR, mango_cursor_sup).
 
 
@@ -113,12 +126,6 @@ group_indexes_by_type(Indexes) ->
     % used to service this query. This is so that we
     % don't suddenly switch indexes for existing client
     % queries.
-    CursorModules = case module_loaded(dreyfus_index) of
-        true ->
-            [mango_cursor_view, mango_cursor_text, mango_cursor_special];
-        false ->
-            [mango_cursor_view, mango_cursor_special]
-    end,
     lists:flatmap(fun(CMod) ->
         case dict:find(CMod, IdxDict) of
             {ok, CModIndexes} ->
@@ -126,4 +133,4 @@ group_indexes_by_type(Indexes) ->
             error ->
                 []
         end
-    end, CursorModules).
+    end, ?CURSOR_MODULES).
diff --git a/src/mango/src/mango_cursor_text.erl.nocompile b/src/mango/src/mango_cursor_text.erl
similarity index 99%
rename from src/mango/src/mango_cursor_text.erl.nocompile
rename to src/mango/src/mango_cursor_text.erl
index a094b55..96e365a 100644
--- a/src/mango/src/mango_cursor_text.erl.nocompile
+++ b/src/mango/src/mango_cursor_text.erl
@@ -12,6 +12,8 @@
 
 -module(mango_cursor_text).
 
+-ifdef(HAVE_DREYFUS).
+
 -export([
     create/4,
     explain/1,
@@ -304,3 +306,5 @@ get_json_docs(DbName, Hits) ->
                 {Sort, not_found}
         end
     end, Hits).
+
+-endif.

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.