code: func (mvcc *MVCCLevelDB) Prewrite(mutations []*kvrpcpb.Mutation, primary []byte, startTS uint64, ttl uint64) []error {
  	mvcc.mu.Lock()
  	defer mvcc.mu.Unlock()
  
  	anyError := false
  	batch := &leveldb.Batch{}
  	errs := make([]error, 0, len(mutations))
  	for _, m := range mutations {
  		// If the operation is Insert, check if key is exists at first.
  		var err error
  		if m.GetOp() == kvrpcpb.Op_Insert {
  			v, err := mvcc.getValue(m.Key, startTS, kvrpcpb.IsolationLevel_SI)
  			if err != nil {
  				errs = append(errs, err)
  				anyError = true
  				continue
  			}
  			if v != nil {
  				err = &ErrKeyAlreadyExist{
  					Key: m.Key,
  				}
  				errs = append(errs, err)
  				anyError = true
  				continue
  			}
  		}
  		err = prewriteMutation(mvcc.db, batch, m, startTS, primary, ttl)
  		errs = append(errs, err)
  		if err != nil {
  			anyError = true
  		}
  	}
  	if anyError {
  		return errs
  	}
  	if err := mvcc.db.Write(batch, nil); err != nil {
  		return nil
  	}
  
  	return errs
  }
docs: // Prewrite implements the MVCCStore interface.