You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael McCandless (Created) (JIRA)" <ji...@apache.org> on 2012/03/15 16:37:37 UTC

[jira] [Created] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Index changes are lost if you call prepareCommit() then close()
---------------------------------------------------------------

                 Key: LUCENE-3872
                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
             Project: Lucene - Java
          Issue Type: Bug
            Reporter: Michael McCandless
            Assignee: Michael McCandless
             Fix For: 3.6, 4.0


You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).

Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.

I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Resolved] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Michael McCandless (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless resolved LUCENE-3872.
----------------------------------------

    Resolution: Fixed

Thanks Tim!
                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch, LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Updated] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Michael McCandless (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-3872:
---------------------------------------

    Attachment: LUCENE-3872.patch

Patch, I think it's ready.

One test was failing to call the commit() matching its prepareCommit()... I fixed it.
                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch, LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Dawid Weiss (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230436#comment-13230436 ] 

Dawid Weiss commented on LUCENE-3872:
-------------------------------------

bq. I guess i feel close() should really be rollback().

Yeah... I think this feeling of unease is fairly common -- see JDBC's Connection javadoc on close, for example: "It is strongly recommended that an application explicitly commits or rolls back an active transaction prior to calling the close method. If the close method is called and there is an active transaction, the results are implementation-defined."
                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch, LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Robert Muir (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230345#comment-13230345 ] 

Robert Muir commented on LUCENE-3872:
-------------------------------------

{quote}
in this case IW.close would detect the missing call to commit, call commit, and call commit again to save any changes done after the prepareCommit and before close.
{quote}

I think that would make it even more lenient and complicated and worse. I guess i feel close() should really be rollback(). But this is likely ridiculous to change.
So on second thought I think patch is good... if someone is handling exceptional cases like this they should be thinking about using rollback() anyway,
and they have this option still.

I wasn't really against the patch anyway, just whining. its definitely an improvement on the current behavior, let's do it.

                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch, LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Michael McCandless (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230307#comment-13230307 ] 

Michael McCandless commented on LUCENE-3872:
--------------------------------------------

Well, we could also easily allow skipping the call to commit... in this case IW.close would detect the missing call to commit, call commit, and call commit again to save any changes done after the prepareCommit and before close.

                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch, LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Updated] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Michael McCandless (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Michael McCandless updated LUCENE-3872:
---------------------------------------

    Attachment: LUCENE-3872.patch

Patch w/ failing test showing how we silently lose indexed docs...
                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


[jira] [Commented] (LUCENE-3872) Index changes are lost if you call prepareCommit() then close()

Posted by "Robert Muir (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-3872?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13230293#comment-13230293 ] 

Robert Muir commented on LUCENE-3872:
-------------------------------------

I don't have a better fix, but at the same time i feel you should be able to close() at any time,
(such as when handling exceptions in your app), since we are a real closeable here.

                
> Index changes are lost if you call prepareCommit() then close()
> ---------------------------------------------------------------
>
>                 Key: LUCENE-3872
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3872
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 3.6, 4.0
>
>         Attachments: LUCENE-3872.patch, LUCENE-3872.patch
>
>
> You are supposed to call commit() after calling prepareCommit(), but... if you forget, and call close() after prepareCommit() without calling commit(), then any changes done after the prepareCommit() are silently lost (including adding/deleting docs, but also any completed merges).
> Spinoff from java-user thread "lots of .cfs (compound files) in the index directory" from Tim Bogaert.
> I think to fix this, IW.close should throw an IllegalStateException if prepareCommit() was called with no matching call to commit().

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org