Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.10, 5.0, 6.0
    • Component/s: core/index
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      This method used to be necessary, when our locking impls were buggy, but it's a godawful dangerous method: it invites index corruption.

      I think we should remove it.

      Apps that for some scary reason really need it can do their own thing...

      1. LUCENE-6060.patch
        12 kB
        Michael McCandless

        Activity

        Hide
        Michael McCandless added a comment -

        Simple patch...

        Show
        Michael McCandless added a comment - Simple patch...
        Hide
        Uwe Schindler added a comment -

        +1 - throw it away!

        We should also fix this Solr part! Forcefully unlocking solr should also go away - in fact this can no longer happen with NativeFSLockFactory because the lock is gone once all writers finished or crushed their JVM!

        Show
        Uwe Schindler added a comment - +1 - throw it away! We should also fix this Solr part! Forcefully unlocking solr should also go away - in fact this can no longer happen with NativeFSLockFactory because the lock is gone once all writers finished or crushed their JVM!
        Hide
        Michael McCandless added a comment -

        I was nervous about changing Solr's behavior here; maybe we can pursue that in a different issue ...

        Show
        Michael McCandless added a comment - I was nervous about changing Solr's behavior here; maybe we can pursue that in a different issue ...
        Hide
        Uwe Schindler added a comment -

        Maybe just open a new issue in SOLR!

        Show
        Uwe Schindler added a comment - Maybe just open a new issue in SOLR!
        Hide
        ASF subversion and git services added a comment -

        Commit 1639329 from Michael McCandless in branch 'dev/trunk'
        [ https://svn.apache.org/r1639329 ]

        LUCENE-6060: remove IndexWriter.unlock

        Show
        ASF subversion and git services added a comment - Commit 1639329 from Michael McCandless in branch 'dev/trunk' [ https://svn.apache.org/r1639329 ] LUCENE-6060 : remove IndexWriter.unlock
        Hide
        ASF subversion and git services added a comment -

        Commit 1639330 from Michael McCandless in branch 'dev/branches/branch_5x'
        [ https://svn.apache.org/r1639330 ]

        LUCENE-6060: remove IndexWriter.unlock

        Show
        ASF subversion and git services added a comment - Commit 1639330 from Michael McCandless in branch 'dev/branches/branch_5x' [ https://svn.apache.org/r1639330 ] LUCENE-6060 : remove IndexWriter.unlock
        Hide
        ASF subversion and git services added a comment -

        Commit 1639350 from Michael McCandless in branch 'dev/branches/lucene_solr_4_10'
        [ https://svn.apache.org/r1639350 ]

        LUCENE-6060: deprecate IndexWriter.unlock

        Show
        ASF subversion and git services added a comment - Commit 1639350 from Michael McCandless in branch 'dev/branches/lucene_solr_4_10' [ https://svn.apache.org/r1639350 ] LUCENE-6060 : deprecate IndexWriter.unlock
        Hide
        Michael McCandless added a comment -

        I deprecated IndexWriter.unlock in 4.10.x ... I'll open a follow-on Solr issue.

        Show
        Michael McCandless added a comment - I deprecated IndexWriter.unlock in 4.10.x ... I'll open a follow-on Solr issue.
        Hide
        Michael McCandless added a comment -

        Maybe just open a new issue in SOLR!

        SOLR-6737

        Show
        Michael McCandless added a comment - Maybe just open a new issue in SOLR! SOLR-6737
        Hide
        Tomás Fernández Löbbe added a comment -

        in fact this can no longer happen with NativeFSLockFactory

        What about SimpleFSLockFactory? That was the one that would have problems in JVM crashes right? The Java bug linked in the javadoc is old and has been fixed long ago, I guess that means that it's now safe and shouldn't leave a write.lock file even if JVM crashes

        Show
        Tomás Fernández Löbbe added a comment - in fact this can no longer happen with NativeFSLockFactory What about SimpleFSLockFactory ? That was the one that would have problems in JVM crashes right? The Java bug linked in the javadoc is old and has been fixed long ago, I guess that means that it's now safe and shouldn't leave a write.lock file even if JVM crashes
        Hide
        Michael McCandless added a comment -

        I think SimpleFSLockFactory is still able to leave leftover write.lock in the index ... it doesn't use deleteOnExit, so that JVM bug doesn't apply to it.

        Show
        Michael McCandless added a comment - I think SimpleFSLockFactory is still able to leave leftover write.lock in the index ... it doesn't use deleteOnExit, so that JVM bug doesn't apply to it.
        Hide
        Tomás Fernández Löbbe added a comment -

        Are there still reasons for not using deleteOnExit in SimpleFSLockFactory? I feel that removing the unlockOnStartup option while there are still cases where the index is left locked could bite people when upgrading.

        Show
        Tomás Fernández Löbbe added a comment - Are there still reasons for not using deleteOnExit in SimpleFSLockFactory? I feel that removing the unlockOnStartup option while there are still cases where the index is left locked could bite people when upgrading.
        Hide
        Michael McCandless added a comment -

        Well, Solr still has the unlockOnStartup; I wasn't sure what to do with that so I left it for now and opened SOLR-6737.

        Most Lucene apps shouldn't be using the legacy SimpleFSLockFactory, and if they are 1) they must already be dealing with the "remove lock on startup", 2) if they are doing so via IndexWriter.unlock, they will see the deprecation/compilation error on upgrade, dig in CHANGES, find this issue, and then have to do their own scary things: I think this is healthy.

        I don't really like the deleteOnExit method.

        Show
        Michael McCandless added a comment - Well, Solr still has the unlockOnStartup; I wasn't sure what to do with that so I left it for now and opened SOLR-6737 . Most Lucene apps shouldn't be using the legacy SimpleFSLockFactory, and if they are 1) they must already be dealing with the "remove lock on startup", 2) if they are doing so via IndexWriter.unlock, they will see the deprecation/compilation error on upgrade, dig in CHANGES, find this issue, and then have to do their own scary things: I think this is healthy. I don't really like the deleteOnExit method.
        Hide
        Anshum Gupta added a comment -

        Bulk close after 5.0 release.

        Show
        Anshum Gupta added a comment - Bulk close after 5.0 release.

          People

          • Assignee:
            Michael McCandless
            Reporter:
            Michael McCandless
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development