Improving Society Through Innovation

11,934,424 - Method and apparatus for resolving target database constraint violations in a database replication system where target database transactions are automatically aborted due to constraints violations

Abstract:

A method and apparatus are provided for avoiding target database constraint violations in a database replication system. The database replication system includes a source database and a target database, wherein target database transactions automatically abort due to constraint violations. Each database has one or more tables and at least one of the target database tables has one or more constraints. The database replication system replicates source database transactions. For each target database transaction corresponding to a replicated source database transaction, changes made at the source database are replicated to the target database. When it is detected that a replicated change causes a constraint violation as a result of one or more of the target database tables having one or more constraints, the applying of the database change to the target database of the database change is deferred and the database change is posted to an electronic list. Replicated changes that do not cause a constraint violation are immediately applied to the target database. This process is repeated for all of the changes within the replicated source database transaction. The database changes on the electronic list are iterated through by applying the database changes on the electronic list that no longer cause a constraint violation to the target database and removing the applied database changes from the electronic list, and by deferring again the applying of the database changes on the electronic list that still cause a constraint violation and maintaining the deferred database changes on the electronic list. A commit is performed for the target database transaction corresponding to the replicated source database transaction when a commit operation is detected in the replicated source database transaction, and when no database changes remain on the electronic list for the replicated source database transaction. The deferring process avoids the target database transactions automatically aborting due to constraint violations.