anchor.diff:      compact_loop(Parent).
   
   
  -maybe_compact_bucket(VbNames, Config) ->
  +maybe_compact_bucket(MasterDbName, VbNames, Config) ->
  +    DDocNames = case couch_db:open_int(MasterDbName, []) of
  +    {ok, MasterDb} ->
  +         Names = db_ddoc_names(MasterDb),
  +         couch_db:close(MasterDb),
  +         Names;
  +    Error ->
  +         ?LOG_ERROR("Error opening database `~s`: ~p", [MasterDbName, Error]),
  +         []
  +    end,
       case bucket_needs_compaction(VbNames, Config) of
       false ->
  -        ok;
  -    true ->
  -        lists:foreach(fun(N) -> compact_vbucket(N, Config) end, VbNames)
  +        lists:foreach(fun(N) ->
  +            maybe_compact_views(N, MasterDbName, DDocNames, Config) end,
  +            VbNames);
  +    true ->
  +        lists:foreach(fun(N) ->
  +            compact_vbucket(N, MasterDbName, DDocNames, Config) end,
  +            VbNames)
       end.
   
   
  
positive.code:     end.
  
  
  compact_vbucket(DbName, Config) ->
      case (catch couch_db:open_int(DbName, [])) of
      {ok, Db} ->
          DDocNames = db_ddoc_names(Db),
          {ok, DbCompactPid} = couch_db:start_compact(Db),
          TimeLeft = compact_time_left(Config),
          case Config#config.parallel_view_compact of
          true ->
              ViewsCompactPid = spawn(fun() ->
                  maybe_compact_views(DbName, DDocNames, Config)
              end),
              ViewsMonRef = erlang:monitor(process, ViewsCompactPid);
          false ->
  
negative.code:                     end
                  end,
                  {0, []}, couch_util:get_value(map, Config)),
              NameBin = ?l2b(Name),
              {NameBin, VbNames, bucket_compact_config(NameBin)}
          end,
          ns_bucket:get_buckets()),
      lists:foreach(
          fun({_BucketName, _VbNames, nil}) ->
              ok;
          ({BucketName, VbNames, {ok, Config}}) ->
              MasterDbName = <<BucketName/binary, "/master">>,
              maybe_compact_bucket(MasterDbName, VbNames, Config)
          end,
          Buckets),
      case ets:info(?CONFIG_ETS, size) =:= 0 of
  