Database upgrade selection based on database catalog signatures
Techniques are disclosed that pertain to upgrading a database application. A computer system may determine to upgrade a database application from a current version associated with a first instance of a database catalog that defines the structure of a database that is managed by that database application. The first instance is associated with a first catalog signature that is indicative of the first instance of the database catalog. The computer system generates a second catalog signature that is indicative of a second instance of the database catalog that is associated with the different version. The computer system compares the first catalog signature and the second catalog signature to determine whether the database catalog changes between the current and different versions. Based on the comparing, the computer system then selects one of multiple upgrade processes performable to upgrade the database application to the different version and performs the selected upgrade process.
1 . A method for selecting an upgrade process for a database application, the method comprising:
determining, by a computer system, to upgrade the database application to a different version from a current version associated with a first instance of a database catalog for a database managed by the database application, wherein the first instance is associated with a first shape signature indicative of a structure of the first instance and a first content signature indicative of content of the first instance;
generating, by the computer system, a second shape signature indicative of a structure of a second instance of the database catalog that is associated with the different version and a second content signature indicative of content of the second instance;
comparing, by the computer system, the first and second shape signatures and the first and second content signatures to determine whether the database catalog undergoes a structural change or a content but not structural change between the current and different versions;
based on whether the database catalog undergoes the structural change or the content but not structural change between the current and different versions, the computer system selecting one of a plurality of upgrade processes to upgrade the database application to the different version; and
performing, by the computer system, the selected upgrade process.
2 . The method of claim 1 , wherein the generating further includes:
accessing, by the computer system, catalog information that defines the structure and content of the second instance of the database catalog;
generating, by the computer system, a script based on the catalog information, wherein the script is executable to generate at least a portion of the second instance; and
performing, by the computer system, a hash-based operation on the script to generate the second shape signature.
3 . The method of claim 1 wherein the plurality of upgrade processes includes a first type of upgrade process, a second type of upgrade process, and a third type of upgrade process.
4 . The method of claim 3 , further comprising:
in response to the structural change of the database catalog between the first and second instances as indicated by a difference between the first and second shape signatures, the computer system selecting the first type of upgrade process as the selected upgrade process, wherein performing the first type of upgrade process includes:
deriving a plurality of database statements from the first instance of the database catalog, wherein a particular one of the plurality of database statements is executable to insert particular content of the first instance of the database catalog into the second instance of the database catalog; and
executing one or more of the plurality of database statements to insert content of the first instance of the database catalog into the second instance of the database catalog.
5 . The method of claim 3 , further comprising:
in response to the content but not structural change of the database catalog between the first and second instances as indicated by a difference between the first and second content signatures, the computer system selecting the second type of upgrade process as the selected upgrade process, wherein performing the second type of upgrade process includes:
performing a copy operation on the first instance of the database catalog to produce the second instance, wherein the second instance includes structure and content of the first instance; and
inserting, into the second instance, additional content that is associated with the different version but not associated with the current version of the database application.
6 . The method of claim 3 , further comprising:
in response to the first and second instances of the database catalog being identical as indicated by the first and second shape signatures matching and the first and second content signatures matching, the computer system selecting the third type of upgrade process as the selected upgrade process, wherein performing the third type of upgrade process includes:
deploying the different version of the database application; and
associating the first instance of the database catalog with the deployed database application such that the deployed database application utilizes the first instance.
7 . The method of claim 1 , further comprising:
comparing, by the computer system, a first upgrade signature that is indicative of code of the selected upgrade process associated with the current version and a second upgrade signature that is indicative of code of the selected upgrade process associated with the different version to determine whether the selected upgrade process changes between the current and different versions; and
based on the first upgrade signature being different than the second upgrade signature, the computer system providing a notification to a user that the selected upgrade process has changed.
8 . The method of claim 1 , wherein the performing further includes:
prior to the comparing, the computer system comparing a first catalog image that represents the first instance of the database catalog and a second catalog image that represents the second instance of the database catalog to determine whether the first and second shape signatures should match and the first and second content signatures should match.
9 . A non-transitory computer-readable medium having program instructions stored thereon that are capable of causing a computer system to perform operations comprising:
determining to upgrade a database application to a different version from a current version associated with a first instance of a database catalog for a database managed by the database application, wherein the first instance is associated with a first shape signature indicative of a structure of the first instance and a first content signature indicative of content of the first instance;
generating a second shape signature indicative of a structure of a second instance of the database catalog that is associated with the different version and a second content signature indicative of content of the second instance;
comparing the first and second shape signatures and the first and second content signatures to determine whether the database catalog undergoes a structural change or a content but not structural change between the current and different versions;
based on whether the database catalog undergoes the structural change or the content but not structural change between the current and different versions, selecting one of a plurality of upgrade processes to upgrade the database application to the different version; and
performing the selected upgrade process.
10 . The non-transitory computer-readable medium of claim 9 , wherein the operations further comprise:
in response to the structural change of the database catalog between the first and second instances as indicated by a difference between the first and second shape signatures, selecting a full upgrade process as the selected upgrade process, wherein performing the full upgrade process includes:
deriving a plurality of database statements from the first instance of the database catalog; and
executing one or more of the plurality of database statements to recreate at least a portion of the first instance of the database catalog for the second instance of the database catalog.
11 . The non-transitory computer-readable medium of claim 9 , wherein the operations further comprise:
in response to the content but not structural change of the database catalog between the first and second instances as indicated by a difference between the first and second content signatures, selecting a minor upgrade process as the selected upgrade process, wherein performing the minor upgrade process includes:
performing a copy operation on the first instance of the database catalog to produce the second instance, wherein the second instance includes structure and content of the first instance; and
inserting, into the second instance, additional content that is associated with the different version but not associated with the current version of the database application.
12 . A system, comprising:
at least one processor; and
memory having program instructions stored thereon that are executable by the at least one processor to cause the system to perform operations comprising:
determining to upgrade a database application to a different version from a current version associated with a first instance of a database catalog for a database managed by the database application, wherein the first instance is associated with a first shape signature indicative of a structure of the first instance and a first content signature indicative of content of the first instance;
generating a second shape signature indicative of a structure of a second instance of the database catalog that is associated with the different version and a second content signature indicative of content of the second instance;
comparing the first and second shape signatures and the first and second content signatures to determine whether the database catalog undergoes a structural change or a content but not structural change between the current and different versions;
based on whether the database catalog undergoes the structural change or the content but not structural change between the current and different versions, selecting one of a plurality of upgrade processes to upgrade the database application to the different version; and
performing the selected upgrade process.
13 . The system of claim 12 , wherein the selected upgrade process is selected over other ones of the plurality of upgrade processes in response to the structural change of the database catalog between the first and second instances as indicated by a difference between the first and second shape signatures, and wherein the performing of the selected upgrade process includes:
deriving a plurality of database statements from the first instance of the database catalog; and
executing one or more of the plurality of database statements to recreate particular content of the first instance of the database catalog for the second instance of the database catalog.
14 . The system of claim 12 , wherein the selected upgrade process is selected over other ones of the plurality of upgrade processes in response to the content but not structural change of the database catalog between the first and second instances as indicated by a difference between the first and second content signatures, and wherein the performing of the selected upgrade process includes:
performing a copy operation on the first instance of the database catalog to produce the second instance; and
inserting, into the second instance, additional content that is associated with the different version but not associated with the current version of the database application.