Skip to content

Conversation

@coding-chimp
Copy link

Changes the order we create triggers in to prevent the following scenario:

  1. LHM creates shadow table.
  2. LHM creates delete trigger.
  3. LHM creates insert trigger.
  4. Rows are inserted into the table and immediately updated.
  5. LHM creates update trigger.
  6. LHM copies over all rows.
  7. LHM validates triggers, does the cutover, deletes the triggers, and is done.

Result: The inserts were replicated to the shadow table via the insert trigger, but the updates were not. Copying those rows failed since they already existed in the shadow table, and LHM ignored the error. We now have stale data after the migration finishes.

We ensure this can't happen by creating the update trigger first.

@coding-chimp coding-chimp requested a review from a team July 8, 2025 06:46
@coding-chimp coding-chimp self-assigned this Jul 8, 2025
@coding-chimp coding-chimp merged commit 3374b60 into master Jul 8, 2025
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants