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 (JIRA)" <ji...@apache.org> on 2008/10/01 12:25:44 UTC

[jira] Commented: (LUCENE-1408) DocumentsWriter.init() doesn't grow fieldDataHash array at same rate as allFieldData array, leading to OOM errors

    [ https://issues.apache.org/jira/browse/LUCENE-1408?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12635991#action_12635991 ] 

Michael McCandless commented on LUCENE-1408:
--------------------------------------------

Whoa, good catch!  We are growing the hash too quickly, and, under utilizing it.

This is actually already fixed in 2.4 -- DocumentsWriter.java was refactored into an [internal only] indexing chain.  This code moved to DocFieldProcessorPerThread.java:

    https://svn.apache.org/repos/asf/lucene/java/trunk/src/java/org/apache/lucene/index/DocFieldProcessorPerThread.java

With the refactoring we no longer have 2 arrays (we just have the hash) and the hash "properly" doubles its size and sets mask = size-1 when it needs to grow.  Can you look at the code above and see if it looks right?  If so, I'm leaning towards resolving this as WONTFIX (on 2.3.x) since it's already fixed in 2.4.

> DocumentsWriter.init() doesn't grow fieldDataHash array at same rate as allFieldData array, leading to OOM errors
> -----------------------------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-1408
>                 URL: https://issues.apache.org/jira/browse/LUCENE-1408
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Index
>    Affects Versions: 2.3.2
>         Environment: NA
>            Reporter: David C. Navas
>            Priority: Minor
>
> See DocumentsWriter.init() -- line 787ish
> When a new field is encountered, and arrays need to be resized, the allFieldDataArray is resized to be 50% larger, and the hashArray is resized to be twice as large.  Everytime.  The hashArray grows much faster than the fieldData array.
> In addition, the fieldDataHashMask is set to be one less than the *fieldDataArray* size, rather than the hashArray.
> The latter problem obviously leads to under/bizarre utilization of the hash array, while the former can, under circumstances where you are using an excessive number of field columns, lead to premature OOMs (30k field columns is something like 30 million entry placeholders in the hash array, or about 120M per ThreadState).
> Trivial fix for both would be to change *1.5 to *2, and reset the Mask based on newHashSize, not newSize.  Given you are using a mask, it looks like you want a power of two, so you can't use *1.5 everywhere, but you could resize the hash only when needed, rather than each time you resize the data array, though that would be somewhat more difficult.
> I made this Minor as it only affects extreme field use.

-- 
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: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org