[db][server] Failing db_cleanup
when started together with a schema migration should not result in the migration's ROLLBACK
#4232
Labels
Milestone
Describe the bug
If a CodeChecker server is started with schema migration and database clean-up at the same time (not providing
--skip-db-cleanup
and answeringy
to all questions about migration), and the cleanup of a product fails, then the migration is also rolled back.CodeChecker version
6.23.0, 6.24.0-rc1
To Reproduce
Steps to reproduce the behaviour:
db_cleanup
routine randomly (or deterministically based on product name) fails by throwing an Exception.alembic_version
in the database.y
to the migration queries.db_cleanup
starts automatically after schema migrationdb_cleanup
should "crash".SELECT * FROM alembic_version;
on both products. One of them (the one where db_cleanup did not crash) will have the new schema ID, while the other will have the old, showing that a failing db cleanup effectivelyROLLBACK
ed the migration as well.Expected behaviour
A successful migration should be
COMMIT
ted before any cleanup operation is done. This would be especially important if the migration affected rows that the cleanup is touching, because PostgreSQL in certain configurations could reject and error out from aCOMMIT
if there wereALTER TABLE
statements together with data modification.The text was updated successfully, but these errors were encountered: