Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge remote-tracking branch 'origin/2.0.1' into 2.0.2

* origin/2.0.1:
  MB-7828 Don't attempt to copy purged docs list

Change-Id: If7cf5e471e744a2e7fd9d8f7789b5796fe45bb1c
  • Loading branch information...
commit dade4e45619c4d6322928299faa094efb51f4dc1 2 parents 140de2b + 8352437
@fdmanana fdmanana authored
View
12 src/couchdb/couch_db_updater.erl
@@ -827,18 +827,10 @@ initial_copy_compact(#db{docinfo_by_seq_btree=SrcBySeq,
NewDb#db{docinfo_by_seq_btree=NewBySeqBtree,
docinfo_by_id_btree=DestById#btree{root=NewByIdRoot}}.
-fd_to_db(#db{name=Name, header=#db_header{purge_seq=PurgeSeq}}=Db, CompactFile, Header, Fd) ->
+fd_to_db(#db{name=Name}=Db, CompactFile, Header, Fd) ->
NewDb = init_db(Name, CompactFile, Fd, Header, Db#db.options),
- NewDb2 =
- if PurgeSeq > 0 ->
- {ok, PurgedIdsRevs} = couch_db:get_last_purged(Db),
- {ok, Pointer, _} = couch_file:append_term(Fd, PurgedIdsRevs),
- NewDb#db{header=Header#db_header{purge_seq=PurgeSeq, purged_docs=Pointer}};
- true ->
- NewDb
- end,
unlink(Fd),
- NewDb2.
+ NewDb.
make_target_db(Db, CompactFile) ->
case couch_file:open(CompactFile) of
View
55 src/couchdb/couch_view_updater.erl
@@ -41,8 +41,6 @@ update(Owner, Group, #db{name = DbName} = Db) ->
DbPurgeSeq = couch_db:get_purge_seq(Db),
if DbPurgeSeq == PurgeSeq ->
ok;
- DbPurgeSeq == PurgeSeq + 1 ->
- ok;
true ->
exit(reset)
end,
@@ -70,18 +68,12 @@ update(Owner, Group, #db{name = DbName} = Db) ->
{total_changes, TotalChanges}
]),
couch_task_status:set_update_frequency(500),
- Group2 =
- if DbPurgeSeq == PurgeSeq + 1 ->
- purge_index(Group, Db);
- true ->
- Group
- end,
- ViewEmptyKVs = [{View, []} || View <- Group2#group.views],
- couch_view_mapreduce:start_reduce_context(Group2),
+ ViewEmptyKVs = [{View, []} || View <- Group#group.views],
+ couch_view_mapreduce:start_reduce_context(Group),
try
- do_writes(Self, Owner, Group2, WriteQueue, Seq == 0, ViewEmptyKVs, [])
+ do_writes(Self, Owner, Group, WriteQueue, Seq == 0, ViewEmptyKVs, [])
after
- couch_view_mapreduce:end_reduce_context(Group2)
+ couch_view_mapreduce:end_reduce_context(Group)
end
end),
% compute on all docs modified since we last computed.
@@ -111,45 +103,6 @@ update(Owner, Group, #db{name = DbName} = Db) ->
end.
-purge_index(#group{fd=Fd, views=Views, id_btree=IdBtree}=Group, Db) ->
- {ok, PurgedIdsRevs} = couch_db:get_last_purged(Db),
- Ids = [Id || {Id, _Revs} <- PurgedIdsRevs],
- {ok, Lookups, IdBtree2} = couch_btree:query_modify(IdBtree, Ids, [], Ids),
-
- % now populate the dictionary with all the keys to delete
- ViewKeysToRemoveDict = lists:foldl(
- fun({ok,{DocId,ViewNumRowKeys}}, ViewDictAcc) ->
- lists:foldl(
- fun({ViewNum, RowKey}, ViewDictAcc2) ->
- dict:append(ViewNum, {RowKey, DocId}, ViewDictAcc2)
- end, ViewDictAcc, ViewNumRowKeys);
- ({not_found, _}, ViewDictAcc) ->
- ViewDictAcc
- end, dict:new(), Lookups),
-
- % Now remove the values from the btrees
- PurgeSeq = couch_db:get_purge_seq(Db),
- Views2 = lists:map(
- fun(#view{id_num=Num,btree=Btree}=View) ->
- case dict:find(Num, ViewKeysToRemoveDict) of
- {ok, RemoveKeys} ->
- {ok, ViewBtree2} = couch_btree:add_remove(Btree, [], RemoveKeys),
- case ViewBtree2 =/= Btree of
- true ->
- View#view{btree=ViewBtree2, purge_seq=PurgeSeq};
- _ ->
- View#view{btree=ViewBtree2}
- end;
- error -> % no keys to remove in this view
- View
- end
- end, Views),
- ok = couch_file:flush(Fd),
- Group#group{id_btree=IdBtree2,
- views=Views2,
- purge_seq=PurgeSeq}.
-
-
load_doc(Db, DocInfo, MapQueue, DocOpts, IncludeDesign) ->
#doc_info{id=DocId, local_seq=Seq, deleted=Deleted} = DocInfo,
case {IncludeDesign, DocId} of
Please sign in to comment.
Something went wrong with that request. Please try again.