diff options
author | Paul Joseph Davis <davisp@apache.org> | 2010-10-10 19:44:01 +0000 |
---|---|---|
committer | Paul Joseph Davis <davisp@apache.org> | 2010-10-10 19:44:01 +0000 |
commit | 61acb9cbc12442638b54fa7db87a4d1a37579ef4 (patch) | |
tree | b08e2adc387a7c393fe071b7889d18c4aa431bb3 /src | |
parent | c67ba1f96daaec66b01c80b27ff92f33696b0900 (diff) |
Avoid view regeneration for new ETags support.
This reverts the group signature calculation to use a tuple that
would've been generated before changing the view record definition.
New ETag's will automatically be supported when people run their
next index update.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1006345 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_view_group.erl | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl index 3a3ffe99..729febcd 100644 --- a/src/couchdb/couch_view_group.erl +++ b/src/couchdb/couch_view_group.erl @@ -464,16 +464,28 @@ set_view_sig(#group{ lib={[]}, def_lang=Language, design_options=DesignOptions}=G) -> - ViewInfo = [V#view{update_seq=0, purge_seq=0} || V <- Views], + ViewInfo = [old_view_format(V) || V <- Views], G#group{sig=couch_util:md5(term_to_binary({ViewInfo, Language, DesignOptions}))}; set_view_sig(#group{ views=Views, lib=Lib, def_lang=Language, design_options=DesignOptions}=G) -> - ViewInfo = [V#view{update_seq=0, purge_seq=0} || V <- Views], + ViewInfo = [old_view_format(V) || V <- Views], G#group{sig=couch_util:md5(term_to_binary({ViewInfo, Language, DesignOptions, sort_lib(Lib)}))}. +% Use the old view record format so group sig's don't change +old_view_format(View) -> + { + view, + View#view.id_num, + View#view.map_names, + View#view.def, + View#view.btree, + View#view.reduce_funs, + View#view.options + }. + sort_lib({Lib}) -> sort_lib(Lib, []). sort_lib([], LAcc) -> @@ -585,6 +597,11 @@ init_group(Db, Fd, #group{def_lang=Lang,views=Views}= Group, IndexHeader) -> #index_header{seq=Seq, purge_seq=PurgeSeq, id_btree_state=IdBtreeState, view_states=ViewStates} = IndexHeader, + StateUpdate = fun + ({_, _, _}=State) -> State; + (State) -> {State, 0, 0} + end, + ViewStates2 = lists:map(StateUpdate, ViewStates), {ok, IdBtree} = couch_btree:open(IdBtreeState, Fd), Views2 = lists:zipwith( fun({BTState, USeq, PSeq}, #view{reduce_funs=RedFuns,options=Options}=View) -> @@ -615,7 +632,7 @@ init_group(Db, Fd, #group{def_lang=Lang,views=Views}= ), View#view{btree=Btree, update_seq=USeq, purge_seq=PSeq} end, - ViewStates, Views), + ViewStates2, Views), Group#group{db=Db, fd=Fd, current_seq=Seq, purge_seq=PurgeSeq, id_btree=IdBtree, views=Views2}. |