Hi peter,

Thank you very much for your quick reply.

I tried the CheckIndex method. It can't work on my crashed index.
In the error message, it says the segments file in the directory is missing.
and when I use the -fix param, new segments file still can't be write.
I even try the CheckIndex without the assertion, it still can't work.


Do you know why this is happening ? Does it mean that the segment file can't
be rewrite at all?

Btw, i am using the nightly build solr.

following is the error messages:

[r...@localhost lib]# java  -cp lucene-core-2.9-dev.jar
org.apache.lucene.index.CheckIndex -fix /solr/example/data/index/

NOTE: testing will be more thorough if you run java with
'-ea:org.apache.lucene...', so assertions are enabled

Opening index @ /solr/example/data/index/

ERROR: could not read any segments file in directory
java.io.FileNotFoundException: /solr/example

/data/index/segments_cje (No such file or directory)
        at java.io.RandomAccessFile.open(Native Method)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:212)
        at
org.apache.lucene.store.FSDirectory$FSIndexInput$Descriptor.<init>(FSDirectory.java:630)
        at
org.apache.lucene.store.FSDirectory$FSIndexInput.<init>(FSDirectory.java:660)
        at
org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:566)
        at
org.apache.lucene.store.FSDirectory.openInput(FSDirectory.java:560)
        at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:224)
        at
org.apache.lucene.index.SegmentInfos$1.doBody(SegmentInfos.java:292)
        at
org.apache.lucene.index.SegmentInfos$FindSegmentsFile.run(SegmentInfos.java:688)
        at org.apache.lucene.index.SegmentInfos.read(SegmentInfos.java:289)
        at
org.apache.lucene.index.CheckIndex.checkIndex(CheckIndex.java:258)
        at org.apache.lucene.index.CheckIndex.main(CheckIndex.java:678)
WARNING: 0 documents will be lost

NOTE: will write new segments file in 5 seconds; this will remove 0 docs
from the index. THIS IS YOUR LAST CHANCE TO CTRL+C!
  5...
  4...
  3...
  2...
  1...
Writing...
Exception in thread "main" java.lang.NullPointerException
        at org.apache.lucene.index.CheckIndex.fixIndex(CheckIndex.java:556)
        at org.apache.lucene.index.CheckIndex.main(CheckIndex.java:697)


Regards

GC



On Tue, May 26, 2009 at 12:49 AM, Peter Wolanin <peter.wola...@acquia.com>wrote:

> you can use the lucene jar with solr to invoke the CheckIndex method -
> this will  possibly allow you to recover if you pass the -fix param.
>
> You may lose some docs, however, so this is only viable if you can,
> for example, query to check what's missing.
>
> The command looks like (from the root of the solr svn checkout):
>
> java -ea:org.apache.lucene -cp lib/lucene-core-2.9-dev.jar
> org.apache.lucene.index.CheckIndex [path to index directory]
>
> For example, to check the example index:
>
> java -ea:org.apache.lucene -cp lib/lucene-core-2.9-dev.jar
> org.apache.lucene.index.CheckIndex example/solr/data/index/
>
> -Peter
>
> On Mon, May 25, 2009 at 4:42 AM, Wang Guangchen <guangchen...@gmail.com>
> wrote:
> > Hi everyone,
> >
> > I have 8m docs to index, and each doc is around 50kb. The solr crashed in
> > the middle of indexing. error message said that one of the file in the
> data
> > directory is missing. I don't know why this is happened.
> >
> > So right now I have to find a way to recover the index to avoid re-index.
> Is
> > there anyone know any tools or method to recover the crashed index?
> Please
> > help.
> >
> > Thanks a lot.
> >
> > Regards
> > GC
> >
>
>
>
> --
> Peter M. Wolanin, Ph.D.
> Momentum Specialist,  Acquia. Inc.
> peter.wola...@acquia.com
>

Reply via email to