You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Sivan Yogev (JIRA)" <ji...@apache.org> on 2012/06/19 09:16:42 UTC

[jira] [Created] (LUCENE-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

Sivan Yogev created LUCENE-4156:
-----------------------------------

             Summary: Improve implementation of DirectoryTaxonomyWriter.getSize()
                 Key: LUCENE-4156
                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
             Project: Lucene - Java
          Issue Type: Improvement
          Components: modules/facet
            Reporter: Sivan Yogev
            Priority: Minor


Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Sivan Yogev commented on LUCENE-4156:
-------------------------------------

Since getParent() could be heavily used during facets indexing I was thinking that reducing the two method calls (one to getParent another for ensureOpen) could make a difference, but you are right that it is not safe for future implementation details. So best keep the patch as is.
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4156.patch
>
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Shai Erera commented on LUCENE-4156:
------------------------------------

I think that we can remove the synchronized from getSize() and change nextID to either volatile, or AtomicInteger. getSize() is not only public API used by applications, but getParent() uses it too.

Eliminating synchronization is good !
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Shai Erera commented on LUCENE-4156:
------------------------------------

You're right, 2 extra method calls are not worth the defensive code. If we'll change getSize(), I hope that we'll remember to fix getParent too. At any rate, the reason we check the size is for throwing a friendlier exception with text. If someone passes an invalid ordinal, he'll get AIOOBE anyway, just without the text.

I'll commit this now.
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4156.patch
>
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Shai Erera resolved LUCENE-4156.
--------------------------------

       Resolution: Fixed
    Fix Version/s: 5.0
                   4.0
    Lucene Fields: New,Patch Available  (was: New)

Committed revisions 1352038 and 1352039.

Thanks Sivan !
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>             Fix For: 4.0, 5.0
>
>         Attachments: LUCENE-4156.patch
>
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Shai Erera commented on LUCENE-4156:
------------------------------------

I've been thinking about it when I fixed it ... eventually I chose this way because if we'll ever need to change getSize to call writer.maxDoc() again, or implement otherwise for correctness, getParent will benefit from it too. I don't know if it's critical though that there's a method call - is that what bothers you?
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4156.patch
>
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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] [Assigned] (LUCENE-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Shai Erera reassigned LUCENE-4156:
----------------------------------

    Assignee: Shai Erera
    
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Shai Erera updated LUCENE-4156:
-------------------------------

    Attachment: LUCENE-4156.patch

Remove synchronization from getSize() and made nextID volatile. I also clarified some javadocs and improved the exception thrown from getParent().
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4156.patch
>
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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-4156) Improve implementation of DirectoryTaxonomyWriter.getSize()

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

Sivan Yogev commented on LUCENE-4156:
-------------------------------------

Patch looks good, I have one question. In line 829, can we replace getSize() with nextID?
                
> Improve implementation of DirectoryTaxonomyWriter.getSize()
> -----------------------------------------------------------
>
>                 Key: LUCENE-4156
>                 URL: https://issues.apache.org/jira/browse/LUCENE-4156
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: modules/facet
>            Reporter: Sivan Yogev
>            Assignee: Shai Erera
>            Priority: Minor
>         Attachments: LUCENE-4156.patch
>
>
> Current implementation of DirectoryTaxonomyWriter.getSize() is synchrionized and invokes indexWriter.maxDoc(), both harming performance.

--
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