couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbast...@apache.org
Subject [33/41] couch-mrview commit: updated refs/heads/master to 28e51f3
Date Fri, 31 Oct 2014 19:53:48 GMT
Make view sig backwards compatible


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

Branch: refs/heads/master
Commit: fa7a888f52441355f3156514d113e2fcbb3750e6
Parents: d6771df
Author: Benjamin Bastian <benjamin.bastian@gmail.com>
Authored: Mon Sep 8 16:26:04 2014 -0700
Committer: Benjamin Bastian <benjamin.bastian@gmail.com>
Committed: Thu Oct 30 13:40:32 2014 -0700

----------------------------------------------------------------------
 src/couch_mrview_util.erl | 23 ++++++++++++++++++-----
 1 file changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/fa7a888f/src/couch_mrview_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_util.erl b/src/couch_mrview_util.erl
index 2850718..6054e3a 100644
--- a/src/couch_mrview_util.erl
+++ b/src/couch_mrview_util.erl
@@ -162,9 +162,12 @@ view_sig(Db, State, View, #mrargs{include_docs=true}=Args) ->
     BaseSig = view_sig(Db, State, View, Args#mrargs{include_docs=false}),
     UpdateSeq = couch_db:get_update_seq(Db),
     PurgeSeq = couch_db:get_purge_seq(Db),
-    Bin = term_to_binary({BaseSig, UpdateSeq, PurgeSeq,
-                          State#mrst.seq_indexed, State#mrst.keyseq_indexed}),
-    couch_index_util:hexsig(couch_util:md5(Bin));
+    #mrst{
+        seq_indexed=SeqIndexed,
+        keyseq_indexed=KeySeqIndexed
+    } = State,
+    Term = view_sig_term(BaseSig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed),
+    couch_index_util:hexsig(couch_util:md5(term_to_binary(Term)));
 view_sig(Db, State, {_Nth, _Lang, View}, Args) ->
     view_sig(Db, State, View, Args);
 view_sig(_Db, State, View, Args0) ->
@@ -177,8 +180,18 @@ view_sig(_Db, State, View, Args0) ->
         preflight_fun=undefined,
         extra=[]
     },
-    Bin = term_to_binary({Sig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed, Args}),
-    couch_index_util:hexsig(couch_util:md5(Bin)).
+    Term = view_sig_term(Sig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed, Args),
+    couch_index_util:hexsig(couch_util:md5(term_to_binary(Term))).
+
+view_sig_term(BaseSig, UpdateSeq, PurgeSeq, false, false) ->
+    {BaseSig, UpdateSeq, PurgeSeq};
+view_sig_term(BaseSig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed) ->
+    {BaseSig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed}.
+
+view_sig_term(BaseSig, UpdateSeq, PurgeSeq, false, false, Args) ->
+    {BaseSig, UpdateSeq, PurgeSeq, Args};
+view_sig_term(BaseSig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed, Args) ->
+    {BaseSig, UpdateSeq, PurgeSeq, KeySeqIndexed, SeqIndexed, Args}.
 
 
 init_state(Db, Fd, #mrst{views=Views}=State, nil) ->


Mime
View raw message