I'm looking for a structured approach to long-running (hours or more) transactions. As mentioned here, these type of interactions are usually handled by optimistic locking and manual merge strategies.
It would be very handy to have some more structured approach to this type of problem using standard transactions. Various long-running interactions such as user registration, order confirmation etc. all have transaction-like semantics, and it is both error-prone and tedious to invent your own fragile manual roll-back and/or time-out/clean-up strategies.
Taking a RDBMS as an example, I realize that it would be a major performance cost associated with keeping all the transactions open. As an alternative, I could imagine having a database supporting two isolation levels/strategies simultaneously, one for short-running and one for long-running conversations. Long-running conversations could then for instance have more strict limitations on data access to facilitate them taking more time (read-only semantics on some data, optimistic locking semantics etc).
Are there any solutions which could do something similar?
RDBMS ACID transactions belong always to short, atomic and local operations. Distributed application, autonomus services, loosely coupled components use different strategies like rentention and compensating transactions.
A good read on this topic are Pat Helland's papers, he's been teaching about this subject since the 80s. See for instance Architecture of an Autonomous Application or Fiefdoms and Emissaries.