TryAbort attempts to abort the given transactions which are not already committed..
(ctx context.Context, txns *pb.TxnTimestamps)
| 475 | |
| 476 | // TryAbort attempts to abort the given transactions which are not already committed.. |
| 477 | func (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 |
| 495 | func (s *Server) Timestamps(ctx context.Context, num *pb.Num) (*pb.AssignedIds, error) { |
nothing calls this directly
no test coverage detected