Files
gerrit/gerrit-server/src/main/java
David Ostrovsky 05635e0042 Use dedicated database connection for every schema migration
In some schema migrations pure database schema update machinery was
misused for long running migrations that entirely unrelated to database
schema upgrades. Most notably Schema_144 that migrating external ids to
NoteDb and Schema_146 where all accounts were migrated from ReviewDb to
NoteDb. How the code is currently organized, that approach only works
for small to medium gerrit installation sites with couple of thousands
users.

This change adjusts the schema update connection management and pass
in schema factory instead ReviewDb instance to the schema migration
process. That way it is possible to open two new connections for each
schema migration step:

1. migrate data
2. bump new schema version

As the consequence of this refactoring big sites shouldn't run into
wait timeout exception during schema migration process.

Bug: Issue 12637
Change-Id: I9bbdd9a09898c4ef23362853c654a39934c3967c
2020-05-01 23:43:59 +02:00
..