Global Variable Rollback via Execution Order Tracing
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In distributed systems, ensuring data consistency across multiple services is challenging when transactions fail, especially when multiple services modify the same global variable, as traditional rollback mechanisms may incorrectly revert the global variable's value due to unclear execution order.
Innovation Solution
A method is introduced to track the order in which services change a global variable during transaction execution, generating a rollback execution plan based on this tracing information to correctly undo changes by compensating services, ensuring the global variable is reverted to its initial state upon transaction failure.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If traditional rollback mechanisms are used without tracking execution order, then the rollback process is simple, but data consistency cannot be ensured when multiple services modify the same global variable
Solution Approach 1:
The system performs preliminary tracking of execution order during the forward transaction phase. Before rollback is needed, the tracing information recording the order in which services modified global variables is already captured and stored. This preliminary action ensures that when rollback occurs, the correct sequence is already known, resolving the contradiction between reliability and complexity.
Solution Approach 2:
The system implements feedback by recording tracing information about execution order and using this feedback to determine the correct rollback sequence. The tracing information acts as feedback from the forward execution that guides the rollback process, ensuring data consistency while managing complexity through informed decision-making.
2Reliability
If compensating services are executed without considering execution order, then the rollback process is fast, but the global variable may be reverted to an incorrect state
Solution Approach 1:
The execution order is predetermined and recorded during the forward transaction execution. This preliminary capture of tracing information eliminates the need for complex real-time analysis during rollback, allowing compensating services to be executed quickly in the correct sequence without sacrificing reliability.
3Reliability
If tracing information is collected to determine execution order, then accurate rollback can be achieved, but the system complexity increases
Solution Approach 1:
The system segments the transaction management into distinct phases: forward execution with tracing, failure detection, and rollback execution. The tracing information is segmented as a separate data structure that records only the essential execution order. This segmentation reduces overall system complexity by isolating the tracking mechanism from the core transaction logic while maintaining rollback accuracy.
Data Source
AI summary
Embodiments of the present disclosure relate to rollback of services with a global variable change. Embodiment techniques detect that at least two of a plurality of services in a transaction are executed to change a value of a first global variable. Tracing information is obtained to indicate a first order in which the at least two services change the value of the first global variable during execution of the plurality of services. In response to a failure of the transaction, a rollback execution plan for a plurality of compensating services is determined at least based on the tracing information, where the plurality of compensating services are configured to compensate for the plurality of services respectively. The plurality of compensating services subsequently executed according to the rollback execution plan.


