[TECH DEBT]: Inefficient use of TableMigrationStatusRefresher.index()
#2730
Labels
feat/migration-index
mapping of databases to catalog or potentially other databases
feat/migration-progress
Issues related to the migration progress workflow
migrate/code
Abstract Syntax Trees and other dark magic
tech debt
chores and design flaws
Problem statement
The
TableMigrationStatusRefresher.index()
method is used to load the migration state of all tables and views in the inventory. The fast-path is that this loads the migration state from the inventory table (select * from migration_status
).We have a lot of code-paths that invoke this function to obtain the index, especially in the migration-related code, not realising that it's relatively expensive. One particular case is:
TablesMigrator.get_remaining_tables()
which loads this index (and discards it) within a loop over every table in the inventory.Proposed Solution
At the very least
TablesMigrator.get_remaining_tables()
should be refactored to only build the index once.I haven't some a full survey of usage, but there are probably many other places where refactoring is needed to avoid redundant loading of the index.
The text was updated successfully, but these errors were encountered: