Project

General

Profile

Actions

Improvements #12383

open

Nested transaction warnings

Added by Matthias Van Ceulebroeck 3 months ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
Start date:
02/05/2024
Due date:
% Done:

0%

Estimated time:

Description

When an action is to be performed on the Dbo side (read or write), a Wt::Dbo::Transaction is to be created, which is scoped to the current block. That block will then have access to read from and write to the database.
When a transaction is opened, it is possible to open other in the same scope, leading to nested transactions. While this is in essence harmless, this may be confusing for developers.

It is good practice to scope your transactions small, but in more complex applications, it may happen that nested function calls, would also lead to nested transactions. Due to the transaction committing on destruction, this actual flushing to the database may happen sooner or later than the developer expects. While handling these gracefully, would be hard, we can allow for more information surrounding this.

Wt should detect a nested transaction, and warn the developer of it. Optionally, we can look into a configuration option to disallow it, and actually throw in these cases.

No data to display

Actions

Also available in: Atom PDF