Don't load or install extensions during a Review Board upgrade.
Review Request #10243 — Created Oct. 19, 2018 and submitted — Latest diff uploaded
A customer hit a bug where they had upgraded the Review Board package,
but not the database, and had run a management command that found the
newrbintegrationspackage and tried to install it, triggering an
early database upgrade. This was quite problematic, and caused a lot of
confusion while trying to diagnose a separate upgrade problem.To avoid this, and potentially other problems, we no longer load any
extensions if the Review Board version stored in the database does not
match the package version. Instead, extensions will only load if the
version matches. This lets us avoid these early migrations prior to a
database upgrade.The one caveat is that this won't solve the problem if
syncdband
evolveare run in separate sessions (by invokingmanage.pytwice,
for instance).syncdbwill set the new database version, meaning that
evolveis free to load extensions again. This is only really an issue
during development, sincerb-site upgraderuns these in the same
session.Part of this will be addressed in some longer-term Django Evolution
work, which will be providing a command similar to modern Django's
migratecommand, where everything can be done all at once.
Shorter-term, an upcoming change will add anupgradecommand to
manage.py.
Reproduced the original problem by upgrading the Review Board package
and running a management command. Saw that the database upgrade did not
trigger until I explicitly performed it.