On Mon, Nov 28, 2011 at 10:49 AM, Roberto Iannone
<iann...@crmpa.unisa.it> wrote:
> Hi Michael,
>
> thx for your help :)

You're welcome!

> 2011/11/28 Michael McCandless <luc...@mikemccandless.com>
>
>> Which version of Solr/Lucene were you using when you hit power loss?
>>
> I'm using Lucene 3.4.

Hmm, which OS/filesystem?  Unexpected power loss (nor OS crash, JVM
crash) in 3.4.0 should not cause corrumption, as long as the IO system
properly implements fsync.

>> There was a known bug that could allow power loss to cause corruption,
>> but this was fixed in Lucene 3.4.0.
>>
>> Unfortunately, there is no easy way to recreate the segments_N file...
>> in principle it should be possible and maybe not too much work but
>> nobody has created such a tool yet, that I know of.
>
> some hints about how could I write this code by myself ?

Well, you'd need to take a listing of all files, aggregate those into
unique segment names, open a SegmentReader on each segment name, and
from that SegmentReader reconstruct what you can (numDocs, delCount,
isCompoundFile, etc.) about each SegmentInfo.  Add all the resulting
SegmentInfo instances into a new SegmentInfos and write it to the
directory.

Was the index newly created in 3.4.x?  If not (if you inherited
segments from earlier Lucene versions) you might also have to
reconstruct shared doc stores (stored fields, term vectors) files,
which will be trickier...

Mike

Reply via email to