You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Uwe Schindler (JIRA)" <ji...@apache.org> on 2010/11/19 22:49:13 UTC

[jira] Created: (LUCENE-2772) Make SlowMultiReaderWrapper wrap always so close() is safe

Make SlowMultiReaderWrapper wrap always so close() is safe
----------------------------------------------------------

                 Key: LUCENE-2772
                 URL: https://issues.apache.org/jira/browse/LUCENE-2772
             Project: Lucene - Java
          Issue Type: Sub-task
            Reporter: Uwe Schindler
            Assignee: Uwe Schindler


The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is very low, the work done in the static wrap method is much higher (instantiate ArrayList, recusively went through all subreaders), just to check the number of readers than simply always wrapping.

MultiFields already is optimized when called by one-segment or atomic readers, so there is no overhead at all. So this patch removes the static wrap method and you simply wrap like a TokenFilter with ctor: new SlowMultiReaderWrapper(reader)

When this is done, there is also no risk to close a SegmentReader (which you should not do), when wrap() returns a single SegmentReader. This help in parent issue with cleaning up the case in close().

The patch aölso removes the now useless mainReader/reader variables and simply closes the wrapper.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2772) Make SlowMultiReaderWrapper wrap always so close() is safe

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

Michael McCandless commented on LUCENE-2772:
--------------------------------------------

Looks great Uwe!

> Make SlowMultiReaderWrapper wrap always so close() is safe
> ----------------------------------------------------------
>
>                 Key: LUCENE-2772
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2772
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-2772.patch
>
>
> The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is very low, the work done in the static wrap method is much higher (instantiate ArrayList, recusively went through all subreaders), just to check the number of readers than simply always wrapping.
> MultiFields already is optimized when called by one-segment or atomic readers, so there is no overhead at all. So this patch removes the static wrap method and you simply wrap like a TokenFilter with ctor: new SlowMultiReaderWrapper(reader)
> When this is done, there is also no risk to close a SegmentReader (which you should not do), when wrap() returns a single SegmentReader. This help in parent issue with cleaning up the case in close().
> The patch aölso removes the now useless mainReader/reader variables and simply closes the wrapper.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2772) Make SlowMultiReaderWrapper wrap always so close() is safe

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

Uwe Schindler updated LUCENE-2772:
----------------------------------

    Fix Version/s: 4.0

> Make SlowMultiReaderWrapper wrap always so close() is safe
> ----------------------------------------------------------
>
>                 Key: LUCENE-2772
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2772
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>
> The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is very low, the work done in the static wrap method is much higher (instantiate ArrayList, recusively went through all subreaders), just to check the number of readers than simply always wrapping.
> MultiFields already is optimized when called by one-segment or atomic readers, so there is no overhead at all. So this patch removes the static wrap method and you simply wrap like a TokenFilter with ctor: new SlowMultiReaderWrapper(reader)
> When this is done, there is also no risk to close a SegmentReader (which you should not do), when wrap() returns a single SegmentReader. This help in parent issue with cleaning up the case in close().
> The patch aölso removes the now useless mainReader/reader variables and simply closes the wrapper.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2772) Make SlowMultiReaderWrapper wrap always so close() is safe

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

Uwe Schindler updated LUCENE-2772:
----------------------------------

    Attachment: LUCENE-2772.patch

Here the patch:
- When SlowMultiReaderWrapper will in future clean up the cache on close, the tests should not simply only close inner reader but instead close wrapper reader (which only delegates currently). This is also the only correct usage for Decoration pattern (see TokenFilter & co.)
- TestFilterIndexReader had a bug when the "source" index has more than one segment, this is fixed now, because we always wrap and wrapped reader delegates close.

> Make SlowMultiReaderWrapper wrap always so close() is safe
> ----------------------------------------------------------
>
>                 Key: LUCENE-2772
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2772
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-2772.patch
>
>
> The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is very low, the work done in the static wrap method is much higher (instantiate ArrayList, recusively went through all subreaders), just to check the number of readers than simply always wrapping.
> MultiFields already is optimized when called by one-segment or atomic readers, so there is no overhead at all. So this patch removes the static wrap method and you simply wrap like a TokenFilter with ctor: new SlowMultiReaderWrapper(reader)
> When this is done, there is also no risk to close a SegmentReader (which you should not do), when wrap() returns a single SegmentReader. This help in parent issue with cleaning up the case in close().
> The patch aölso removes the now useless mainReader/reader variables and simply closes the wrapper.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (LUCENE-2772) Make SlowMultiReaderWrapper wrap always so close() is safe

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

Uwe Schindler resolved LUCENE-2772.
-----------------------------------

    Resolution: Fixed

Committed revision: 1037294

> Make SlowMultiReaderWrapper wrap always so close() is safe
> ----------------------------------------------------------
>
>                 Key: LUCENE-2772
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2772
>             Project: Lucene - Java
>          Issue Type: Sub-task
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 4.0
>
>         Attachments: LUCENE-2772.patch
>
>
> The overhead when wrapping an atomic reader using SlowMultiReaderWrapper is very low, the work done in the static wrap method is much higher (instantiate ArrayList, recusively went through all subreaders), just to check the number of readers than simply always wrapping.
> MultiFields already is optimized when called by one-segment or atomic readers, so there is no overhead at all. So this patch removes the static wrap method and you simply wrap like a TokenFilter with ctor: new SlowMultiReaderWrapper(reader)
> When this is done, there is also no risk to close a SegmentReader (which you should not do), when wrap() returns a single SegmentReader. This help in parent issue with cleaning up the case in close().
> The patch aölso removes the now useless mainReader/reader variables and simply closes the wrapper.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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