You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Geoff Cooney (JIRA)" <ji...@apache.org> on 2011/08/08 15:44:27 UTC

[jira] [Created] (LUCENE-3365) Create or Append mode determined before obtaining write lock

Create or Append mode determined before obtaining write lock
------------------------------------------------------------

                 Key: LUCENE-3365
                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
             Project: Lucene - Java
          Issue Type: Bug
          Components: core/index
    Affects Versions: 3.3, 3.2, 3.1
            Reporter: Geoff Cooney
            Priority: Minor


If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.

This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Simon Willnauer updated LUCENE-3365:
------------------------------------

         Priority: Major  (was: Minor)
    Lucene Fields: [New, Patch Available]  (was: [New])
    Fix Version/s: 4.0
                   3.4

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Assignee: Simon Willnauer
>              Labels: IndexWriter
>             Fix For: 3.4, 4.0
>
>         Attachments: LUCENE-3365.patch, LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Geoff Cooney commented on LUCENE-3365:
--------------------------------------

I'm uploading a patch that contains a test that demonstrates this issue as well as a proposed fix.

The proposed fix is simply to move the create or append decision a step lower so it occurs after the lock is obtained.

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Priority: Minor
>              Labels: IndexWriter
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Geoff Cooney updated LUCENE-3365:
---------------------------------

    Attachment: LUCENE-3365.patch

Patch containing junit test case and fix

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Priority: Minor
>              Labels: IndexWriter
>         Attachments: LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Simon Willnauer updated LUCENE-3365:
------------------------------------

    Attachment: LUCENE-3365.patch

hey Geoff, thanks for reporting and fixing this. I updated your patch to trunk (4.0) and simplyfied the testcase a little (no busy waiting etc) I am planning to commit this soon to trunk and backport to 3.x

thanks!

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Assignee: Simon Willnauer
>              Labels: IndexWriter
>             Fix For: 3.4, 4.0
>
>         Attachments: LUCENE-3365.patch, LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Simon Willnauer resolved LUCENE-3365.
-------------------------------------

    Resolution: Fixed

committed to trunk & backported to 3.x

thanks geoff!

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Assignee: Simon Willnauer
>              Labels: IndexWriter
>             Fix For: 3.4, 4.0
>
>         Attachments: LUCENE-3365.patch, LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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] [Assigned] (LUCENE-3365) Create or Append mode determined before obtaining write lock

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

Simon Willnauer reassigned LUCENE-3365:
---------------------------------------

    Assignee: Simon Willnauer

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Assignee: Simon Willnauer
>            Priority: Minor
>              Labels: IndexWriter
>         Attachments: LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Geoff Cooney commented on LUCENE-3365:
--------------------------------------

Glad I could help!

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Assignee: Simon Willnauer
>              Labels: IndexWriter
>             Fix For: 3.4, 4.0
>
>         Attachments: LUCENE-3365.patch, LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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-3365) Create or Append mode determined before obtaining write lock

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

Geoff Cooney updated LUCENE-3365:
---------------------------------

    Comment: was deleted

(was: Patch containing junit test case and fix)

> Create or Append mode determined before obtaining write lock
> ------------------------------------------------------------
>
>                 Key: LUCENE-3365
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3365
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 3.1, 3.2, 3.3
>            Reporter: Geoff Cooney
>            Priority: Minor
>              Labels: IndexWriter
>         Attachments: LUCENE-3365.patch
>
>
> If an IndexWriter("writer1") is opened in CREATE_OR_APPEND mode, it determines whether to CREATE or APPEND before obtaining the write lock.  When another IndexWriter("writer2") is in the process of creating the index, this can result in writer1 entering create mode and then waiting to obtain the lock.  When writer2 commits and releases the lock, writer1 is already in create mode and overwrites the index created by write2.
> This bug was probably effected by LUCENE-2386 as prior to that Lucene generated an empty commit when a new index was created.  I think the issue could still have occurred prior to that but the two IndexWriters would have needed to be opened nearly simultaneously and the first IndexWriter would need to release the lock before the second timed out.

--
This message is automatically generated by JIRA.
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