You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "Michael McCandless (Jira)" <ji...@apache.org> on 2020/11/19 19:17:00 UTC

[jira] [Commented] (LUCENE-9617) FieldNumbers.clear() should reset lowestUnassignedFieldNumber

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

Michael McCandless commented on LUCENE-9617:
--------------------------------------------

Whoa, good catch [~msfroh]!  I'll try to review your PR, thank you.

> FieldNumbers.clear() should reset lowestUnassignedFieldNumber
> -------------------------------------------------------------
>
>                 Key: LUCENE-9617
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9617
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 8.7
>            Reporter: Michael Froh
>            Priority: Minor
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> A call to IndexWriter.deleteAll() should completely reset the state of the index. Part of that is a call to globalFieldNumbersMap.clear(), which purges all knowledge of fields by clearing name -> number and number -> name maps. However, it does not reset lowestUnassignedFieldNumber.
> If we have loop that adds some documents, calls deleteAll(), adds documents, etc. lowestUnassignedFieldNumber keeps counting up. Since FieldInfos allocates an array for number -> FieldInfo, this array will get larger and larger, effectively leaking memory.
> We can fix this by resetting lowestUnassignedFieldNumber to -1 in FieldNumbers.clear().
> I'll write a unit test and attach a patch.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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