Details
Description
Currently we only take a snapshot of SYSTEM.CATALOG before attempting to upgrade it (see this). From 4.15 onwards we also store critical metadata information in other SYSTEM tables like SYSTEM.CHILD_LINK, so it is beneficial to also snapshot those tables before upgrading them henceforth.
We also currently don't take a snapshot of SYSTEM.CATALOG on receiving an UpgradeRequiredException which we should do.
In case of any errors during the upgrade, we restore SYSTEM.CATALOG from this snapshot and we should extend this to all tables. In cases where the table didn't exist before the upgrade, we need to ensure it is dropped so that a subsequent upgrade attempt can start afresh.