That is a good practice and i pointed out that since i saw lucene 7.0 in the stack trace.
Best regards ________________________________ From: Tim Whittington <t...@apache.org> Sent: Wednesday, April 13, 2022 9:15 PM To: java-user@lucene.apache.org <java-user@lucene.apache.org> Subject: Re: How to handle corrupt Lucene index To be clear, these indexes are created and read with the same Lucene version (7.3.0). Tim On Thu, 14 Apr 2022 at 12:45, Baris Kazar <baris.ka...@oracle.com> wrote: > In my experience that if you built index at version x then use index also > in version x. > I never encountered any problems this way witj Lucene. > > Can you maybe recreate lucene index on 7.3.0? > > Also how do you use database in your scenario? > Are you using jdbc like operations like in Oracle database? lucene > operations are independent of database operations. > > Best regards > ________________________________ > From: Tim Whittington <t...@whittington.nz.INVALID> > Sent: Wednesday, April 13, 2022 8:24 PM > To: java-user@lucene.apache.org <java-user@lucene.apache.org> > Subject: How to handle corrupt Lucene index > > I'm working with/on a database system that uses Lucene for full text > indexes (currently using 7.3.0). > We're encountering occasional problems that occur after unclean shutdowns > of the database , resulting in > "org.apache.lucene.index.CorruptIndexException: file mismatch" errors when > the IndexWriter is constructed. > > In all of the cases this has occurred, CheckIndex finds no issues with the > Lucene index. > > The database has write-ahead-log and recovery facilities, so making the > Lucene indexes durable wrt database operations is doable, but in this case > the IndexWriter itself is failing to initialise, so it looks like there > needs to be a lower-level validation/recovery operation before reconciling > transactions can take place. > > Can anyone provide any advice about how the database can detect and recover > from this situation? > > thanks > Tim > --- > > Relevant parts of the exception: > > org.apache.lucene.index.CorruptIndexException: file mismatch, expected > id=e673n8syolqg0phzxvw8d7czu, got=dwpa40yzwp7gf06xibrsx1pn2 > > (resource=BufferedChecksumIndexInput(MMapIndexInput(path="/databases/xxxx/luceneIndexes/SearchNameIx/_ > 8x.si"))) > at > org.apache.lucene.codecs.CodecUtil.checkIndexHeaderID(CodecUtil.java:351) > at org.apache.lucene.codecs.CodecUtil.checkIndexHeader(CodecUtil.java:256) > at > > org.apache.lucene.codecs.lucene70.Lucene70SegmentInfoFormat.read(Lucene70SegmentInfoFormat.java:95) > at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:360) > at org.apache.lucene.index.SegmentInfos.readCommit(SegmentInfos.java:290) > at > org.apache.lucene.index.IndexFileDeleter.<init>(IndexFileDeleter.java:165) > at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1121) > ------------------ 8< -------------------------- >