Are long-term transactions acceptable?

I think of using transactions in two-layer WPF applications (Windows forms) as follows:

We can start a new transaction when we open a new form for editing data, editing and saving changes transparently in this transaction. Then we can click the "OK" button and complete the transaction, or the "Cancel" button and cancel it. If we want to open another dialog box with this data, we can use nested transactions.

The question arises: is this method of using transactions permissible or not? I know that there are many ways to implement this logic, but I would like to list the advantages and disadvantages of this.

+4
source share
5 answers

Here are some problems you may encounter if you go this route.

  • connection reset / close / timeout (if the user goes to the toilet)
  • configuration (the database is mostly preconfigured for many short transactions, but not long ones. For example, a cancellation log that keeps track of what was done during tx may need to be configured)
  • a lock , even possibly deadlocks (the longer the transaction, the greater the likelihood that the same lock is acquired twice, possibly in a conflicting order).

. . , . , . , . .. .

+6

... 1980- , . , ( " " , , ).

, "sagas" -, " " .. ( " : " ). , , ACID. , " " , Isolation. , . , ... , -.

, : , .

+9

.

, .

, .

+4

, . ( ).

. , ? concurrency . .

+2

Mitch n Cheeso, Timeout , , "", , .

, , , , .., .

+2

Source: https://habr.com/ru/post/1671655/


All Articles