Query Validation for Asynchronous Database Replication
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database systems face challenges in maintaining continuous availability and efficient load balancing between primary and secondary databases, particularly under high workloads, due to asynchronous replication delays and inefficient garbage collection in multi-version concurrency control systems.
Innovation Solution
The implementation of a query validation test mechanism that suspends garbage collection, issues test queries to both primary and secondary databases to ensure identical results, and uses hash values to compare returns, thereby validating replication processes and maintaining consistent data visibility.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If asynchronous replication is used to maintain continuous availability, then system availability is improved, but data consistency between primary and secondary databases deteriorates due to replication delays
Solution Approach 1:
The system implements a query validation mechanism that continuously monitors replication status by comparing query results from primary and secondary databases. When inconsistencies are detected or validation fails, the system adjusts load balancing decisions to route queries only to the primary database, ensuring data consistency while maintaining availability through automatic failover capabilities
Solution Approach 2:
The patent introduces a validation layer that acts as an intermediary between the load balancer and databases. This validation mechanism queries both primary and secondary databases to verify replication status before allowing load-balanced read operations, serving as a mediator that ensures data consistency without blocking availability
2Quantity of substance
If garbage collection is performed to manage update versions in multi-version concurrency control, then memory efficiency is improved, but query validation accuracy deteriorates due to premature deletion of update versions
Solution Approach 1:
The system performs query validation operations before garbage collection is executed. By validating replication status and comparing query results while update versions are still retained in memory, the system ensures accurate validation without being affected by premature garbage collection. The garbage collection process is then safely executed afterward, maintaining memory efficiency without compromising validation accuracy
3Productivity
If load balancing is implemented across primary and secondary databases, then throughput is improved, but replication validation reliability deteriorates due to asynchronous timing issues
Solution Approach 1:
The load balancing system dynamically adjusts query routing based on real-time replication validation status. When validation succeeds, read queries are dynamically routed to the secondary database to improve throughput. When validation fails or timing issues are detected, the system dynamically switches to routing all queries to the primary database, maintaining reliability while optimizing throughput through adaptive load balancing
Data Source
AI summary
An oldest version timestamp is received from a first database. A current commit timestamp is received from a second database configured to asynchronously replicate the first database. The current global commit timestamp corresponds to a commit transaction executed in the first database and subsequently replicated in the second database. A first test query is then issued to the second database including a request for a current timestamp of the second database. A second test query is issued to the primary database requesting records associated with a target update version that has a target timestamp equal to the current snapshot timestamp. A determination is then made that a first return associated with the first test query and a second return associated with the second test query are identical indicating a successful validation. Related apparatus, systems, techniques and articles are also described.


