lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Simon Willnauer (Commented) (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LUCENE-3876) TestIndexWriterExceptions fails (reproducible)
Date Fri, 16 Mar 2012 09:59:43 GMT

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

Simon Willnauer commented on LUCENE-3876:
-----------------------------------------

this seems to be related to LUCENE-3874. The patch in LUCENE-3874 isn't actually working all
the time since on very large positions is > Int.MAX >> 1 we can easily shift a leading
1 in FreqProxTermsWriterPerField#writeProx makeing the position value negative. I think we
need to do something like:

{code}
--- a/lucene/core/src/java/org/apache/lucene/index/DocInverterPerField.java
+++ b/lucene/core/src/java/org/apache/lucene/index/DocInverterPerField.java
@@ -110,9 +110,9 @@ final class DocInverterPerField extends DocFieldConsumerPerField {
 
             final int posIncr = posIncrAttribute.getPositionIncrement();
             int position = fieldState.position + posIncr;
-            if (position > 0) {
+            if (position > 0 && position <= (Integer.MAX_VALUE>>1)) {
               position--;
-            } else if (position < 0) {
+            } else if (position != 0) {
               throw new IllegalArgumentException("position overflow for field '" + field.name()
+ "'");
             }
{code} 

to make sure we have a leading 0 or rather two leading 0's to prevent the overflow.

                
> TestIndexWriterExceptions fails (reproducible)
> ----------------------------------------------
>
>                 Key: LUCENE-3876
>                 URL: https://issues.apache.org/jira/browse/LUCENE-3876
>             Project: Lucene - Java
>          Issue Type: Bug
>            Reporter: Dawid Weiss
>            Priority: Minor
>             Fix For: 4.0
>
>
> {noformat}
> ant test -Dtestcase=TestIndexWriterExceptions -Dtestmethod=testIllegalPositions -Dtests.seed=-228094d3d2f35cf2:-496e33eec9bbd57c:36a1c54f4e1bb32
-Dargs="-Dfile.encoding=UTF-8"
>     [junit] junit.framework.AssertionFailedError: position=-2 lastPosition=0
>     [junit]     at org.apache.lucene.codecs.lucene40.Lucene40PostingsWriter.addPosition(Lucene40PostingsWriter.java:215)
>     [junit]     at org.apache.lucene.index.FreqProxTermsWriterPerField.flush(FreqProxTermsWriterPerField.java:519)
>     [junit]     at org.apache.lucene.index.FreqProxTermsWriter.flush(FreqProxTermsWriter.java:92)
>     [junit]     at org.apache.lucene.index.TermsHash.flush(TermsHash.java:117)
>     [junit]     at org.apache.lucene.index.DocInverter.flush(DocInverter.java:53)
>     [junit]     at org.apache.lucene.index.DocFieldProcessor.flush(DocFieldProcessor.java:81)
>     [junit]     at org.apache.lucene.index.DocumentsWriterPerThread.flush(DocumentsWriterPerThread.java:475)
>     [junit]     at org.apache.lucene.index.DocumentsWriter.doFlush(DocumentsWriter.java:422)
>     [junit]     at org.apache.lucene.index.DocumentsWriter.flushAllThreads(DocumentsWriter.java:553)
>     [junit]     at org.apache.lucene.index.IndexWriter.doFlush(IndexWriter.java:2640)
>     [junit]     at org.apache.lucene.index.IndexWriter.flush(IndexWriter.java:2616)
>     [junit]     at org.apache.lucene.index.IndexWriter.closeInternal(IndexWriter.java:851)
>     [junit]     at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:810)
>     [junit]     at org.apache.lucene.index.IndexWriter.close(IndexWriter.java:774)
>     [junit]     at org.apache.lucene.index.TestIndexWriterExceptions.testIllegalPositions(TestIndexWriterExceptions.java:1517)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>     [junit]     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>     [junit]     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>     [junit]     at java.lang.reflect.Method.invoke(Method.java:597)
>     [junit]     at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)
>     [junit]     at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
>     [junit]     at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)
>     [junit]     at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
>     [junit]     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>     [junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
>     [junit]     at org.apache.lucene.util.LuceneTestCase$SubclassSetupTeardownRule$1.evaluate(LuceneTestCase.java:729)
>     [junit]     at org.apache.lucene.util.LuceneTestCase$InternalSetupTeardownRule$1.evaluate(LuceneTestCase.java:645)
>     [junit]     at org.apache.lucene.util.SystemPropertiesInvariantRule$1.evaluate(SystemPropertiesInvariantRule.java:22)
>     [junit]     at org.apache.lucene.util.LuceneTestCase$TestResultInterceptorRule$1.evaluate(LuceneTestCase.java:556)
>     [junit]     at org.apache.lucene.util.UncaughtExceptionsRule$1.evaluate(UncaughtExceptionsRule.java:51)
>     [junit]     at org.apache.lucene.util.LuceneTestCase$RememberThreadRule$1.evaluate(LuceneTestCase.java:618)
>     [junit]     at org.junit.rules.RunRules.evaluate(RunRules.java:18)
>     [junit]     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)
>     [junit]     at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)
>     [junit]     at org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseRunner.java:164)
>     [junit]     at org.apache.lucene.util.LuceneTestCaseRunner.runChild(LuceneTestCaseRunner.java:57)
>     [junit]     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)
>     [junit]     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)
>     [junit]     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)
>     [junit]     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)
>     [junit]     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)
>     [junit]     at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
>     [junit]     at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30)
>     [junit]     at org.apache.lucene.util.UncaughtExceptionsRule$1.evaluate(UncaughtExceptionsRule.java:51)
>     [junit]     at org.apache.lucene.util.StoreClassNameRule$1.evaluate(StoreClassNameRule.java:21)
>     [junit]     at org.apache.lucene.util.SystemPropertiesInvariantRule$1.evaluate(SystemPropertiesInvariantRule.java:22)
>     [junit]     at org.junit.rules.RunRules.evaluate(RunRules.java:18)
>     [junit]     at org.junit.runners.ParentRunner.run(ParentRunner.java:300)
>     [junit]     at junit.framework.JUnit4TestAdapter.run(JUnit4TestAdapter.java:39)
>     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:518)
>     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.launch(JUnitTestRunner.java:1052)
>     [junit]     at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:906)
>     [junit] 
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Mime
View raw message