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

Uwe Schindler edited comment on LUCENE-5574 at 4/4/14 6:31 PM:
---------------------------------------------------------------

Hi Mike,

the test does not work on windows with a FSDirectory subclass. This is because 
Windows does not allow to write to a file thats already open. So we must 
disable this test for Windows filesystems:

{code}
assumeFalse(Constants.WINDOWS && dir instanceof FSDirectory);
{code}

That is the error I get:

{noformat}
C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr2\lucene\core>ant test 
-Dtestcase=TestIndexWriter 
-Dtestmethod=testClosingNRTReaderDoesNotCorruptYourIndex 
-Dtests.directory=SimpleFSDirectory

   [junit4] <JUnit4> says kaixo! Master seed: 46D71A0205CD3C16
   [junit4] Your default console's encoding may not display certain unicode 
glyphs: windows-1252
   [junit4] Executing 1 suite with 1 JVM.
   [junit4] 
   [junit4] Started J0 PID(10652@VEGA).
   [junit4] Suite: org.apache.lucene.index.TestIndexWriter
   [junit4]   2> NOTE: reproduce with: ant test  -Dtestcase=TestIndexWriter 
-Dtests.method=testClosingNRTReaderDoesNotCorruptYourIndex 
-Dtests.seed=46D71A0205CD3C16 -Dtests.directory=SimpleFSDirectory 
-Dtests.locale=pt_BR -Dtests.timezone=Portugal -Dtests.file.encoding=Cp1252
   [junit4] ERROR   0.63s | 
TestIndexWriter.testClosingNRTReaderDoesNotCorruptYourIndex <<<
   [junit4]    > Throwable #1: java.io.IOException: Cannot delete C:\Users\Uwe 
Schindler\Projects\lucene\trunk-lusolr2\lucene\build\core\test\J0\index5311553115tmp\_0.doc
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([46D71A0205CD3C16:31060EF37DD6C629]:0)
   [junit4]    >        at 
org.apache.lucene.store.FSDirectory.deleteFile(FSDirectory.java:256)
   [junit4]    >        at 
org.apache.lucene.store.MockDirectoryWrapper.deleteFile(MockDirectoryWrapper.java:456)
   [junit4]    >        at 
org.apache.lucene.store.MockDirectoryWrapper.deleteFile(MockDirectoryWrapper.java:409)
   [junit4]    >        at 
org.apache.lucene.index.TestIndexWriter.testClosingNRTReaderDoesNotCorruptYourIndex(TestIndexWriter.java:2403)
   [junit4]    >        at java.lang.Thread.run(Thread.java:724)
   [junit4]   2> NOTE: test params are: codec=Asserting, 
sim=RandomSimilarityProvider(queryNorm=true,coord=no): {a=IB LL-L3(800.0)}, 
locale=pt_BR, timezone=Portugal
   [junit4]   2> NOTE: Windows 7 6.1 amd64/Oracle Corporation 1.7.0_25 
(64-bit)/cpus=8,threads=1,free=133047752,total=156237824
   [junit4]   2> NOTE: All tests run in this JVM: [TestIndexWriter]
   [junit4] Completed in 1.11s, 1 test, 1 error <<< FAILURES!
   [junit4] 
   [junit4] 
   [junit4] Tests with failures:
   [junit4]   - 
org.apache.lucene.index.TestIndexWriter.testClosingNRTReaderDoesNotCorruptYourIndex
   [junit4] 
   [junit4] 
   [junit4] JVM J0:     0.67 ..     2.61 =     1.94s
   [junit4] Execution time total: 2.62 sec.
   [junit4] Tests summary: 1 suite, 1 test, 1 error
{noformat}

In general, I don't think the whole problem exists on Windows! The file system 
protects you from doing this crazy stuff like nuking the index while a NRT 
reader has it open. Its also impossible to do stuff like replication while a 
Reader is open.

Simon's system called El\*s\* should in any case create a new index in a new 
directory if it needs to recover...


was (Author: thetaphi):
Hi Mike,

the test does not work on windows with a FSDirectory subclass. This is because 
Windows does not allow to write to a file thats already open. So we must 
disable this test for Windows filesystems:

{code}
assumeFalse(Constants.WINDOWS && dir instanceof FSDirectory);
{code}

That is the error I get:

{noformat}
C:\Users\Uwe Schindler\Projects\lucene\trunk-lusolr2\lucene\core>ant test 
-Dtestcase=TestIndexWriter 
-Dtestmethod=testClosingNRTReaderDoesNotCorruptYourIndex 
-Dtests.directory=SimpleFSDirectory

   [junit4] <JUnit4> says kaixo! Master seed: 46D71A0205CD3C16
   [junit4] Your default console's encoding may not display certain unicode 
glyphs: windows-1252
   [junit4] Executing 1 suite with 1 JVM.
   [junit4] 
   [junit4] Started J0 PID(10652@VEGA).
   [junit4] Suite: org.apache.lucene.index.TestIndexWriter
   [junit4]   2> NOTE: reproduce with: ant test  -Dtestcase=TestIndexWriter 
-Dtests.method=testClosingNRTReaderDoesNotCorruptYourIndex 
-Dtests.seed=46D71A0205CD3C16 -Dtests.directory=SimpleFSDirectory 
-Dtests.locale=pt_BR -Dtests.timezone=Portugal -Dtests.file.encoding=Cp1252
   [junit4] ERROR   0.63s | 
TestIndexWriter.testClosingNRTReaderDoesNotCorruptYourIndex <<<
   [junit4]    > Throwable #1: java.io.IOException: Cannot delete C:\Users\Uwe 
Schindler\Projects\lucene\trunk-lusolr2\lucene\build\core\test\J0\index5311553115tmp\_0.doc
   [junit4]    >        at 
__randomizedtesting.SeedInfo.seed([46D71A0205CD3C16:31060EF37DD6C629]:0)
   [junit4]    >        at 
org.apache.lucene.store.FSDirectory.deleteFile(FSDirectory.java:256)
   [junit4]    >        at 
org.apache.lucene.store.MockDirectoryWrapper.deleteFile(MockDirectoryWrapper.java:456)
   [junit4]    >        at 
org.apache.lucene.store.MockDirectoryWrapper.deleteFile(MockDirectoryWrapper.java:409)
   [junit4]    >        at 
org.apache.lucene.index.TestIndexWriter.testClosingNRTReaderDoesNotCorruptYourIndex(TestIndexWriter.java:2403)
   [junit4]    >        at java.lang.Thread.run(Thread.java:724)
   [junit4]   2> NOTE: test params are: codec=Asserting, 
sim=RandomSimilarityProvider(queryNorm=true,coord=no): {a=IB LL-L3(800.0)}, 
locale=pt_BR, timezone=Portugal
   [junit4]   2> NOTE: Windows 7 6.1 amd64/Oracle Corporation 1.7.0_25 
(64-bit)/cpus=8,threads=1,free=133047752,total=156237824
   [junit4]   2> NOTE: All tests run in this JVM: [TestIndexWriter]
   [junit4] Completed in 1.11s, 1 test, 1 error <<< FAILURES!
   [junit4] 
   [junit4] 
   [junit4] Tests with failures:
   [junit4]   - 
org.apache.lucene.index.TestIndexWriter.testClosingNRTReaderDoesNotCorruptYourIndex
   [junit4] 
   [junit4] 
   [junit4] JVM J0:     0.67 ..     2.61 =     1.94s
   [junit4] Execution time total: 2.62 sec.
   [junit4] Tests summary: 1 suite, 1 test, 1 error
{noformat}


> NRT Reader close can wipe index it doesn't own
> ----------------------------------------------
>
>                 Key: LUCENE-5574
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5574
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 4.8, 5.0, 4.7.1
>            Reporter: Simon Willnauer
>            Priority: Critical
>             Fix For: 4.8, 5.0, 4.7.2
>
>         Attachments: LUCENE-5574.patch, LUCENE-5574.patch, LUCENE-5574.patch, 
> LUCENE-5574.patch
>
>
> Today NRT Readers try to clean up unused files via their IW reference when 
> they are closed. Yet, if the index writer is already closed another index 
> could have been created on the same directory which can create the same files 
> as the IW before. For the NRT Reader those files are not referenced and it 
> will simply wipe them away. If you use this in a replication scenario where 
> directories are reused this can simply wipe your index away or in combination 
> with the FSync issue LUCENE-5570 create 0-byte files. I have a test that 
> reproduces this issue



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

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

Reply via email to