Ladybug version
v0.16.1
What operating system are you using?
ubuntu24.04
What happened?
BEGIN TRANSACTION;
CREATE (:Person {id: 'p015', name: '测试用户', age: 25});
CREATE (:Department {id: 'd007', name: '测试部', headcount: 1});
COMMIT;
Examples showing the differences between two scenarios
Scenario A: The first statement succeeds, the second failsA manual transaction T1 is started via BEGIN.Creating the Person node succeeds, and the modification is recorded in T1 without being committed.Creating the Department node fails and triggers an exception.The transaction framework catches the exception and rolls back the current transaction.See lines 597 and 616 in client_context.cpp.
All changes within T1 (including the previously created Person node) are rolled back together.The subsequent COMMIT statement will throw the error "No active transaction".See line 57 in transaction.cpp.
As a result, the Person node does not exist. This is a standard full transaction rollback.
Scenario B: The first statement fails, the second succeedsTransaction T1 is started with BEGIN.The creation of the Person node fails first, and T1 is rolled back and cleared immediately.The connection reverts to auto-commit mode. See line 72 in transaction_context.cpp.
The script continues to execute the next CREATE Department statement. This statement runs in a brand-new auto-commit transaction and gets committed successfully.
No active transaction exists when executing COMMIT, which leads to an error.
Hence the existing Department node does not break transaction atomicity.The actual reason is that the script keeps executing subsequent statements after failure, and the following statement is no longer involved in the original transaction.
I think manual transaction should make sure all statement are All or nothing right?
Are there known steps to reproduce?
No response
Ladybug version
v0.16.1
What operating system are you using?
ubuntu24.04
What happened?
BEGIN TRANSACTION;
CREATE (:Person {id: 'p015', name: '测试用户', age: 25});
CREATE (:Department {id: 'd007', name: '测试部', headcount: 1});
COMMIT;
Examples showing the differences between two scenarios
Scenario A: The first statement succeeds, the second failsA manual transaction T1 is started via BEGIN.Creating the Person node succeeds, and the modification is recorded in T1 without being committed.Creating the Department node fails and triggers an exception.The transaction framework catches the exception and rolls back the current transaction.See lines 597 and 616 in client_context.cpp.
All changes within T1 (including the previously created Person node) are rolled back together.The subsequent COMMIT statement will throw the error "No active transaction".See line 57 in transaction.cpp.
As a result, the Person node does not exist. This is a standard full transaction rollback.
Scenario B: The first statement fails, the second succeedsTransaction T1 is started with BEGIN.The creation of the Person node fails first, and T1 is rolled back and cleared immediately.The connection reverts to auto-commit mode. See line 72 in transaction_context.cpp.
The script continues to execute the next CREATE Department statement. This statement runs in a brand-new auto-commit transaction and gets committed successfully.
No active transaction exists when executing COMMIT, which leads to an error.
Hence the existing Department node does not break transaction atomicity.The actual reason is that the script keeps executing subsequent statements after failure, and the following statement is no longer involved in the original transaction.
I think manual transaction should make sure all statement are All or nothing right?
Are there known steps to reproduce?
No response