anchor.diff:                      {ok, RemoteFullMeta, RemoteCAS};
                   {ok, key_enoent, RemoteCAS} ->
                       {key_enoent, "key does not exist at remote", RemoteCAS};
  +                %% if timeout in retreiving metadata, we just send the doc optimistically
  +                {timeout, ErrorMsg} ->
  +                    {timeout, ErrorMsg};
                   {memcached_error, ErrorMsg} ->
                       {error, ErrorMsg}
               end,
  
positive.code:             end),
  
      %% receive all responses
      {Flushed, Enoent, Eexist, NotMyVb, Einval, OtherErr, ErrorKeys} =
          lists:foldr(fun(#doc{id = Key} = _Doc,
                          {FlushedAcc, EnoentAcc, EexistsAcc, NotMyVbAcc, EinvalAcc, OtherErrAcc, KeysAcc}) ->
                              case get_flush_response_pipeline(Sock, VBucket) of
                                  {ok, _, _} ->
                                      {FlushedAcc + 1, EnoentAcc, EexistsAcc, NotMyVbAcc, EinvalAcc, OtherErrAcc,
                                       KeysAcc};
                                  {memcached_error, key_enoent, _} ->
                                      {FlushedAcc, EnoentAcc + 1, EexistsAcc, NotMyVbAcc, EinvalAcc, OtherErrAcc,
                                      lists:append(KeysAcc, [Key])};
                                  {memcached_error, key_eexists, _} ->
                                      {FlushedAcc, EnoentAcc, EexistsAcc + 1, NotMyVbAcc, EinvalAcc, OtherErrAcc,
                                       lists:append(KeysAcc, [Key])};
                                  {memcached_error, not_my_vbucket, _} ->
                                      {FlushedAcc, EnoentAcc, EexistsAcc, NotMyVbAcc + 1, EinvalAcc, OtherErrAcc,
                                       lists:append(KeysAcc, [Key])};
                                  {memcached_error, einval, _} ->
                                      {FlushedAcc, EnoentAcc, EexistsAcc, NotMyVbAcc, EinvalAcc + 1, OtherErrAcc,
                                       lists:append(KeysAcc, [Key])};
                                  {memcached_error, error, _} ->
                                      {FlushedAcc, EnoentAcc, EexistsAcc, NotMyVbAcc, EinvalAcc, OtherErrAcc + 1,
                                       lists:append(KeysAcc, [Key])}
                              end
                      end,
                      {0, 0, 0, 0, 0, 0, []}, DocsList),
  
      erlang:unlink(Pid),
      erlang:exit(Pid, kill),
  
negative.code:                                                   _ ->
                                                        false
                                                end;
                                            {timeout, ErrorMsg} ->
                                                ?xdcr_trace("Warning! timeout when fetching metadata from remote for key: ~p, "
                                                            "just send the doc (msg: ~p)", [Key, ErrorMsg]),
                                                true;
                                            {error, ErrorMsg} ->
                                                ?xdcr_error("Error! memcached error when fetching metadata for key: ~p, "
                                                            "just send the doc (msg: ~p)", [Key, ErrorMsg]),
                                                true
                                        end,
                              case Missing of
                                  true ->
  