anchor.diff:  %% @doc This is the only partition being updated by a transaction,
   %%      thus this function performs both the prepare and commit for the
   %%      coordinator that sent the request.
  -handle_command({single_commit, Transaction, WriteSet}, _Sender,
  -    State = #state{partition = _Partition,
  -        committed_tx = CommittedTx,
  -        prepared_tx = PreparedTx,
  +handle_command({single_commit, Transaction, WriteSet}, _Sender, State = #state{
  +    prepared_tx = PreparedTx,
  +    committed_tx = CommittedTx,
       prepared_dict = PreparedDict
  -    }) ->
  +}) ->
  +
       PrepareTime = dc_utilities:now_microsec(),
       {Result, NewPrepare, NewPreparedDict} = prepare(Transaction, WriteSet, CommittedTx, PreparedTx, PrepareTime, PreparedDict),
       NewState = State#state{prepared_dict = NewPreparedDict},
       case Result of
  +        {error, timeout} ->
  +            {reply, {error, timeout}, NewState};
  +
  +        {error, no_updates} ->
  +            {reply, {error, no_tx_record}, NewState};
  +
  +        {error, write_conflict} ->
  +            {reply, abort, State};
  +
           {ok, _} ->
               ResultCommit = commit(Transaction, NewPrepare, WriteSet, CommittedTx, NewState),
               case ResultCommit of
                   {ok, committed, NewPreparedDict2} ->
                       {reply, {committed, NewPrepare}, NewState#state{prepared_dict = NewPreparedDict2}};
  -                {error, materializer_failure} ->
  -                    {reply, {error, materializer_failure}, NewState};
  -                {error, timeout} ->
  -                    {reply, {error, timeout}, NewState};
  +
                   {error, no_updates} ->
  -                    {reply, no_tx_record, NewState}
  -            end;
  -        {error, timeout} ->
  -            {reply, {error, timeout}, NewState};
  -        {error, no_updates} ->
  -            {reply, {error, no_tx_record}, NewState};
  -        {error, write_conflict} ->
  -            {reply, abort, State}
  +                    {reply, no_tx_record, NewState};
  +
  +                {error, Reason} ->
  +                    {reply, {error, Reason}, NewState}
  +            end
       end;
  -
   
   %% TODO: sending empty writeset to clocksi_downstream_generatro
   %% Just a workaround, need to delete downstream_generator_vnode
   %% eventually.
  -handle_command({commit, Transaction, TxCommitTime, Updates}, _Sender,
  -    #state{partition = _Partition,
  -        committed_tx = CommittedTx
  -    } = State) ->
  +handle_command({commit, Transaction, TxCommitTime, Updates}, _Sender, State = #state{
  +    committed_tx = CommittedTx
  +}) ->
  +
       Result = commit(Transaction, TxCommitTime, Updates, CommittedTx, State),
       case Result of
           {ok, committed, NewPreparedDict} ->
               {reply, committed, State#state{prepared_dict = NewPreparedDict}};
  -        {error, materializer_failure} ->
  -            {reply, {error, materializer_failure}, State};
  -        {error, timeout} ->
  -            {reply, {error, timeout}, State};
  +
           {error, no_updates} ->
  -            {reply, no_tx_record, State}
  +            {reply, no_tx_record, State};
  +
  +        {error, Reason} ->
  +            {reply, {error, Reason}, State}
       end;
   
  -handle_command({abort, Transaction, Updates}, _Sender,
  -    #state{partition = _Partition} = State) ->
  +handle_command({abort, Transaction, Updates}, _Sender, State) ->
       TxId = Transaction#transaction.txn_id,
       case Updates of
           [{Key, _Type,  _Update} | _Rest] ->
               LogId = log_utilities:get_logid_from_key(Key),
               Node = log_utilities:get_key_partition(Key),
               LogRecord = #log_operation{tx_id = TxId, op_type = abort, log_payload = #abort_log_payload{}},
  -            Result = logging_vnode:append(Node, LogId, LogRecord),
  -            %% Result = logging_vnode:append(Node, LogId, {TxId, aborted}),
  -            NewPreparedDict = case Result of
  -                  {ok, _} ->
  -                      clean_and_notify(TxId, Updates, State);
  -                  {error, timeout} ->
  -                      clean_and_notify(TxId, Updates, State)
  -                  end,
  +            _Result = logging_vnode:append(Node, LogId, LogRecord),
  +            NewPreparedDict = clean_and_notify(TxId, Updates, State),
               {reply, ack_abort, State#state{prepared_dict = NewPreparedDict}};
  +
           _ ->
               {reply, {error, no_tx_record}, State}
       end;
   
  -handle_command({get_active_txns}, _Sender,
  -    #state{partition = Partition} = State) ->
  +handle_command({get_active_txns}, _Sender, State = #state{partition = Partition}) ->
       {reply, get_active_txns_internal(Partition), State};
   
   handle_command(_Message, _Sender, State) ->
  
positive.code: %%          write_set: a list of the write sets that the transactions
  %%              generate.
  %%----------------------------------------------------------------------
  -record(state, {partition :: partition_id(),
      prepared_tx :: cache_id(),
      committed_tx :: cache_id(),
      read_servers :: non_neg_integer(),
      prepared_dict :: list()}).
  
  %%%===================================================================
  %%% API
  
negative.code: init([Partition]) ->
      PreparedTx = open_table(Partition),
      CommittedTx = ets:new(committed_tx, [set]),
      {ok, #state{
          partition = Partition,
          prepared_tx = PreparedTx,
          committed_tx = CommittedTx,
          read_servers = ?READ_CONCURRENCY,
          prepared_dict = orddict:new()
      }}.
  
  %% @doc The table holding the prepared transactions is shared with concurrent
  %%      readers, so they can safely check if a key they are reading is being updated.
  