anchor.diff:       {progress, Progress}].
   
   
  -finalize_xcdr_plist({ChangesLeft, DocsChecked, DocsWritten, DataReplicated,
  -                     ActiveVbReps, WaitingVbReps, TimeWorking, TimeCommitting,
  -                     NumCheckpoints, DocsRepQueue, SizeRepQueue, Errors}) ->
  +finalize_xcdr_plist({ChangesLeft, DocsChecked, DocsWritten, Errors}) ->
       FlattenedErrors = lists:flatten(Errors),
       SortedErrors = lists:reverse(lists:sort(FlattenedErrors)),
       Len = length(SortedErrors),
  
positive.code:                {ChangesDone2, TotalChanges2}) ->
      {ChangesDone1 + ChangesDone2, TotalChanges1 + TotalChanges2};
  task_operation(fold, {xdcr, _},
                {ChangesLeft1, DocsChecked1, DocsWritten1, DataReplicated1,
                 ActiveReps1, WaitingReps1, TimeWorking1, TimeCommitting1,
                 NumCkpts1, DocsRepQueue1, SizeRepQueue1, Errors1},
                {ChangesLeft2, DocsChecked2, DocsWritten2, DataReplicated2,
                 ActiveReps2, WaitingReps2, TimeWorking2, TimeCommitting2,
                 NumCkpts2, DocsRepQueue2, SizeRepQueue2, Errors2}) ->
      {ChangesLeft1 + ChangesLeft2,
       DocsChecked1 + DocsChecked2,
       DocsWritten1 + DocsWritten2,
       DataReplicated1 + DataReplicated2,
       ActiveReps1 + ActiveReps2,
       WaitingReps1 + WaitingReps2,
       TimeWorking1 + TimeWorking2,
       TimeCommitting1 + TimeCommitting2,
       NumCkpts1 + NumCkpts2,
       DocsRepQueue1 + DocsRepQueue2,
       SizeRepQueue1 + SizeRepQueue2,
       [Errors1 | Errors2]}.
  
  
  
negative.code:     {_, ChangesLeft} = lists:keyfind(changes_left, 1, RawTask),
      {_, DocsChecked} = lists:keyfind(docs_checked, 1, RawTask),
      {_, DocsWritten} = lists:keyfind(docs_written, 1, RawTask),
      Errors = proplists:get_value(errors, RawTask, []),
      {_, Id} = lists:keyfind(id, 1, RawTask),
      [{{XDCR, Id}, {ChangesLeft, DocsChecked, DocsWritten, Errors}}];
  task_operation(extract, _, _) ->
      ignore;
  
  