Asynchronous Database Schema Change Controller
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Database servers face concurrency anomalies and downtime risks during schema changes, especially in distributed systems where synchronous updates are not feasible, leading to data corruption and user operation delays.
Innovation Solution
The method involves splitting schema changes into stages, identifying and managing different states for existing and new schema elements, and using a controller to implement the new schema in phases while maintaining multiple schema versions and controlling concurrency through lease management and snapshot comparisons.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If schema changes are applied synchronously to all distributed database servers, then consistency is improved, but system availability deteriorates due to required downtime
Solution Approach 1:
The schema change process is segmented into multiple independent phases: (1) creating the new schema version, (2) migrating data between old and new schemas, (3) validating the migration, and (4) switching to the new schema. Each phase can be executed independently on different servers at different times, allowing distributed servers to progress through the transition at their own pace while maintaining overall consistency through version tracking and coordination mechanisms.
2Reliability
If database servers delay requests during schema changes, then data consistency is improved, but user operation responsiveness deteriorates
Solution Approach 1:
The system dynamically adapts its behavior based on the schema change state. During schema transitions, servers dynamically adjust their schema version based on which version is currently active, allowing user operations to continue with the valid schema version. The system dynamically tracks which schema version is active and routes operations accordingly, rather than statically delaying all operations during the transition period.
3Reliability
If database servers fail requests during schema changes, then data consistency is improved, but system throughput deteriorates
Solution Approach 1:
An intermediary schema versioning mechanism is introduced that acts as a mediator between the old and new schemas. The system maintains multiple schema versions simultaneously and uses version identifiers to determine which schema to apply for each operation. This intermediary layer allows seamless transition without failing requests, as the system automatically routes operations to the appropriate schema version based on the current active version.
4Productivity
If multiple schema versions are maintained on distributed servers, then system availability is improved, but schema management complexity increases
Solution Approach 1:
The system manages multiple schema versions by treating the schema version identifier as a changeable parameter. Each server maintains a version parameter that indicates which schema version is currently active. Schema changes are managed by updating this version parameter across the distributed system, allowing servers to independently track and switch between versions based on the active parameter value, simplifying the management of multiple coexisting schema versions.
Data Source
AI summary
This disclosure provides systems and methods for updating database servers with schema changes to avoid concurrency anomalies. The system may receive a snapshot of a table to be updated with a new schema, wherein the snapshot is taken at a given time, and wherein the table includes a number of rows. The system may then read each row from the snapshot and read each row from the table to be updated at a second time. The system may then compare the rows read from the snapshot to the rows read from the table at the second time. Furthermore, the system may determine, based on the comparison, the rows from the snapshot that have not changed between the given time and the second time. The system may then write the rows that have not changed to the table to be updated.


