lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3193) TwoPhaseCommit interface
Date Sun, 12 Jun 2011 10:28:51 GMT


Michael McCandless commented on LUCENE-3193:

Patch looks great!  It's a nice addition.

TwoPhaseCommitTool.execute should be @experimental?

This seems similar to LUCENE-3131 (XA transactions support).  I don't
really understand what it takes to be "XA capable", but I assume it
means building the right wrapper around IW's existing transactional
APIs (like this).

Shouldn't TwoPhaseCommit be @lucene.experimental instead (not
internal)?  Ie, the idea is an app can also impl this interface, and
then use execute to commit all resources.

Javadocs should maybe state that on rollback the writer will have been
closed?  (rollback closes the writer)

One possible issue: if exceptions are hit in .commit(), which ought to
be rare since prepareCommit does all the "hard work", we go and
.rollback() all resources, even those that had successfully .commit'd,
right?  But, in general, this is tricky for a resource to handle
(rolling back when commit had succeeded).  EG, IndexWriter won't do
this correctly -- rollback will be a no-op in this case since it rolls
back to the last successful commit.

This is actually correctable, but it requires some more work to
properly wrap the IndexWriter.

> TwoPhaseCommit interface
> ------------------------
>                 Key: LUCENE-3193
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: core/index
>            Reporter: Shai Erera
>            Assignee: Shai Erera
>             Fix For: 3.3, 4.0
>         Attachments: LUCENE-3193.patch
> I would like to propose a TwoPhaseCommit interface which declares the methods necessary
to implement a 2-phase commit algorithm:
> * prepareCommit()
> * commit()
> * rollback()
> The prepare/commit ones have variants that take a (Map<String,String> commitData)
following the ones we have in IndexWriter.
> In addition, a TwoPhaseCommitTool which implements a 2-phase commit amongst several TPCs.
> Having IndexWriter implement that interface will allow running the 2-phase commit algorithm
on multiple IWs or IW + any other object that implements the interface.
> We should mark the interface @lucene.internal so as to not block ourselves in the future.
This is pretty advanced stuff anyway.
> Will post a patch soon

This message is automatically generated by JIRA.
For more information on JIRA, see:


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message