anchor.diff:              tlog_write(Entry, Key, X);
           {ok, _} ->
               Error = {fail, not_a_number},
  -            NewTlogEntry = case tx_tlog:get_entry_status(Entry) of
  -                               {fail, _} -> Entry;
  -                               not_found -> tx_tlog:set_entry_status(Entry, {fail, not_found});
  -                               _ -> tx_tlog:set_entry_status(Entry, Error)
  -                           end,
  -            {NewTlogEntry, Error};
  +            {update_tlog_entry_2phase_op(Entry, Error), Error};
           E when erlang:is_tuple(E) -> %% other previous error
               {Entry, E}
       end.
  
positive.code:             tlog_write(Entry, Key, encode_value(NewValue2));
          {ok, _} -> %% value is not a list
              Error = {fail, not_a_list},
              NewTlogEntry = case tx_tlog:get_entry_status(Entry) of
                                 {fail, _} -> Entry;
                                 not_found -> tx_tlog:set_entry_status(Entry, {fail, not_found});
                                 _ -> tx_tlog:set_entry_status(Entry, Error)
                             end,
              {NewTlogEntry, Error};
          X when erlang:is_tuple(X) -> %% other previous error
              {Entry, X}
      end.
  
negative.code:             E2 = tx_tlog:set_entry_value(E1, Value),
              E3 = tx_tlog:set_entry_status(E2, value),
              {E3, {ok}}
      end.
  
  %% @doc For 2-Phase operations like add_del_on_list and add_on_nr, we need to
  %%      keep any previous error in the tlog status and do not overwrite it with
  %%      the new one. If there is no error yet, set it to the given one.
  -spec update_tlog_entry_2phase_op(Entry::tx_tlog:tlog_entry(), Error::{fail, atom()})
          -> tx_tlog:tlog_entry().
  update_tlog_entry_2phase_op(Entry, Error) ->
      case tx_tlog:get_entry_status(Entry) of
          {fail, _} -> Entry;
          not_found -> tx_tlog:set_entry_status(Entry, {fail, not_found});
          _         -> tx_tlog:set_entry_status(Entry, Error)
      end.
  
  %% @doc Simulate a change on a set via read and write requests.
  