starting metabase is slower than it has any good reason to be.
Speed up access to liquibase changelog
its all here: metabase/metabase#3715
- This is the most basic solution. We use git to manage the contents of a single file rather than a directory.
- Operationally this seems mostly like a matter of opinion.
- Requires translating json to yaml, which would then need testing.
- the combined migration file would be ~4000 lines long
- This option seems orthoginal to solving this problem. We can choose to do this now, delay it, or not do it independently of the rest of this problem. I don’t think this is, as such, a solution to this problem.
- A long delayed upgrade would have to hop through these designated releases, which can be frusterating.
- The advantage of this is it greatly constrains the combinatorial explosion of possible upgrade paths to test.
- This also requires work to guide people through the upgrade process.
This is also orthogonal to solving this problem, and it’s a good idea on it’s own. (Arthur’s opinion)
- store the last-run git-hash in the DB on startup only run migrations if this value has changed.
- This is replicating a tiny part of what liquibase does
- metabase/metabase#4094
- Hook Liquibase at runtime to turn the caching back on.
- This is fragile and almost certainly bad.
- They had a problem with cach invalidation (which is the #2 problem in Computer Science after naming things, after naming things ;-) They fixed it by turning off the cache.
- They are unlikely to want to merge this patch.
- leads to perma-fork and more work for us.
- I could be misinterpreting the problem they where trying to solve, though this may help other people that use Liquibase
- If this works then they are more likely to take the patch because it makes their library faster
- Adding just one more layer of abstraction solves all computer problems after all!
- preprocess the migration blobs from one blob per file to many blobs in a single file
- We need to determine the application order here.
- move the migration scrips to a secure temp folder before each migration
- No need to figure out any ordering questions
- there needs to be a usable and properly functioning temp directory.
- This combines the same process as the compile time prepossessing option with making a temp-file at runtime
- Only a temp-file is required, and it may be possible to do it with an in-memory buffer.
- all the json formatted migrations where converted to yaml
- all the migrations where combined into a single DB change log with many change sets. this was required to preserve the order on new installs
- This required a pre-migration script to change the filenames in the liquibase DB
- There is a pre-install check to only run the pre-migration if it’s not a fresh install
unsigned:
04-12 11:53:40 INFO metabase.db :: Checking if Database has unrun migrations... <---- 1 second
04-12 11:53:41 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared...
04-12 11:53:41 INFO metabase.db :: Migration lock is cleared. Running migrations... <---- 1 second
04-12 11:53:42 INFO metabase.db :: Database Migrations Current ... ✅
signed:
04-12 11:55:27 INFO metabase.db :: Checking if Database has unrun migrations... <---- 14 seconds
04-12 11:55:41 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared...
04-12 11:55:41 INFO metabase.db :: Migration lock is cleared. Running migrations... <---- 14 seconds
04-12 11:55:55 INFO metabase.db :: Database Migrations Current ... ✅
unsigned with consolidated migrations:
04-12 11:48:22 INFO metabase.db :: Checking if Database has unrun migrations... <---- 1 second
04-12 11:48:23 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared...
04-12 11:48:23 INFO metabase.db :: Migration lock is cleared. Running migrations... <---- 1 second
04-12 11:48:24 INFO metabase.db :: Database Migrations Current ... ✅
signed with consolidated migrations:
04-12 11:50:31 INFO metabase.db :: Checking if Database has unrun migrations... <---- 2 seconds (saved 12 seconds here)
04-12 11:50:33 INFO metabase.db :: Database has unrun migrations. Waiting for migration lock to be cleared...
04-12 11:50:33 INFO metabase.db :: Migration lock is cleared. Running migrations... <---- 15 seconds
04-12 11:50:48 INFO metabase.db :: Database Migrations Current ... ✅