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

Hoss Man commented on LUCENE-5843:
----------------------------------

Mike: couple quick suggestions...

* {code}
private static int actualMaxDocs = MAX_DOCS;
static void setMaxDocs(int docs) {
  if (MAX_DOCS < docs) throw UglyException
  actualMaxDocs = docs;
}
{code}...that way some poor bastard who sees it in the code and tries to be 
crafty and add a stub class to that package to set it to Integer.MAX_VALUE will 
get an immedaite error instead of a timebomb.
* add a *public* method to the test-framework that wraps this package protected 
setter, so that _tests_ in other packages besides {{org.apache.lucene.index}} 
can mutate this.
** then we can add tests for clean behavior in solr as well (not to mention 
anybody else who writes a Lucene app and wants to test for how their app 
behaves when the index gets too big w/o adding an {{org/apache/lucene/index}} 
dir to their test source

> IndexWriter should refuse to create an index with more than INT_MAX docs
> ------------------------------------------------------------------------
>
>                 Key: LUCENE-5843
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5843
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>             Fix For: 5.0, 4.10
>
>         Attachments: LUCENE-5843.patch, LUCENE-5843.patch
>
>
> It's more and more common for users these days to create very large indices, 
> e.g.  indexing lines from log files, or packets on a network, etc., and it's 
> not hard to accidentally exceed the maximum number of documents in one index.
> I think the limit is actually Integer.MAX_VALUE-1 docs, because we use that 
> value as a sentinel during searching.
> I'm not sure what IW does today if you create a too-big index but it's 
> probably horrible; it may succeed and then at search time you hit nasty 
> exceptions when we overflow int.
> I think it should throw an IndexFullException instead.  It'd be nice if we 
> could do this on the very doc that when added would go over the limit, but I 
> would also settle for just throwing at flush as well ... i.e. I think what's 
> really important is that the index does not become unusable.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

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

Reply via email to