Database Schema Version Rotation for Minimal-Downtime Updates
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Direct updates to a database schema can disrupt application traffic and cause undesired downtime, necessitating a method to apply schema updates without disrupting service.
Innovation Solution
Implementing a database schema rotation that utilizes multiple instances of the database schema, with each instance having a state (active, dormant, or load) to allow updates on non-active versions while maintaining service continuity.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Manufacturing precision
If direct updates to database schema are performed, then schema changes are applied, but application traffic is disrupted and downtime occurs
Solution Approach 1:
The database schema is segmented into multiple independent versions (current schema version and previous schema version), allowing updates to be applied to one version while the other remains operational. This segmentation enables the system to maintain service continuity by routing traffic to the appropriate schema version, thus resolving the contradiction between applying schema updates and maintaining service reliability.
Solution Approach 2:
The system performs preliminary actions by maintaining cached copies of both current and previous schema versions in memory before actual updates are applied. This allows the database system to prepare schema updates in advance and switch between versions seamlessly, ensuring that schema changes can be applied without disrupting ongoing application traffic and thereby maintaining service continuity.
2Loss of time
If multiple schema versions are maintained, then zero or minimal downtime is achieved, but system complexity increases
Solution Approach 1:
The system creates and maintains cached copies of schema versions in memory rather than managing multiple full schema instances. By copying essential schema information to memory caches with associated version identifiers, the system achieves minimal downtime through rapid version switching while keeping the complexity manageable through selective caching rather than full schema duplication.
Solution Approach 2:
The system manages schema versions by changing parameters such as version identifiers and cache validity flags rather than fundamentally altering the schema management architecture. This approach allows multiple schema versions to coexist with minimal complexity overhead, as the system tracks versions through parameter changes (version numbers, cache timestamps) rather than requiring complex version control mechanisms.
3Productivity
If schema updates are applied to active schema version, then updates are immediately effective, but application traffic is disrupted
Solution Approach 1:
The system introduces schema version identifiers and cache management mechanisms as intermediaries between the schema update process and application traffic. These intermediaries allow updates to be applied to the current schema version in memory without directly disrupting traffic, as the system can maintain previous versions in cache and route traffic appropriately during transition, thus achieving both immediate update effectiveness and smooth traffic flow.
Solution Approach 2:
The system implements periodic schema version updates through controlled transitions between cached schema versions rather than continuous updates. By applying updates at discrete intervals and managing transitions between versions systematically, the system achieves rapid update application while maintaining smooth traffic flow through structured version switching rather than continuous disruption.
Data Source
AI summary
Techniques are disclosed relating to updating a database schema. A computer system may store database schema versions for a database schema. A given schema version may have an active state or one of multiple non-active states. One of the schema versions may be a first schema version that is in the active state and the remaining schema versions may be in the non-active states. The computer system may receive updates to apply to the database schema. The computer system may transition a second schema version from a first non-active state that does not permit structural or content updates to a second non-active state that permits structural and content updates. The computer system may apply the updates to the second database schema version and then transition the second database schema version into the active state and the first database schema version into the first non-active state.


