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

Simon Willnauer commented on LUCENE-8785:
-----------------------------------------

{quote} I realize neither ES nor Solr expose deleteAll but I don't think that's 
a valid argument to remove it from Lucene.  
{quote}
 huh, I don't think that's a valid argument either, I just re-read my comments 
- sorry if you felt I was alluding to es or solr here. My argument is that if 
you want to do that you should construct a new IndexWriter instead of calling 
deleteAll(). Given this comment on the javadocs:
{noformat}
 Essentially a call to {@link #deleteAll()} is equivalent to creating a new 
{@link IndexWriter} with {@link OpenMode#CREATE} 
{noformat}
I want to understand why, in such a rather edgy case a user can't do exactly 
this. There is no race, no confusion it's very simple from a semantics 
perspective. Currently there are 2 ways and one if confusing. I think we should 
move towards removing the second way.

 
{quote}And for some reason the index is reset once per week, but the devs want 
to allow searching of the old index while the new index is (slowly) built up. 
But if something goes badly wrong, they need to be able to rollback (the 
deleteAll and all subsequently added docs) to the last commit and try again 
later. If instead it succeeds, then a refresh/commit will switch to the new 
index atomically. 
{quote}
 Well, there are tons of ways to do that no? I mean you can have 2 directories? 
Yes it causes some engineering effort but the semantics would be cleaner even 
for the app that does what you explain.

> TestIndexWriterDelete.testDeleteAllNoDeadlock failure
> -----------------------------------------------------
>
>                 Key: LUCENE-8785
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8785
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 7.6
>         Environment: OpenJDK 1.8.0_202
>            Reporter: Michael McCandless
>            Priority: Minor
>
> I was running Lucene's core tests on an {{i3.16xlarge}} EC2 instance (64 
> cores), and hit this random yet spooky failure:
> {noformat}
>    [junit4]   2> NOTE: reproduce with: ant test  
> -Dtestcase=TestIndexWriterDelete -Dtests.method=testDeleteAllNoDeadLock 
> -Dtests.seed=952BE262BA547C1 -Dtests.slow=true -Dtests.badapples=true 
> -Dtests.locale=ar-YE -Dtests.timezone=Europe/Lisbon -Dtests.as\
> serts=true -Dtests.file.encoding=US-ASCII
>    [junit4] ERROR   0.16s J3 | TestIndexWriterDelete.testDeleteAllNoDeadLock 
> <<<
>    [junit4]    > Throwable #1: 
> com.carrotsearch.randomizedtesting.UncaughtExceptionError: Captured an 
> uncaught exception in thread: Thread[id=36, name=Thread-2, state=RUNNABLE, 
> group=TGRP-TestIndexWriterDelete]
>    [junit4]    >        at 
> __randomizedtesting.SeedInfo.seed([952BE262BA547C1:3A4B5138AB66FD97]:0)
>    [junit4]    > Caused by: java.lang.RuntimeException: 
> java.lang.IllegalArgumentException: field number 0 is already mapped to field 
> name "null", not "content"
>    [junit4]    >        at 
> __randomizedtesting.SeedInfo.seed([952BE262BA547C1]:0)
>    [junit4]    >        at 
> org.apache.lucene.index.TestIndexWriterDelete$1.run(TestIndexWriterDelete.java:332)
>    [junit4]    > Caused by: java.lang.IllegalArgumentException: field number 
> 0 is already mapped to field name "null", not "content"
>    [junit4]    >        at 
> org.apache.lucene.index.FieldInfos$FieldNumbers.verifyConsistent(FieldInfos.java:310)
>    [junit4]    >        at 
> org.apache.lucene.index.FieldInfos$Builder.getOrAdd(FieldInfos.java:415)
>    [junit4]    >        at 
> org.apache.lucene.index.DefaultIndexingChain.getOrAddField(DefaultIndexingChain.java:650)
>    [junit4]    >        at 
> org.apache.lucene.index.DefaultIndexingChain.processField(DefaultIndexingChain.java:428)
>    [junit4]    >        at 
> org.apache.lucene.index.DefaultIndexingChain.processDocument(DefaultIndexingChain.java:394)
>    [junit4]    >        at 
> org.apache.lucene.index.DocumentsWriterPerThread.updateDocuments(DocumentsWriterPerThread.java:297)
>    [junit4]    >        at 
> org.apache.lucene.index.DocumentsWriter.updateDocuments(DocumentsWriter.java:450)
>    [junit4]    >        at 
> org.apache.lucene.index.IndexWriter.updateDocuments(IndexWriter.java:1291)
>    [junit4]    >        at 
> org.apache.lucene.index.IndexWriter.addDocuments(IndexWriter.java:1264)
>    [junit4]    >        at 
> org.apache.lucene.index.RandomIndexWriter.addDocument(RandomIndexWriter.java:159)
>    [junit4]    >        at 
> org.apache.lucene.index.TestIndexWriterDelete$1.run(TestIndexWriterDelete.java:326){noformat}
> It does *not* reproduce unfortunately ... but maybe there is some subtle 
> thread safety issue in this code ... this is a hairy part of Lucene ;)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to