lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael McCandless (Commented) (JIRA)" <>
Subject [jira] [Commented] (LUCENE-3564) rename IndexWriter.rollback to .rollbackAndClose
Date Mon, 07 Nov 2011 18:18:51 GMT


Michael McCandless commented on LUCENE-3564:

bq. I personally think that we're going overboard with these methods rename (including IR.openIfChanged

Actually I think the "traps" you've been pointing out have been
excellent examples of poorly named methods.  Please keep pointing them

API design/naming is not easy, and generally developers are unable to
name things properly because we are too familiar with the code to see
what traps users.

The old IR.reopen has trapped users (two separate traps).  I think the
change in semantics (return null if there is no change), and rename
and cutover to static method, are important steps forward (addressed
the traps).

We can't anticipate all traps when we name our APIs but if users show
us over time that they are trappy we should try to address them when

bq. Is there a way to rollback without closing? That would seem far more useful.

There isn't today... I agree this would be useful.  I don't remember
off hand why the current one has to close after rollback...

Though, it's not so bad having to open a new writer afterwards?

Ie, unlike the commit case (before we had the commit method), where
having to do IW.close() to "commit" was bad because you may block
waiting for long merge(s) to complete, rollback() is fast since it
aborts all running merges.

bq. My personal preference for this API is the current simple and short name rollback().

I like short names too, but not if they are misleading/surprising (as
Shai pointed out, this one really is).

I guess it's OK to leave rollback as "short but misleading"; it's a
fairly expert API.  Also, it quickly becomes obvious to the user that
the IW was closed, so it's "fail fast" and the damage is not nearly as
bad as what we see when users don't understand the cost of optimize.

> rename IndexWriter.rollback to .rollbackAndClose
> ------------------------------------------------
>                 Key: LUCENE-3564
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.5, 4.0
> Spinoff from LUCENE-3454, where Shai noticed that rollback is trappy since it [unexpected]
closes the IW.
> I think we should rename it to rollbackAndClose.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


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

View raw message