anchor.diff:          try
               {ok, {_, LastSeq, _, _}} =
                   couch_db:changes_since(Db, StartSeq, Enum, Opts, Acc0),
  -            rexi:reply({complete, {LastSeq, Db#db.uuid, node()}})
  +            rexi:reply({complete, {LastSeq, couch_db:get_uuid(Db), node()}})
           after
               couch_db:close(Db)
           end;
  
positive.code:             ok
      end.
  
  calculate_start_seq(#db{uuid=Uuid1}, {_, Uuid2, _}) when Uuid1 =/= Uuid2 ->
      %% The file was rebuilt, most likely in a different order, so rewind.
      0;
  calculate_start_seq(#db{}=Db, {Seq, _Uuid, Node}) ->
      case owner(Node, Seq, Db#db.epochs) of
          true  -> Seq;
          false -> 0
      end;
  calculate_start_seq(_Db, Seq) when is_integer(Seq) ->
      Seq.
  
  owner(Node, Seq, Epochs) ->
      owner(Node, Seq, Epochs, infinity).
  
negative.code: 
  calculate_start_seq_test() ->
      %% uuid mismatch is always a rewind.
      Hdr1 = couch_db_header:new(),
      Hdr2 = couch_db_header:set(Hdr1, [{uuid, uuid1}]),
      ?assertEqual(0, calculate_start_seq(#db{header=Hdr2}, {1, uuid2, node1})),
      %% uuid matches and seq is owned by node.
      Hdr3 = couch_db_header:set(Hdr2, [{epochs, [{node1, 1}]}]),
      ?assertEqual(2, calculate_start_seq(#db{header=Hdr3}, {2, uuid1, node1})),
      %% uuids match but seq is not owned by node.
      Hdr4 = couch_db_header:set(Hdr2, [{epochs, [{node2, 2}, {node1, 1}]}]),
      ?assertEqual(0, calculate_start_seq(#db{header=Hdr4}, {3, uuid1, node1})),
      %% return integer if we didn't get a vector.
      ?assertEqual(4, calculate_start_seq(#db{}, 4)).
  
  