matrixorigin / matrixorigin/matrixone
[Feature Request] MySQL 8.0 Transaction Compatibility - XA and SAVEPOINT
- Dominant language
- Go
- Stars
- 1.9k
- Forks
- 311
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 768
Description
## Overview
MatrixOne v3.0 lacks support for advanced transaction features: XA distributed transactions and SAVEPOINT rollback.
## Environment
- **MatrixOne Version**: 8.0.30-MatrixOne-v3.0:5e4210029
- **Reference**: https://dev.mysql.com/doc/refman/8.0/en/sql-statements.html
---
## 1. ROLLBACK TO SAVEPOINT
### Current Behavior
```sql
START TRANSACTION;
SAVEPOINT sp1;
-- some operations
ROLLBACK TO SAVEPOINT sp1;
```
**Error:**
```
ERROR 20101 (HY000): internal error: savepoint has not been implemented yet
```
### Expected Behavior (MySQL 8.0)
Partially rollback to a previously defined savepoint within a transaction.
### Workaround
Either commit or rollback the entire transaction:
```sql
-- Option 1: Accept the operations
COMMIT;
-- Option 2: Cancel everything
ROLLBACK;
```
### Use Cases
- Complex business transactions with multiple stages
- Batch processing with partial failure handling
- Nested transaction-like behavior
---
## 2. XA Transactions (Distributed Transactions)
### Current Behavior
```sql
XA START 'xid1';
-- SQL operations
XA END 'xid1';
XA PREPARE 'xid1';
XA COMMIT 'xid1';
```
**Error:**
```
ERROR 1064 (HY000): SQL parser error: You have an error in your SQL syntax
```
All XA commands are not supported:
- `XA START`
- `XA END`
- `XA PREPARE`
- `XA COMMIT`
- `XA ROLLBACK`
- `XA RECOVER`
### Expected Behavior (MySQL 8.0)
Two-phase commit protocol for distributed transactions across multiple resources.
### Workaround
Use standard single-database transactions:
```sql
START TRANSACTION;
-- SQL operations
COMMIT;
-- or ROLLBACK on error
```
For distributed transactions, use application-level coordination (e.g., Saga pattern).
### Use Cases
- Distributed systems with multiple databases
- Microservices architectures requiring ACID across services
- Integration with external transaction managers
---
## Priority Assessment
| Feature | Priority | Impact | Common Usage |
|---------|----------|--------|--------------|
| ROLLBACK TO SAVEPOINT | **Medium** | Medium | Complex transactions |
| XA Transactions | **Low** | High | Distributed systems (rare in single DB) |
---
## Recommendation
**ROLLBACK TO SAVEPOINT** is recommended as medium priority:
1. Useful for complex business logic
2. Commonly used in stored procedures (though stored procedures aren't supported either)
3. Provides finer transaction control
**XA Transactions** is low priority for MatrixOne as:
1. It's primarily for distributed transaction coordinators
2. Applications needing this usually use external transaction managers
3. Can be replaced with Saga pattern in microservices
---
Contributor guide
Assessment
This issue has not been assessed yet.