Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-9328

Don't remove the update from the transaction if it has been inserted to the update chain

    • 3
    • Storage - Ra 2022-05-30
    • v6.0

         inserted_to_update_chain = true;
      
          /* If the update was successful, add it to the in-memory log. */
          if (logged && modify_type != WT_UPDATE_RESERVE) {
              if (__wt_log_op(session))
                  WT_ERR(__wt_txn_log_op(session, cbt));
      
              /*
               * Set the key in the transaction operation to be used in case this transaction is prepared
               * to retrieve the update corresponding to this operation.
               */
              WT_ERR(__wt_txn_op_set_key(session, key));
          }
      
          if (0) {
      err:
              /* Remove the update from the current transaction, don't try to modify it on rollback. */
              if (logged)
                  __wt_txn_unmodify(session);
      
              /* Free any allocated insert list object. */
              __wt_free(session, ins);
      
              cbt->ins = NULL;
      
              /* Discard any allocated update, unless we failed after linking it into page memory. */
              if (upd_arg == NULL && !inserted_to_update_chain)
                  __wt_free(session, upd);
      
              /*
               * When prepending a list of updates to an update chain, we link them together; sever that
               * link so our callers list doesn't point into page memory.
               */
              if (last_upd != NULL)
                  last_upd->next = NULL;
          }
      

      In __wt_row_modify, we set inserted_to_update_chain to true if we have inserted it to the update chain. However, if we fail after that, we will remove it from the transaction's operation list but we never abort it on the update chain. If rollback is called, the operation on the update chain will never be aborted.

            Assignee:
            chenhao.qu@mongodb.com Chenhao Qu
            Reporter:
            chenhao.qu@mongodb.com Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated:
              Resolved: