Add transaction-related events to the Database API

Created on 16 March 2023, over 2 years ago

Problem/Motivation

Now that Allow the database query log to be dispatched as log events Fixed has laid down a framework to dispatch events from the Database API, it could be interesting to think about adding transaction-related events too (begin transaction, savepoint, rollback, commit, maybe transaction exceptions).

See #3313355-18: Allow the database query log to be dispatched as log events .

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Feature request
Status

Active

Version

10.1

Component
Database 

Last updated 28 days ago

  • Maintained by
  • 🇳🇱Netherlands @daffie
Created by

🇮🇹Italy mondrake 🇮🇹

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @mondrake
  • 🇮🇹Italy mondrake 🇮🇹

    Reparenting.

  • Assigned to mondrake
  • 🇮🇹Italy mondrake 🇮🇹

    On this

  • last update about 2 years ago
    Custom Commands Failed
  • Issue was unassigned.
  • Status changed to Needs review about 2 years ago
  • 🇮🇹Italy mondrake 🇮🇹

    Started something, fit nicely with latest improvements in 📌 Refactor transactions Fixed . Looking forward to an early review - this sets the basis, more events are just more meat around this bone.

  • last update about 2 years ago
    30,136 pass
  • Status changed to Postponed about 2 years ago
  • 🇮🇹Italy mondrake 🇮🇹

    Postponed on 🐛 Strengthen TransactionManager Needs work

  • Status changed to Needs work about 2 years ago
  • 🇮🇹Italy mondrake 🇮🇹

    rebased

  • Pipeline finished with Failed
    over 1 year ago
    Total: 174s
    #118604
  • Pipeline finished with Failed
    over 1 year ago
    Total: 483s
    #118612
  • Pipeline finished with Failed
    over 1 year ago
    Total: 323s
    #119044
  • Pipeline finished with Failed
    over 1 year ago
    Total: 491s
    #119049
  • Pipeline finished with Failed
    over 1 year ago
    Total: 175s
    #119177
  • Pipeline finished with Failed
    over 1 year ago
    Total: 501s
    #119192
  • Pipeline finished with Success
    over 1 year ago
    Total: 491s
    #119460
  • Pipeline finished with Failed
    over 1 year ago
    Total: 176s
    #119467
  • Pipeline finished with Success
    over 1 year ago
    Total: 554s
    #119473
  • Pipeline finished with Failed
    over 1 year ago
    Total: 181s
    #123626
  • Pipeline finished with Failed
    over 1 year ago
    Total: 187s
    #123654
  • Pipeline finished with Failed
    over 1 year ago
    Total: 484s
    #123658
  • Pipeline finished with Failed
    over 1 year ago
    Total: 600s
    #123662
  • Pipeline finished with Failed
    over 1 year ago
    Total: 552s
    #123684
  • Status changed to Postponed over 1 year ago
  • 🇮🇹Italy mondrake 🇮🇹

    We cannot do this now, 🐛 Transaction autocommit during shutdown relies on unreliable object destruction order Active introduced Database::commitAllOnShutdown() which runs at a time when the event dispatcher has been destroyed already, so events fail. One more reason to move towards explicit commit.

  • 🇺🇸United States mfb San Francisco

    eesh, seems not-ideal to wait until most-everything is destroyed to commit transactions, i.e. difficult to respond to various transaction commit failure modes.

  • Pipeline finished with Failed
    4 months ago
    Total: 221s
    #527892
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Failed
    4 months ago
    Total: 545s
    #527900
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Failed
    4 months ago
    Total: 221s
    #528023
  • Pipeline finished with Success
    4 months ago
    Total: 1052s
    #528025
  • Pipeline finished with Failed
    4 months ago
    Total: 146s
    #528352
  • Pipeline finished with Failed
    4 months ago
    Total: 157s
    #528357
  • Pipeline finished with Failed
    4 months ago
    Total: 209s
    #528368
  • Pipeline finished with Failed
    4 months ago
    Total: 304s
    #528370
  • Pipeline finished with Failed
    4 months ago
    Total: 889s
    #528376
  • Pipeline finished with Failed
    4 months ago
    Total: 676s
    #528435
  • Pipeline finished with Failed
    4 months ago
    Total: 463s
    #528453
  • Pipeline finished with Failed
    4 months ago
    Total: 908s
    #528515
  • Pipeline finished with Canceled
    4 months ago
    Total: 227s
    #528545
  • Pipeline finished with Success
    4 months ago
    #528548
  • 🇮🇹Italy mondrake 🇮🇹

    As long as we can accept that these events are not dispatched when the event dispatcher service is not available - that is: 1) early in the request before the full container is available, and 2) during shutdown when the service can have already been destructed, this can proceed.

    • 📌 [PP-1] Convert all transactions to explicit COMMIT Postponed would make this issue having some deprecated behaviour (i.e. including in the event information about the commit having occurred during destruct); however since that deprecation removal will be no sooner than D13 (2028?), I think it's worth keeping for now.
    • 📌 Explore injecting the event dispatcher in the database service Active would make the event being dispatched also before full container availability - that could be a must-have if we want to move the post commit callback execution to an event-based solution.

    Still needs some tests for commit/release/rollback failure events - not easy to create the context - so I will look into mocking.

    But the biggest part here is already reviewable.

  • Pipeline finished with Success
    4 months ago
    Total: 634s
    #528685
  • 🇮🇹Italy mondrake 🇮🇹

    Working on the unit tests.

  • Pipeline finished with Success
    4 months ago
    Total: 632s
    #528985
  • Pipeline finished with Failed
    4 months ago
    Total: 121s
    #529088
  • Pipeline finished with Failed
    4 months ago
    Total: 227s
    #529339
  • Pipeline finished with Failed
    4 months ago
    #529529
  • Pipeline finished with Failed
    4 months ago
    Total: 599s
    #529538
  • Pipeline finished with Failed
    3 months ago
    Total: 590s
    #529922
  • Pipeline finished with Failed
    3 months ago
    Total: 123s
    #529946
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    3 months ago
    Total: 6008s
    #529954
  • Pipeline finished with Failed
    3 months ago
    Total: 135s
    #530077
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • 🇮🇹Italy mondrake 🇮🇹
  • Pipeline finished with Success
    3 months ago
    Total: 4082s
    #530131
  • Pipeline finished with Success
    3 months ago
    #543052
  • Pipeline finished with Failed
    3 months ago
    Total: 490s
    #552444
  • 🇮🇹Italy mondrake 🇮🇹

    I think we need to add an additional event for the autocommit on DDL, separate from the regular one, and still emit the regular one in the expected moment even if the autocommit already happened. This will make simpler moving post-transaction callbacks to event subscriptions.

    AFK for a while, will come back later.

  • Pipeline finished with Success
    2 months ago
    Total: 499s
    #566264
  • Pipeline finished with Success
    about 1 month ago
    Total: 608s
    #581235
  • Status changed to Needs review about 1 month ago
  • Pipeline finished with Success
    about 1 month ago
    Total: 829s
    #581246
  • Pipeline finished with Failed
    about 1 month ago
    Total: 179s
    #581382
  • Pipeline finished with Success
    about 1 month ago
    Total: 2228s
    #581390
  • Pipeline finished with Success
    about 1 month ago
    Total: 1712s
    #581788
  • Pipeline finished with Failed
    about 1 month ago
    #589058
  • Pipeline finished with Success
    28 days ago
    Total: 512s
    #593829
  • Pipeline finished with Success
    about 15 hours ago
    Total: 794s
    #619718
Production build 0.71.5 2024