anchor.diff:                                      [BucketName]),
                             true;
                         false ->
  -                          bucket_needs_compaction(BucketName, VBucketDbs, Config)
  +                          bucket_needs_compaction(BucketName, Total - 1, Config)
                     end,
   
                 DoCompact orelse exit(normal),
   
                 ?log_info("Compacting databases for bucket ~s", [BucketName]),
   
  -              Total = length(VBucketDbs),
                 TriggerType = case Force of
                                   true ->
                                       manual;
  
positive.code:             check_fragmentation(FragThreshold, Frag, FragSize)
      end.
  
  aggregated_size_info(SampleVBucketDbs, NumVBuckets) ->
      NumSamples = length(SampleVBucketDbs),
  
      {DataSize, FileSize} =
          lists:foldl(
            fun ({_VBucket, DbName}, {AccDataSize, AccFileSize}) ->
                    {ok, Db} = couch_db:open_int(DbName, []),
  
                    %% unfortunately I can't just bind this inside try block
                    %% because compiler (seemingly mistakenly) thinks that this
                    %% is unsafe
                    DbInfo =
                        try
                            {ok, Info} = couch_db:get_db_info(Db),
                            Info
                        after
                            couch_db:close(Db)
                        end,
  
                    {VDataSize, VFileSize} = db_size_info(DbInfo),
                    {AccDataSize + VDataSize, AccFileSize + VFileSize}
            end, {0, 0}, SampleVBucketDbs),
  
      %% rarely our sample selection routine can return zero samples;
      %% we need to handle it
      case NumSamples of
          0 ->
              {0, 0};
          _ ->
              {round(DataSize * (NumVBuckets / NumSamples)),
               round(FileSize * (NumVBuckets / NumSamples))}
      end.
  
  db_size_info(DbInfo) ->
      FileSize = proplists:get_value(disk_size, DbInfo),
      DataSize = proplists:get_value(data_size, DbInfo, 0),
  
      {DataSize, FileSize}.
  
  check_fragmentation({FragLimit, FragSizeLimit}, Frag, FragSize) ->
      true = is_integer(FragLimit),
  
negative.code:     proc_lib:spawn_link(
        fun () ->
                VBucketDbs = all_bucket_dbs(BucketName),
                Total = length(VBucketDbs),
  
                DoCompact =
                    case Force of
  