Skip to content

Commit 32fe185

Browse files
reject atomic distributed transaction on savepoints and modified system settings
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
1 parent 83b37b8 commit 32fe185

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

go/vt/vtgate/tx_conn.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,14 @@ func (txc *TxConn) commit2PC(ctx context.Context, session *SafeSession) (err err
191191
_ = txc.Rollback(ctx, session)
192192
return vterrors.New(vtrpcpb.Code_FAILED_PRECONDITION, "pre or post actions not allowed for 2PC commits")
193193
}
194+
if len(session.GetSavepoints()) != 0 {
195+
_ = txc.Rollback(ctx, session)
196+
return vterrors.New(vtrpcpb.Code_FAILED_PRECONDITION, "savepoints not allowed for 2PC commits")
197+
}
198+
if session.GetInReservedConn() {
199+
_ = txc.Rollback(ctx, session)
200+
return vterrors.New(vtrpcpb.Code_FAILED_PRECONDITION, "system settings/temporary table are not allowed for 2PC commits")
201+
}
194202

195203
// If the number of participants is one or less, then it's a normal commit.
196204
if len(session.ShardSessions) <= 1 {

0 commit comments

Comments
 (0)