Skip to content

Instantly share code, notes, and snippets.

@rnewson
Created January 27, 2013 18:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rnewson/4649512 to your computer and use it in GitHub Desktop.
Save rnewson/4649512 to your computer and use it in GitHub Desktop.
commit 307353cf8b1aa5b24533a8d70a440e39ab178285
Author: Robert Newson <rnewson@apache.org>
Date: 2013-01-27 19:10:07 +0100
Match 1.2.x view sigs
diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index ba4de2d..3bbb114 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -102,9 +102,24 @@ ddoc_to_mrst(DbName, #doc{id=Id, body={Fields}}) ->
language=Language,
design_opts=DesignOpts
},
- SigInfo = {Views, Language, DesignOpts, couch_index_util:sort_lib(Lib)},
+ ViewInfo = [old_view_format(V) || V <- Views],
+ SigInfo = case Lib of
+ {[]} -> {ViewInfo, Language, DesignOpts};
+ _ -> {ViewInfo, Language, DesignOpts, couch_index_util:sort_lib(Lib)}
+ end,
{ok, IdxState#mrst{sig=couch_util:md5(term_to_binary(SigInfo))}}.
+% Use the old view record format so group sig's don't change
+old_view_format(View) ->
+ {
+ view,
+ View#mrview.id_num,
+ View#mrview.map_names,
+ View#mrview.def,
+ View#mrview.btree,
+ View#mrview.reduce_funs,
+ View#mrview.options
+ }.
set_view_type(_Args, _ViewName, []) ->
throw({not_found, missing_named_view});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment