lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: re-mapping lucene index
Date Tue, 10 Feb 2015 21:39:10 GMT
Hi,

In Linux/Solaris/BSD/... operating systems you can delete files while they are open (or mmapped,
does not matter). The inode/file on disk stays alive until everything is closed ("delete on
last close" semantics), it just disappears from the directory listing, so you cannot open
new handles to the file. This means: If there are still index readers open, deleting the underlying
directory and/or its files has no effect on the IndexReader - you can still search it (until
you close it).

But in any case, don't do this! Just let IndexWriter clean up by explicitely creating a new
index.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Vijay B [mailto:vijay.nipuna@gmail.com]
> Sent: Tuesday, February 10, 2015 8:38 PM
> To: java-user@lucene.apache.org
> Subject: Re: re-mapping lucene index
> 
> Appreciate it Mike. That answeres it all.
> 
> BTW we use solaris.
> 
> On Tue, Feb 10, 2015 at 2:29 PM, Michael McCandless <
> lucene@mikemccandless.com> wrote:
> 
> > It's fine if writer and reader are in separate JVMs.
> >
> > You really should not "rm -rf" yourself.
> >
> > It's better to let Lucene's do it, e.g. it's transactional at that
> > point so that if your new IndexWriter (that deleted all docs) crashes
> > before it could commit, the old index is still intact.  It also
> > ensures file names won't be reused, which is important on windows if
> > you still have readers open on the index.
> >
> > Regardless of which approach you use, the old mappings will remain
> > "alive" until you've closed all open readers agains the old index.
> >
> > Mike McCandless
> >
> > http://blog.mikemccandless.com
> >
> >
> > On Tue, Feb 10, 2015 at 2:09 PM, Vijay B <vijay.nipuna@gmail.com> wrote:
> > > searching and indexing apps run in diffrent jvms. we use lucene 4.7
> > > and using the default openmode.
> > >
> > > For full indexing, we use java.io.File.delete() to recursively
> > > delete
> > index
> > > directory contents. will remapping cause any issues in this case if
> > > I
> > dont
> > > use options you suggested?
> > >
> > > On Tue, Feb 10, 2015 at 1:56 PM, Michael McCandless <
> > > lucene@mikemccandless.com> wrote:
> > >
> > >> Just open a new IndexWriter with OpenMode.CREATE.  It will replace
> > >> the index.
> > >>
> > >> Or if you already have an IW open, use deleteAll.
> > >>
> > >> Mike McCandless
> > >>
> > >> http://blog.mikemccandless.com
> > >>
> > >>
> > >> On Tue, Feb 10, 2015 at 1:31 PM, Vijay B <vijay.nipuna@gmail.com>
> > wrote:
> > >> > We use MMapdirectory impl. in our search application.
> > >> > Occasionally we
> > >> need
> > >> > to do a full indexing by dropping entire directory contents. How
> > >> > does re-mapping work with MMapDirectory as the directory contents
> > >> > are
> > going to
> > >> > replace with new ones? is this going to be seamless or an
> > >> > application restart required?
> > >> >
> > >> > Additonal Info: We use SearcherManger to acquire searchers and we
> > >> > do periodically refresh serachers.
> > >>
> > >> -------------------------------------------------------------------
> > >> -- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > >> For additional commands, e-mail: java-user-help@lucene.apache.org
> > >>
> > >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-user-help@lucene.apache.org
> >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message