anchor.diff:                                      scheduled
                               end,
   
  +              ?log_info("Compacting indexes for ~s. Compaction is ~p", [ViewName, TriggerType]),
  +              process_flag(trap_exit, true),
  +
                 InitialStatus = [{original_target, OriginalTarget},
                                  {trigger_type, TriggerType}],
   
  
positive.code:     Compactor = start_view_index_compactor(BucketName, DDocId,
                                             Kind, Type, InitialStatus),
      CompactorRef = erlang:monitor(process, Compactor),
  
      receive
          {'EXIT', Parent, Reason} = Exit ->
              ?log_debug("Got exit signal from parent: ~p", [Exit]),
  
              erlang:demonitor(CompactorRef),
              ok = ns_couchdb_api:cancel_view_compact(BucketName, DDocId, Kind, Type),
              exit(Reason);
          {'DOWN', CompactorRef, process, Compactor, normal} ->
              ok;
          {'DOWN', CompactorRef, process, Compactor, noproc} ->
              exit({index_compactor_died_too_soon,
                    BucketName, DDocId, Kind, Type});
          {'DOWN', CompactorRef, process, Compactor, Reason}
            when Reason =:= shutdown;
                 Reason =:= {updater_died, shutdown};
                 Reason =:= {updated_died, noproc};
                 Reason =:= {updater_died, {updater_error, shutdown}} ->
              do_spawn_view_index_compactor(Parent, BucketName,
                                            DDocId, Kind, Type, InitialStatus);
          {'DOWN', CompactorRef, process, Compactor, Reason} ->
              exit(Reason)
      end.
  
  
negative.code:     case ns_couchdb_api:start_view_compact(BucketName, DDocId, Kind, Type, InitialStatus) of
          {ok, Pid} ->
              Pid;
          {error, Error} ->
              ?log_debug("Compactor ~p was not created. Reason: ~p",
                         [{BucketName, DDocId, Kind, Type}, Error]),
              case Error of
                  initial_build ->
                      exit(normal);
                  empty_group ->
                      exit(normal)
              end
      end.
  
  bucket_needs_compaction(BucketName, NumVBuckets,
  