// Rollback mocks base method
3719
func (m *MockTransactional) Rollback(arg0 context.Context) error {
	ret := m.ctrl.Call(m, "Rollback", arg0)
	ret0, _ := ret[0].(error)
	return ret0
}
450066
func (s *session) rollbackOnError(ctx context.Context) {
	if !s.sessionVars.InTxn() {
		s.RollbackTxn(ctx)
	}
}
192816
func (s *ReleaseServer) RollbackRelease(c ctx.Context, req *services.RollbackReleaseRequest) (*services.RollbackReleaseResponse, error) {
	s.Log("preparing rollback of %s", req.Name)
	currentRelease, targetRelease, err := s.prepareRollback(req)
	if err != nil {
		return nil, err
	}

	if !req.DryRun {
		s.Log("creating rolled back release for %s", req.Name)
		if err := s.env.Releases.Create(targetRelease); err != nil {
			return nil, err
		}
	}
	s.Log("performing rollback of %s", req.Name)
	res, err := s.performRollback(currentRelease, targetRelease, req)
	if err != nil {
		return res, err
	}

	if !req.DryRun {
		s.Log("updating status for rolled back release for %s", req.Name)
		if err := s.env.Releases.Update(targetRelease); err != nil {
			return res, err
		}
	}

	return res, nil
}
220512
func (h *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.RollbackReleaseResponse, error) {
	reqOpts := h.opts
	for _, opt := range opts {
		opt(&reqOpts)
	}
	req := &reqOpts.rollbackReq
	req.Recreate = reqOpts.recreate
	req.Force = reqOpts.force
	req.DisableHooks = reqOpts.disableHooks
	req.DryRun = reqOpts.dryRun
	req.Name = rlsName
	ctx := NewContext()

	if reqOpts.before != nil {
		if err := reqOpts.before(ctx, req); err != nil {
			return nil, err
		}
	}
	return h.rollback(ctx, req)
}
1111745
func (r *ReleaseModuleServiceServer) RollbackRelease(ctx context.Context, in *rudderAPI.RollbackReleaseRequest) (*rudderAPI.RollbackReleaseResponse, error) {
	grpclog.Print("rollback")
	c := bytes.NewBufferString(in.Current.Manifest)
	t := bytes.NewBufferString(in.Target.Manifest)
	err := kubeClient.UpdateWithOptions(in.Target.Namespace, c, t, kube.UpdateOptions{
		Force:         in.Force,
		Recreate:      in.Recreate,
		Timeout:       in.Timeout,
		ShouldWait:    in.Wait,
		CleanupOnFail: in.CleanupOnFail,
	})
	return &rudderAPI.RollbackReleaseResponse{}, err
}
754189
func (v *DeviceMapperVolume) Rollback(label string) error {
	if v.isInvalidSnapshot(label) {
		return volume.ErrInvalidSnapshot
	}

	glog.V(2).Infof("Rollback() (%s) START", v.name)
	defer glog.V(2).Infof("Rollback() (%s) END", v.name)
	if !v.snapshotExists(label) {
		return volume.ErrSnapshotDoesNotExist
	}
	label = v.rawSnapshotLabel(label)
	v.Lock()
	defer v.Unlock()

	// Get the hash of the current device and of the snapshot
	curDeviceHash := v.deviceHash()
	snapDeviceHash, err := v.Metadata.LookupSnapshotDevice(label)
	if err != nil {
		return err
	}

	// Make a new device for the snapshot to load
	newDeviceHash, err := v.driver.addDevice(snapDeviceHash)
	if err != nil {
		return err
	}
	glog.V(2).Infof("Created new head device %s based on snapshot %s", newDeviceHash, snapDeviceHash)

	// Unmount the current device and mount the new one
	if err := v.unmount(); err != nil {
		return err
	}
	glog.V(2).Infof("Unmounted old head device %s", curDeviceHash)

	// Rollback to the new device
	if err := v.driver.DeviceSet.MountDevice(newDeviceHash, v.path, v.name); err != nil {
		return err
	}
	glog.V(2).Infof("Rollback(): mounting new head device %s", newDeviceHash)

	// Clean up the old device
	v.driver.DeviceSet.Lock()
	if err := v.driver.DeactivateDevice(curDeviceHash); err != nil {
		glog.V(2).Infof("Could not remove device: %s", err)
	} else {
		glog.V(2).Infof("Deactivated old head device %s", curDeviceHash)
	}
	v.driver.DeviceSet.Unlock()
	if err := v.driver.deleteDevice(curDeviceHash, false); err != nil {
		glog.Warningf("Error cleaning up old head device %s: %s", curDeviceHash, err)
	} else {
		glog.V(2).Infof("Deleted old head device %s", curDeviceHash)
	}

	return v.Metadata.SetCurrentDevice(newDeviceHash)
}
1074618
func (dfs *DistributedFilesystem) Rollback(snapshotID string) error {
	vol, info, err := dfs.getSnapshotVolumeAndInfo(snapshotID)
	if err != nil {
		return err
	}
	// do all the images exist in the registry?
	r, err := vol.ReadMetadata(info.Label, ImagesMetadataFile)
	if err != nil {
		glog.Errorf("Could not receive images metadata from snapshot %s: %s", snapshotID, err)
		return err
	}
	var images []string
	if err := importJSON(r, &images); err != nil {
		glog.Errorf("Could not interpret images metadata file from snapshot %s: %s", snapshotID, err)
		return err
	}
	for _, image := range images {
		rImage, err := dfs.index.FindImage(image)
		if err != nil {
			glog.Errorf("Could not find image %s from snapshot %s: %s", image, snapshotID, err)
			return err
		}
		rImage.Tag = docker.Latest
		if err := dfs.index.PushImage(rImage.String(), rImage.UUID, rImage.Hash); err != nil {
			glog.Errorf("Could not update image %s from snapshot %s in the registry: %s", image, snapshotID, err)
			return err
		}
	}
	if err := dfs.unexport(vol.Path()); err != nil {
		glog.Errorf("Could not unexport path %s: %s", vol.Path(), err)
		return err
	}
	defer dfs.export(vol.Path())
	if err := vol.Rollback(info.Label); err != nil {
		glog.Errorf("Could not rollback snapshot %s for tenant %s: %s", snapshotID, info.TenantID, err)
		return err
	}
	return nil
}
1129063
func (axp *TxPool) Rollback(ctx context.Context, transactionID int64) error {
	span, ctx := trace.NewSpan(ctx, "TxPool.Rollback")
	defer span.Finish()

	conn, err := axp.Get(transactionID, "for rollback")
	if err != nil {
		return err
	}
	return axp.localRollback(ctx, conn)
}
265596
func Rollback(c *deis.Client, appID string, version int) (int, error) {
	u := fmt.Sprintf("/v2/apps/%s/releases/rollback/", appID)

	req := api.ReleaseRollback{Version: version}

	var err error
	var reqBody []byte
	if version != -1 {
		reqBody, err = json.Marshal(req)

		if err != nil {
			return -1, err
		}
	}

	res, reqErr := c.Request("POST", u, reqBody)
	if reqErr != nil && !deis.IsErrAPIMismatch(reqErr) {
		return -1, reqErr
	}
	defer res.Body.Close()

	response := api.ReleaseRollback{}

	if err = json.NewDecoder(res.Body).Decode(&response); err != nil {
		return -1, err
	}

	return response.Version, reqErr
}
209909
func (bc *BlockChain) Rollback(chain []common.Hash) {
	bc.chainmu.Lock()
	defer bc.chainmu.Unlock()

	for i := len(chain) - 1; i >= 0; i-- {
		hash := chain[i]

		currentHeader := bc.hc.CurrentHeader()
		if currentHeader.Hash() == hash {
			bc.hc.SetCurrentHeader(bc.GetHeader(currentHeader.ParentHash, currentHeader.Number.Uint64()-1))
		}
		if currentFastBlock := bc.CurrentFastBlock(); currentFastBlock.Hash() == hash {
			newFastBlock := bc.GetBlock(currentFastBlock.ParentHash(), currentFastBlock.NumberU64()-1)
			bc.currentFastBlock.Store(newFastBlock)
			rawdb.WriteHeadFastBlockHash(bc.db, newFastBlock.Hash())
		}
		if currentBlock := bc.CurrentBlock(); currentBlock.Hash() == hash {
			newBlock := bc.GetBlock(currentBlock.ParentHash(), currentBlock.NumberU64()-1)
			bc.currentBlock.Store(newBlock)
			rawdb.WriteHeadBlockHash(bc.db, newBlock.Hash())
		}
	}
}
1330048
func (q *Qbs) Rollback() error {
	err := q.tx.Rollback()
	q.tx = nil
	for _, v := range q.txStmtMap {
		v.Close()
	}
	q.txStmtMap = nil
	return q.updateTxError(err)
}
309704
func (tx *transaction) Rollback() error {
	// Prevent rollbacks on managed transactions.
	if tx.managed {
		tx.close()
		panic("managed transaction rollback not allowed")
	}

	// Ensure transaction state is valid.
	if err := tx.checkClosed(); err != nil {
		return err
	}

	tx.close()
	return nil
}
567527
func (ctx *workflowContext) registerRollback(userFunction spartaS3.RollbackFunction) {
	if nil == ctx.transaction.rollbackFunctions || len(ctx.transaction.rollbackFunctions) <= 0 {
		ctx.transaction.rollbackFunctions = make([]spartaS3.RollbackFunction, 0)
	}
	ctx.transaction.rollbackFunctions = append(ctx.transaction.rollbackFunctions, userFunction)
}
1204474
func (tx *Tx) Rollback() error {
	_assert(!tx.managed, "managed tx rollback not allowed")
	if tx.db == nil {
		return ErrTxClosed
	}
	tx.rollback()
	return nil
}
173083
func (tx *VTGateTx) Rollback(ctx context.Context) error {
	if tx.session == nil {
		return nil
	}
	err := tx.conn.impl.Rollback(ctx, tx.session)
	tx.session = nil
	return err
}
677866
func (sbc *SandboxConn) RollbackPrepared(ctx context.Context, target *querypb.Target, dtid string, originalID int64) (err error) {
	sbc.RollbackPreparedCount.Add(1)
	if sbc.MustFailRollbackPrepared > 0 {
		sbc.MustFailRollbackPrepared--
		return vterrors.New(vtrpcpb.Code_FAILED_PRECONDITION, "error: err")
	}
	return sbc.getError()
}
1133291
func (n *node) Rollback() error {
	if n.tx == nil {
		return ErrNotInTransaction
	}

	err := n.tx.Rollback()
	if err == bolt.ErrTxClosed {
		return ErrNotInTransaction
	}

	return err
}