MCPcopy
hub / github.com/dgraph-io/dgraph / TryAbort

Method TryAbort

dgraph/cmd/zero/oracle.go:477–492  ·  view source on GitHub ↗

TryAbort attempts to abort the given transactions which are not already committed..

(ctx context.Context,
	txns *pb.TxnTimestamps)

Source from the content-addressed store, hash-verified

475
476// TryAbort attempts to abort the given transactions which are not already committed..
477func (s *Server) TryAbort(ctx context.Context,
478 txns *pb.TxnTimestamps) (*pb.OracleDelta, error) {
479 delta := &pb.OracleDelta{}
480 for _, startTs := range txns.Ts {
481 // Do via proposals to avoid race
482 tctx := &api.TxnContext{StartTs: startTs, Aborted: true}
483 if err := s.proposeTxn(ctx, tctx); err != nil {
484 return delta, err
485 }
486 // Txn should be aborted if not already committed.
487 delta.Txns = append(delta.Txns, &pb.TxnStatus{
488 StartTs: startTs,
489 CommitTs: s.orc.commitTs(startTs)})
490 }
491 return delta, nil
492}
493
494// Timestamps is used to assign startTs for a new transaction
495func (s *Server) Timestamps(ctx context.Context, num *pb.Num) (*pb.AssignedIds, error) {

Callers

nothing calls this directly

Calls 2

proposeTxnMethod · 0.95
commitTsMethod · 0.80

Tested by

no test coverage detected