GitLab
GitLab logoGitLab · Feature trail

Database Migration Debugging and Cross-Database Compatibility

15 posts · Dec 2014 – Oct 2024

What this trail covers

GitLab is decomposing its monolithic PostgreSQL database into independent databases, starting with the separation of CI-related data. This involved extensive planning, proof-of-concept work, and the development of tools and documentation to manage cross-database dependencies, such as cross-join detection, cross-database transaction detection, and loose foreign keys. The project leveraged Rails' multi-database support and addressed challenges like mirroring data. This post details a major version of this decomposition, highlighting a specific issue encountered with MySQL during a Rails migration that worked in PostgreSQL, leading to the discovery of a bug in MySQL's index rebuilding behavior when dropping columns. The fix involved explicitly removing the index before dropping the columns. This experience led to a refinement of their migration testing strategy to include cross-database compatibility checks.

All GitLab trails