LUCENE-1995: don't let IndexWriter's ram buffer size exceed 2048 MB

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@827010 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2009-10-20 09:04:51 +00:00
parent cb86ea9ad6
commit faa1b9815e
2 changed files with 15 additions and 0 deletions

View File

@ -110,6 +110,10 @@ Bug fixes
* LUCENE-1992: Fix thread hazard if a merge is committing just as an
exception occurs during sync (Uwe Schindler, Mike McCandless)
* LUCENE-1995: Note in javadocs that IndexWriter.setRAMBufferSizeMB
cannot exceed 2048 MB, and throw IllegalArgumentException if it
does. (Aaron McKee, Yonik Seeley, Mike McCandless)
New features
* LUCENE-1933: Provide a convenience AttributeFactory that creates a

View File

@ -1338,6 +1338,14 @@ public class IndexWriter implements Closeable {
* instead of RAM usage (each buffered delete Query counts
* as one).
*
* <p> <b>NOTE</b>: because IndexWriter uses
* <code>int</code>s when managing its internal storage,
* the absolute maximum value for this setting is somewhat
* less than 2048 MB. The precise limit depends on
* various factors, such as how large your documents are,
* how many fields have norms, etc., so it's best to set
* this value comfortably under 2048.</p>
*
* <p> The default value is {@link #DEFAULT_RAM_BUFFER_SIZE_MB}.</p>
*
* @throws IllegalArgumentException if ramBufferSize is
@ -1345,6 +1353,9 @@ public class IndexWriter implements Closeable {
* when maxBufferedDocs is already disabled
*/
public void setRAMBufferSizeMB(double mb) {
if (mb > 2048.0) {
throw new IllegalArgumentException("ramBufferSize " + mb + " is too large; should be comfortably less than 2048");
}
if (mb != DISABLE_AUTO_FLUSH && mb <= 0.0)
throw new IllegalArgumentException(
"ramBufferSize should be > 0.0 MB when enabled");