// Commit commits all operations in the batch.
184675
func (b *FailBatch) Commit() error {
	if err := b.dstore.errfunc("batch-commit"); err != nil {
		return err
	}

	return b.cb.Commit()
}
1264003
func (op *noOpUpgrade) Commit(state State) (*State, error) {
	change := stateChange{
		Kind: RunHook,
		Step: Queued,
		Hook: &hook.Info{Kind: hooks.UpgradeCharm},
	}
	newState := change.apply(state)
	return newState, nil
}
1023499
func (db *Database) Commit() error {
	err := db.db.(*sql.Tx).Commit()
	// restore connection
	db.db = db.connection
	db.clear()
	return err
}
333399
func (g *Git) Commit(message string) *command.Model {
	return g.command("commit", "-m", message)
}
956790
func (bw *blobWriter) Commit(ctx context.Context, desc distribution.Descriptor) (distribution.Descriptor, error) {
	dcontext.GetLogger(ctx).Debug("(*blobWriter).Commit")

	if err := bw.fileWriter.Commit(); err != nil {
		return distribution.Descriptor{}, err
	}

	bw.Close()
	desc.Size = bw.Size()

	canonical, err := bw.validateBlob(ctx, desc)
	if err != nil {
		return distribution.Descriptor{}, err
	}

	if err := bw.moveBlob(ctx, canonical); err != nil {
		return distribution.Descriptor{}, err
	}

	if err := bw.blobStore.linkBlob(ctx, canonical, desc.Digest); err != nil {
		return distribution.Descriptor{}, err
	}

	if err := bw.removeResources(ctx); err != nil {
		return distribution.Descriptor{}, err
	}

	err = bw.blobStore.blobAccessController.SetDescriptor(ctx, canonical.Digest, canonical)
	if err != nil {
		return distribution.Descriptor{}, err
	}

	bw.committed = true
	return canonical, nil
}
419017
func (f *Facade) Commit(ctx datastore.Context, ctrID, message string, tags []string, snapshotSpacePercent int) (string, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.Commit"))
	logger := plog.WithField("containerid", ctrID)
	tenantID, err := f.dfs.Commit(ctrID)
	if err != nil {
		logger.WithError(err).Debug("Could not commit container")
		return "", err
	}
	logger = logger.WithField("tenantid", tenantID)
	snapshotID, err := f.Snapshot(ctx, tenantID, message, tags, snapshotSpacePercent)
	if err != nil {
		logger.WithError(err).Debug("Could not snapshot tenant")
		return "", err
	}
	return snapshotID, nil
}
1208659
func (st *TxnState) Commit(ctx context.Context) error {
	defer st.reset()
	if len(st.mutations) != 0 || len(st.dirtyTableOP) != 0 || st.buf.Len() != 0 {
		logutil.Logger(context.Background()).Error("the code should never run here",
			zap.String("TxnState", st.GoString()),
			zap.Stack("something must be wrong"))
		return errors.New("invalid transaction")
	}
	if st.doNotCommit != nil {
		if err1 := st.Transaction.Rollback(); err1 != nil {
			logutil.Logger(context.Background()).Error("rollback error", zap.Error(err1))
		}
		return errors.Trace(st.doNotCommit)
	}

	// mockCommitError8942 is used for PR #8942.
	failpoint.Inject("mockCommitError8942", func(val failpoint.Value) {
		if val.(bool) {
			failpoint.Return(kv.ErrRetryable)
		}
	})

	// mockCommitRetryForAutoID is used to mock an commit retry for adjustAutoIncrementDatum.
	failpoint.Inject("mockCommitRetryForAutoID", func(val failpoint.Value) {
		if val.(bool) && !mockAutoIDRetry() {
			enableMockAutoIDRetry()
			failpoint.Return(kv.ErrRetryable)
		}
	})

	return st.Transaction.Commit(ctx)
}
1050644
func (w *bulkWorker) commit(ctx context.Context) error {
	var res *BulkResponse

	// commitFunc will commit bulk requests and, on failure, be retried
	// via exponential backoff
	commitFunc := func() error {
		var err error
		// Save requests because they will be reset in service.Do
		reqs := w.service.requests
		res, err = w.service.Do(ctx)
		if err == nil {
			// Overall bulk request was OK.  But each bulk response item also has a status
			if w.p.retryItemStatusCodes != nil && len(w.p.retryItemStatusCodes) > 0 {
				// Check res.Items since some might be soft failures
				if res.Items != nil && res.Errors {
					// res.Items will be 1 to 1 with reqs in same order
					for i, item := range res.Items {
						for _, result := range item {
							if _, found := w.p.retryItemStatusCodes[result.Status]; found {
								w.service.Add(reqs[i])
								if err == nil {
									err = ErrBulkItemRetry
								}
							}
						}
					}
				}
			}
		}
		return err
	}
	// notifyFunc will be called if retry fails
	notifyFunc := func(err error) {
		w.p.c.errorf("elastic: bulk processor %q failed but may retry: %v", w.p.name, err)
	}

	id := atomic.AddInt64(&w.p.executionId, 1)

	// Update # documents in queue before eventual retries
	w.p.statsMu.Lock()
	if w.p.wantStats {
		w.p.stats.Workers[w.i].Queued = int64(len(w.service.requests))
	}
	w.p.statsMu.Unlock()

	// Save requests because they will be reset in commitFunc
	reqs := w.service.requests

	// Invoke before callback
	if w.p.beforeFn != nil {
		w.p.beforeFn(id, reqs)
	}

	// Commit bulk requests
	err := RetryNotify(commitFunc, w.p.backoff, notifyFunc)
	w.updateStats(res)
	if err != nil {
		w.p.c.errorf("elastic: bulk processor %q failed: %v", w.p.name, err)
	}

	// Invoke after callback
	if w.p.afterFn != nil {
		w.p.afterFn(id, reqs, res, err)
	}

	return err
}
1097765
func (op *Operation) Commit() error {
	opts := op.buildOptions()
	if len(opts) == 0 {
		return nil
	}
	op.logger.Info("running sgdisk with options: %v", opts)
	cmd := exec.Command(distro.SgdiskCmd(), opts...)
	if _, err := op.logger.LogCmd(cmd, "deleting %d partitions and creating %d partitions on %q", len(op.deletions), len(op.parts), op.dev); err != nil {
		return fmt.Errorf("create partitions failed: %v", err)
	}

	return nil
}
268614
func (c *ConfigStorage) Commit() error {
	if !c.set {
		return nil
	}

	cfg, err := c.temporal.Config()
	if err != nil {
		return err
	}

	return c.ConfigStorer.SetConfig(cfg)
}
1088219
func (b *SimulatedBackend) Commit() {
	b.mu.Lock()
	defer b.mu.Unlock()

	if _, err := b.blockchain.InsertChain([]*types.Block{b.pendingBlock}); err != nil {
		panic(err) // This cannot happen unless the simulator is wrong, fail in that case
	}
	b.rollback()
}
508001
func (tx *Txn) Commit(ctx context.Context) (err error) {
	if tx.db.closed {
		return fmt.Errorf("Commit() called on a closed connection")
	}
	tx.db.Debug("Commit()")

	if len(tx.ops) == 0 {
		return nil
	}

	// go-redis

	pipeline := tx.db.client.TxPipeline()
	for _, op := range tx.ops {
		if op.del {
			pipeline.Del(op.key)
		} else {
			pipeline.Set(op.key, op.value, 0)
		}
	}
	_, err = pipeline.Exec()
	if err != nil {
		// Redis cluster won't let you run multi-key commands in case of cross slot.
		// - Cross slot check may be useful indicator in case of failure.
		if _, yes := tx.db.client.(*goredis.ClusterClient); yes {
			checkCrossSlot(tx)
		}
		return fmt.Errorf("%T.Exec() failed: %s", pipeline, err)
	}
	return nil
}
1171728
func (t *Transaction) Commit() error {
	if !t.closed {
		t.closed = true
		if t.dbmap.logger != nil {
			now := time.Now()
			defer t.dbmap.trace(now, "commit;")
		}
		return t.tx.Commit()
	}

	return sql.ErrTxDone
}
1052613
func (s *Snapshotter) Commit(ctx context.Context, name, key string, opts ...snapshots.Opt) error {
	log.G(ctx).WithFields(logrus.Fields{"name": name, "key": key}).Debug("commit")

	return s.withTransaction(ctx, true, func(ctx context.Context) error {
		id, _, _, err := storage.GetInfo(ctx, key)
		if err != nil {
			return err
		}

		deviceName := s.getDeviceName(id)
		size, err := s.pool.GetUsage(deviceName)
		if err != nil {
			return err
		}

		usage := snapshots.Usage{
			Size: size,
		}

		_, err = storage.CommitActive(ctx, key, name, usage, opts...)
		return err
	})
}
1121722
func (tx *bytesTxn) Commit(ctx context.Context) error {
	_, err := tx.kv.Txn(ctx).Then(tx.ops...).Commit()
	return err
}
555139
func (te *TxEngine) Commit(ctx context.Context, transactionID int64, mc messageCommitter) (string, error) {
	span, ctx := trace.NewSpan(ctx, "TxEngine.Commit")
	defer span.Finish()
	return te.txPool.Commit(ctx, transactionID, mc)
}
1117570
func (fa *failAction) Commit(state State) (*State, error) {
	return stateChange{
		Kind: continuationKind(state),
		Step: Pending,
		Hook: state.Hook,
	}.apply(state), nil
}