Skip to content
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

Implement Transaction Recovery for XA Resources #42080

Conversation

dsplayerX
Copy link
Contributor

@dsplayerX dsplayerX commented Jan 31, 2024

Purpose

Addresses the need to enhance Ballerina's transaction support by introducing native recovery functionality for distributed transactions, aligning with the XA specification. The primary goal is to eliminate dependency on the Atomikos library (which enables recovery for transactions in Ballerina, but only for databases) by implementing a native recovery mechanism and then extend the support to include transactional microservices. This initiative aims to improve the reliability and fault tolerance of Ballerina transactions.

Partially Implements #42031

Approach

The implementation includes a Log Manager with both in-memory and file-based components for dynamic transaction tracking and persistent storage, respectively. The logging process of transaction states ensures effective recovery process after a system crash due to a runtime crash.
The Recovery Manager handles the recovery processes after a system crash. It collaborates with the Log Manager to identify and address incomplete transactions or states, ensuring a smooth recovery after system crashes before returning to normal operating state. This recovery pass, that run upon startup recovers incomplete transactions in XA Resources from system crashes.

Samples

This feature also introduces 4 new configurations to configure transaction logging. These would porivide inthe Config.toml or with CLI commands.

[ballerina.lang.transaction]
recoveryLogName="recoveryLog"
recoveryLogDir="./logs"
checkpointInterval=10000
deleteOldLogs=true

Remarks

Logging for Transaction Recovery in a 2PC Transaction - ballerina-platform/module-ballerinai-transaction#537
Collect XA Resources for transaction recovery feature - ballerina-platform/module-ballerina-sql#722

Check List

  • Read the Contributing Guide
  • Updated Change Log
  • Checked Tooling Support (#)
  • Added necessary tests
    • Unit Tests
    • Spec Conformance Tests
    • Integration Tests
    • Ballerina By Example Tests
  • Increased Test Coverage
  • Added necessary documentation
    • API documentation
    • Module documentation in Module.md files
    • Ballerina By Examples

@dsplayerX dsplayerX force-pushed the feature-transaction-recovery branch from 7b66b83 to 393d187 Compare June 6, 2024 09:32
@dsplayerX dsplayerX changed the title Implement Transaction Recovery for Ballerina Implement Transaction Recovery for XA Resources Jun 13, 2024
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added Stale and removed Stale labels Jul 10, 2024
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added Stale and removed Stale labels Jul 30, 2024
Copy link

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added Stale and removed Stale labels Aug 19, 2024
Copy link

github-actions bot commented Sep 7, 2024

This PR has been open for more than 15 days with no activity. This will be closed in 3 days unless the stale label is removed or commented.

@github-actions github-actions bot added the Stale label Sep 7, 2024
@gimantha gimantha removed the Stale label Sep 8, 2024
@gimantha gimantha marked this pull request as draft September 10, 2024 03:36
@gimantha gimantha marked this pull request as ready for review October 9, 2024 12:28
@gimantha gimantha requested a review from MaryamZi as a code owner October 9, 2024 12:28
@gimantha gimantha changed the base branch from master to transaction-recovery October 11, 2024 09:13
@gimantha gimantha merged commit 86ae40b into ballerina-platform:transaction-recovery Oct 11, 2024
11 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lang/Transactions Ballerina Transaction and its implementation related issued Team/CompilerFE All issues related to Language implementation and Compiler, this exclude run times.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants