code: func RunInNewTxn(store Storage, retryable bool, f func(txn Transaction) error) error {
  	var (
  		err           error
  		originalTxnTS uint64
  		txn           Transaction
  	)
  	for i := uint(0); i < maxRetryCnt; i++ {
  		txn, err = store.Begin()
  		if err != nil {
  			logutil.Logger(context.Background()).Error("RunInNewTxn", zap.Error(err))
  			return err
  		}
  
  		// originalTxnTS is used to trace the original transaction when the function is retryable.
  		if i == 0 {
  			originalTxnTS = txn.StartTS()
  		}
  
  		err = f(txn)
  		if err != nil {
  			err1 := txn.Rollback()
  			terror.Log(err1)
  			if retryable && IsRetryableError(err) {
  				logutil.Logger(context.Background()).Warn("RunInNewTxn",
  					zap.Uint64("retry txn", txn.StartTS()),
  					zap.Uint64("original txn", originalTxnTS),
  					zap.Error(err))
  				continue
  			}
  			return err
  		}
  
  		err = txn.Commit(context.Background())
  		if err == nil {
  			break
  		}
  		if retryable && IsRetryableError(err) {
  			logutil.Logger(context.Background()).Warn("RunInNewTxn",
  				zap.Uint64("retry txn", txn.StartTS()),
  				zap.Uint64("original txn", originalTxnTS),
  				zap.Error(err))
  			BackOff(i)
  			continue
  		}
  		return err
  	}
  	return err
  }
docs: // RunInNewTxn will run the f in a new transaction environment.