Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1465 (closed defect: fixed)

Opened 12 years ago

Last modified 8 years ago

Create Transaction Middleware

Reported by: mramm Owned by:
Priority: high Milestone: 1.9.7a4
Component: TurboGears Version: trunk
Severity: normal Keywords:
Cc:

Description (last modified by Chris Arndt) (diff)

It would be great to have transaction middleware that is more configurable than the tg1 transaction stuff.

  1. Transaction middleware should be easy to turn on/off
  2. It should be possible to turn on Transactions only for PUT, POST, DELETE, but not for HTTP GET requests which ought to be idempotent
  3. It should also ideally be possible for transactions to be turned on only for a specific list of URL's.

The default configuration should be the same as that in TG1 transactions on for all requests. This protects people from shooting themselves in the foot without too much performance impact, but for performance conscious people this should be easy to configure as described above.

Change History

comment:1 Changed 11 years ago by mramm

It looks like repoze.tm isn't yet what we need it to be (there's still a ZODB dependency) but I think we should copy it's API and put it into our own middleware for now.

Then when the repoze folks finally break the ZODB dependency, we can use their middleware.

90% of users won't need two-phase commit, but for those who partition their data it can be a huge benefit, and that kind of scalability tool is a good selling point for TG2 marketing materials.

I'm also willing to go with a simple trasaction strategy which automatically wraps all requests in a transaction for now. Thought I still think HTTP style is a good idea for people who know what they are doing.

Info on repose.tm:  http://repoze.org/tmdemo.html

Integrating Repoze with pylons:  http://blog.repoze.org/repoze.tm_with_pylons-20071218.html

And some sample transaction middleware that Johnathan wrote for us: http://trac.turbogears.org/browser/sandbox/transactions

comment:2 Changed 11 years ago by mramm

  • Owner changed from anonymous to mramm

Repoze.tm has now got a version which is not dependent on the ZODB.

Chris sent me e-mail this morning:

 http://svn.repoze.org/repoze.tm2/trunk/

I've made a 1.0a1 release at:

 http://dist.repoze.org/repoze.tm2-1.0a1.tar.gz

So I think we should probably go ahead and use repoze.tm2. Many larger projects require working with multiple databases, where two phase commit becomes important. Scalability things like data partitioning can make two-phase commit important as well.

And the zope people have a history of creating two-phase commit like interfaces around things like sending mail. This pattern can be very effective in many cases.

comment:3 Changed 11 years ago by paj

  • Status changed from new to assigned
  • Owner changed from mramm to paj

comment:4 Changed 11 years ago by mramm

Paul,

you may also want to look at Jonathan's initial implementation of transaction middleware:

http://trac.turbogears.org/browser/sandbox/transactions/transaction.py

start, commit, and rollback, are expected to be defined in the app's model.py and passed in here.

style was designed so that there could be HTTP aware transactionalism (no transactions on HTTP indempotent verbs), or other styles.

comment:5 Changed 11 years ago by paj

Having looked at repoze, I would like to avoid it for now - there's quite a lot of complexity here, while a very simple bit of middleware will do everything but two phase commmit. We needs something that works now, we can always add that feature later.

Got some simple middleware just about working here. Next step is to move the TG1 unit tests across.

comment:6 Changed 11 years ago by mramm

  • Milestone changed from 2.0 to 2.0-preview

comment:7 Changed 11 years ago by Chris Arndt

  • Description modified (diff)

comment:8 Changed 11 years ago by mramm

  • Milestone changed from 2.0-preview-1 to 2.0-preview-2

comment:9 Changed 11 years ago by mramm

  • Status changed from assigned to new
  • Owner paj deleted

comment:10 Changed 11 years ago by mramm

  • Priority changed from normal to high

comment:11 Changed 11 years ago by mramm

  • Milestone changed from 2.0-preview-2 to 2.0-preview-3

comment:12 Changed 11 years ago by alberto

  • Status changed from new to closed
  • Resolution set to fixed

repoze.tm2 and zope.sqlalchemy have been integrated from [5073] and a couple of revisions after that.

Alberto

Note: See TracTickets for help on using tickets.