Skip to content
Browse files

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

Change-Id: I7700768e4ceebda2ccbde2ae8166e71f9bb29f73
  • Loading branch information...
2 parents 45081de + 8e96188 commit ec269eadca12ce69641d880d0291a9779bbbad42 @fdmanana fdmanana committed
View
6 src/couch_set_view/src/couch_set_view_group.erl
@@ -679,15 +679,17 @@ handle_call({compact_done, Result}, {Pid, _}, #state{compactor_pid = Pid} = Stat
filepath = OldFilepath
} = Group,
#set_view_compactor_result{
- group = NewGroup,
+ group = NewGroup0,
compact_time = Duration,
cleanup_kv_count = CleanupKVCount
} = Result,
MissingChangesCount = couch_set_view_util:missing_changes_count(
- ?set_seqs(Group), ?set_seqs(NewGroup)),
+ ?set_seqs(Group), ?set_seqs(NewGroup0)),
case MissingChangesCount == 0 of
true ->
+ % Compactor might have received a group snapshot from an updater.
+ NewGroup = fix_updater_group(NewGroup0, Group),
HeaderBin = couch_set_view_util:group_to_header_bin(NewGroup),
ok = couch_file:write_header_bin(NewGroup#set_view_group.fd, HeaderBin),
if is_pid(UpdaterPid) ->
View
7 src/couch_set_view/src/couch_set_view_updater.erl
@@ -1352,11 +1352,12 @@ maybe_fix_group(#set_view_group{index_header = Header} = Group) ->
end.
-check_if_compactor_started(Acc) ->
+check_if_compactor_started(#writer_acc{group = Group0} = Acc) ->
receive
{compactor_started, Pid} ->
- Pid ! {compactor_started_ack, self(), Acc#writer_acc.group},
- Acc#writer_acc{compactor_running = true}
+ Group = maybe_fix_group(Group0),
+ Pid ! {compactor_started_ack, self(), Group},
+ Acc#writer_acc{compactor_running = true, group = Group}
after 0 ->
Acc
end.
View
6 src/couchdb/couch_db.erl
@@ -687,7 +687,11 @@ open_doc_int(Db, <<?LOCAL_DOC_PREFIX, _/binary>> = Id, Options) ->
end;
open_doc_int(Db, #doc_info{id=Id,deleted=IsDeleted,rev=RevInfo, body_ptr=Bp,
content_meta=ContentMeta}=DocInfo, Options) ->
- {ok, Body} = couch_file:pread_iolist(Db#db.fd, Bp),
+ Body = case Bp of
+ 0 -> <<>>;
+ _ -> {ok, Body0} = couch_file:pread_iolist(Db#db.fd, Bp),
+ Body0
+ end,
Doc = #doc{
id = Id,
rev = RevInfo,

0 comments on commit ec269ea

Please sign in to comment.
Something went wrong with that request. Please try again.