Permalink
Browse files

Merge remote-tracking branch 'origin/2.0.2'

Change-Id: I3c8a4acd71e8d94c6b90787c589b8aad3d5fbfb0
  • Loading branch information...
2 parents bfd853e + ec269ea commit c7bc2925919cc33a8a2dded1c10cf86001ad01e0 @fdmanana fdmanana committed Feb 14, 2013
@@ -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) ->
@@ -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
@@ -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 c7bc292

Please sign in to comment.