Skip to content

Detect modification in wrong DB transaction

Thong Kuah requested to merge cross-database-modification-txn-in-wrong-db into master

What does this MR do and why?

Detects modification that happens in wrong database transaction

Problem

The following sequence of events should be avoided:

  1. Opens a DB transaction in main: database (BEGIN)
  2. Writes to ci: database (e.g. UPDATE)
  3. Rolls back in main: database (ROLLBACK)

Solution

So we attempt to detect any transaction where steps 1, and 2 above have occurred

Note, we extend the existing PreventCrossDatabaseModification query analyzer. So this analyzer now does:

  • Detection of writes occurring in two databases in the same transaction
  • Detection of write(s) occurring in the database that is different from the current transaction (s).

Related issue: #347368 (closed)

Screenshots or screen recordings

These are strongly recommended to assist reviewers and reduce the time to merge your change.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Thong Kuah

Merge request reports