High speed database schema change detection
AssigneeSap Ireland Limited
InventorsPaul Sheedy, Paul O'Connor
Life of this patent
Estimating the term…
Abstract
Embodiments describe a technique for database schema migration that minimizes queries to the runtime database. A technique is described for detecting whether design time metadata has changed during a schema migration without performing a database query for runtime metadata and comparing the design time metadata with the runtime metadata. The technique may improve performance since it aims at minimizing the number of times the database is queried for runtime metadata during the schema migration.
Claims20
A method comprising:
- detecting a request for a schema migration in a database, the database including a database object;
- reading a design time metadata associated with a current state of the database object, the design time metadata comprising a design time specification that describes the database object and other database objects in the database, wherein the schema migration is performed by updating the design time specification in a design time environment and generating the database object and the other database objects during runtime based on the updated design time specification;
- generating a first file hash from the design time metadata;
- retrieving a second file hash from a schema migration table, the second file hash associated with a previous state of the database object;
- comparing the first file hash and the second file hash;
- if the first file hash and the second file hash do not match, determining that the database object has changed during the schema migration;
- upon determining that the database object has changed during the schema migration, further performing steps a through d in a sequence:
- (a) querying the database for a runtime metadata associated with the database object;
- (b) comparing the runtime metadata and the design time metadata;
- (c) altering the database object in the database based on the comparison;
- and
- (d) writing the first file hash into the schema migration table;
- if the first file hash and the second file hash do match, determining that the database object has not changed during the schema migration;
- and
- upon determining that the database object has not changed during the schema migration, bypassing at least steps a, b, and c in the sequence.
A system for database schema migration comprising:
- one or more processors;
- a non-transitory computer-readable medium storing a program executable by the one or more processors, the program comprising sets of instructions for:
- detecting a request for a schema migration in a database, the database including a database object;
- reading a design time metadata associated with a current state of the database object, the design time metadata comprising a design time specification that describes the database object and other database objects in the database, wherein the schema migration is performed by updating the design time specification in a design time environment and generating the database object and the other database objects during runtime based on the updated design time specification;
- generating a first file hash from the design time metadata;
- retrieving a second file hash from a schema migration table, the second file hash associated with a previous state of the database object;
- comparing the first file hash and the second file hash;
- if the first file hash and the second file hash do not match, determining that the database object has changed during the schema migration;
- upon determining that the database object has changed during the schema migration, further performing steps a through d in a sequence:
- (a) querying the database for a runtime metadata associated with the database object;
- (b) comparing the runtime metadata and the design time metadata;
- (c) altering the database object in the database based on the comparison;
- and
- (d) writing the first file hash into the schema migration table;
- if the first file hash and the second file hash do match, determining that the database object has not changed during the schema migration;
- and
- upon determining that the database object has not changed during the schema migration, bypassing at least steps a, b, and c in the sequence.
A non-transitory computer-readable medium storing a program executable by one or more processors, the program comprising sets of instructions for:
- detecting a request for a schema migration in a database, the database including a database object;
- reading a design time metadata associated with a current state of the database object, the design time metadata comprising a design time specification that describes the database object and other database objects in the database, wherein the schema migration is performed by updating the design time specification in a design time environment and generating the database object and the other database objects during runtime based on the updated design time specification;
- generating a first file hash from the design time metadata;
- retrieving a second file hash from a schema migration table, the second file hash associated with a previous state of the database object;
- comparing the first file hash and the second file hash;
- and
- if the first file hash and the second file hash do not match, determining that the database object has changed during the schema migration;
- upon determining that the database object has changed during the schema migration, further performing steps a through d in a sequence:
- (a) querying the database for a runtime metadata associated with the database object;
- (b) comparing the runtime metadata and the design time metadata;
- (c) altering the database object in the database based on the comparison;
- and
- (d) writing the first file hash into the schema migration table;
- if the first file hash and the second file hash do match, determining that the database object has not changed during the schema migration;
- and
- upon determining that the database object has not changed during the schema migration, bypassing at least steps a, b, and c in the sequence.
Dependencies are inferred from the claim text.