Esempio n. 1
0
// Rollback2 should not be used by anything other than tests.
// It will eventually replace Rollback, but it breaks compatibility with older clients.
// Once all clients are upgraded, it can be replaced.
func (sq *SqlQuery) Rollback2(ctx context.Context, rollbackRequest *proto.RollbackRequest, rollbackResponse *proto.RollbackResponse) (err error) {
	defer sq.server.HandlePanic(&err)
	session := &proto.Session{
		SessionId:     rollbackRequest.SessionId,
		TransactionId: rollbackRequest.TransactionId,
	}
	tErr := sq.server.Rollback(callinfo.RPCWrapCallInfo(ctx), session)
	tabletserver.AddTabletErrorToRollbackResponse(tErr, rollbackResponse)
	if *tabletserver.RPCErrorOnlyInReply {
		return nil
	}
	return tErr
}
Esempio n. 2
0
// Rollback2 should not be used by anything other than tests.
// It will eventually replace Rollback, but it breaks compatibility with older clients.
// Once all clients are upgraded, it can be replaced.
func (sq *SqlQuery) Rollback2(ctx context.Context, rollbackRequest *proto.RollbackRequest, rollbackResponse *proto.RollbackResponse) (err error) {
	defer sq.server.HandlePanic(&err)
	session := &proto.Session{
		SessionId:     rollbackRequest.SessionId,
		TransactionId: rollbackRequest.TransactionId,
	}
	ctx = callerid.NewContext(ctx,
		callerid.GoRPCEffectiveCallerID(rollbackRequest.EffectiveCallerID),
		callerid.GoRPCImmediateCallerID(rollbackRequest.ImmediateCallerID),
	)
	tErr := sq.server.Rollback(callinfo.RPCWrapCallInfo(ctx), proto.TargetToProto3(rollbackRequest.Target), session)
	tabletserver.AddTabletErrorToRollbackResponse(tErr, rollbackResponse)
	return nil
}