-
Notifications
You must be signed in to change notification settings - Fork 758
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: MySQL Database Not Reflecting Changes Made by Ballerina Transactional Services #41682
[Bug]: MySQL Database Not Reflecting Changes Made by Ballerina Transactional Services #41682
Comments
I tried using the Java JDBC driver with h2 and SQLite databases, and they didn't work either. |
Same behavior with RabbitMQ as well. Participant says |
Was able to narrow it down to the following removing the import ballerina/io;
import ballerina/sql;
import ballerinax/mysql;
import ballerinax/mysql.driver as _;
final sql:ConnectionPool pool = {
maxOpenConnections: 5,
maxConnectionLifeTime: 30,
minIdleConnections: 0
};
final mysql:Client testDB = check new (host = "localhost",
user = "root",
password = "root",
port = 3306, database = "test",
connectionPool = pool,
options = {useXADatasource: true}
);
public function main() returns error? {
transaction {
transaction:onCommit(commitDone);
transaction:onRollback(rollbackDone);
future<error?> result = start callRemoteService();
check wait result;
check commit;
}
}
transactional function callRemoteService() returns error? {
sql:ExecutionResult execResult = check testDB->execute(`INSERT INTO test (hello) VALUES ('world')`);
io:println("Affected row count: ", execResult.affectedRowCount);
io:println("Inserted ID: ", execResult.lastInsertId);
}
isolated function commitDone('transaction:Info info) {
io:println("> Initiator committed.");
}
isolated function rollbackDone(transaction:Info info, error? cause, boolean willRetry) {
io:println("> Initiaor rollbacked.");
}
|
This is a regression issue because of the fix #41080. The issue is not there in 2201.7.x versions. Working on a possible fix ATM |
This is to check fix for ballerina-platform/ballerina-lang#41682
Update lang timestamp for the fix ballerina-platform/ballerina-lang#41682
Update lang timestamp for the fix ballerina-platform/ballerina-lang#41682
Description
The transactional behavior between the initiator and participant services in Ballerina does not reflect committed changes in the MySQL database.
Expected Behavior
Upon a successful transactional commit, the database should reflect the changes made by the participant service.
Actual Behavior
The database appears empty despite the successful commit response from the services. The auto increment ID increases, but no records are visible in the database upon querying.
Example
When calling the service, the services respond with a 202 "Accepted" status code and the values inserted/changes made are not visible in the database.
Initiator Log
Participant Log
But when the database is queried, there is no record with ID 13.
Steps to Reproduce
Minimal Code to Reproduce the Issue
Create required MySQL database and table
Test the service
curl http://localhost:8080/doTransaction
Affected Version(s)
2201.8.2
OS, DB, other environment details and versions
MySQL database: 8.1.0 (running in docker)
Operating System: Windows 10
MySQL Connector
Related area
-> Runtime
Related issue(s) (optional)
No response
Suggested label(s) (optional)
No response
Suggested assignee(s) (optional)
No response
The text was updated successfully, but these errors were encountered: