Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 379 invoked from network); 10 Sep 2009 14:54:01 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 10 Sep 2009 14:54:01 -0000 Received: (qmail 28745 invoked by uid 500); 10 Sep 2009 14:53:59 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 28677 invoked by uid 500); 10 Sep 2009 14:53:59 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 28667 invoked by uid 99); 10 Sep 2009 14:53:59 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 14:53:59 +0000 X-ASF-Spam-Status: No, hits=-1.0 required=10.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nickb@mailtrust.com designates 207.97.245.151 as permitted sender) Received: from [207.97.245.151] (HELO smtp151.iad.emailsrvr.com) (207.97.245.151) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Sep 2009 14:53:51 +0000 Received: from relay15.relay.iad.mlsrvr.com (localhost [127.0.0.1]) by relay15.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 615361B4241 for ; Thu, 10 Sep 2009 10:53:30 -0400 (EDT) Received: from dynamic4.wm-web.iad.mlsrvr.com (dynamic4.wm-web.iad.mlsrvr.com [192.168.2.153]) by relay15.relay.iad.mlsrvr.com (SMTP Server) with ESMTP id 5AD641B4066 for ; Thu, 10 Sep 2009 10:53:30 -0400 (EDT) Received: from mailtrust.com (localhost [127.0.0.1]) by dynamic4.wm-web.iad.mlsrvr.com (Postfix) with ESMTP id 45BE01D4806E for ; Thu, 10 Sep 2009 10:53:30 -0400 (EDT) Received: by apps.rackspace.com (Authenticated sender: nickb@mailtrust.com, from: nicholas.bailey@rackspace.com) with HTTP; Thu, 10 Sep 2009 10:53:30 -0400 (EDT) Date: Thu, 10 Sep 2009 10:53:30 -0400 (EDT) Subject: Re: IndexReader.isCurrent for cached indexes From: "Nick Bailey" To: java-user@lucene.apache.org MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 Content-Transfer-Encoding: quoted-printable Importance: Normal X-Priority: 3 (Normal) X-Type: plain In-Reply-To: <8c4e68610909100205l36f15a66t7471c545d3e845d3@mail.gmail.com> References: <1252532004.497624575@192.168.1.71> <8c4e68610909100205l36f15a66t7471c545d3e845d3@mail.gmail.com> Message-ID: <1252594410.28411442@192.168.1.71> X-Mailer: webmail7.0b X-Virus-Checked: Checked by ClamAV on apache.org Our commit code will close the IndexWriter after adding the documents and b= efore we see the log message indicating the documents have been added and d= eleted, so I don't believe that is the problem.=0A=0AThanks for the tip abo= ut reopen. I actually noticed that when researching this problem but didn'= t think it was related.=0A=0AWe are running 2.4.1=0A=0A=0A-----Original Mes= sage-----=0AFrom: "Ian Lea" =0ASent: Thursday, September= 10, 2009 5:05am=0ATo: java-user@lucene.apache.org=0ASubject: Re: IndexRead= er.isCurrent for cached indexes=0A=0AisCurrent() will only return true if t= here have been committed changes=0Ato the index. Maybe for some reason you= r index update job hasn't=0Acommitted or closed the index.=0A=0AProbably no= t relevant to this problem, but your reopen code snippet=0Adoesn't close th= e old reader. It should. See the javadocs.=0A=0AWhat version of lucene ar= e you running?=0A=0A=0A=0A--=0AIan.=0A=0A=0AOn Wed, Sep 9, 2009 at 10:33 PM= , Nick Bailey=0A wrote:=0A> Looking for some= help figuring out a problem with the IndexReader.isCurrent() method and ca= ched indexes.=0A>=0A> We have a number of lucene indexes that we attempt to= keep in memory after an initial query is performed. =C2=A0In order to prev= ent the indexes from becoming stale, we check for changes about every minut= e by calling isCurrent(). =C2=A0If the index has changed, we will then reop= en it.=0A>=0A> From our logs it appears that in some cases isCurrent() will= return true even though the index has changed since the last time the read= er was opened.=0A>=0A> The code to refresh the index is basically this:=0A>= =0A> // Checked every minute=0A> if(!reader.isCurrent()){=0A> =C2=A0=C2=A0/= / reopen the existing reader=0A> =C2=A0=C2=A0reader =3D this.searcher.getIn= dexReader();=0A> =C2=A0=C2=A0reader =3D reader.reopen();=0A> }=0A>=0A> This= is an example of the problem from the logs:=0A>=0A> 2009-08-29 17:50:51,38= 7 Indexed 0 documents and deleted 1 documents from index 'example' in 0 ms= =0A> 2009-08-30 03:11:58,410 Indexed 0 documents and deleted 5 documents fr= om index 'example' in 0 ms=0A> 2009-08-30 16:30:03,466 Using cached reader = =0A> // numbers indicate millisecond= s since opened or refreshed aka age =3D 24.6hrs, lastRefresh =3D 22.6hrs=0A= >=0A> The logs indicate we deleted documents from the index at about 5:50 o= n August 29th, and then again on the 30th at 3:11. =C2=A0Then at 4:30 on we= attempted to query the index. =C2=A0We found the cached reader and used it= , however, the last time the cache was refreshed was about 22 hours previou= sly, coinciding with the first delete. =C2=A0The index should have been reo= pened after the second delete.=0A>=0A> I have checked, and the code to refr= esh the indexes is definitely being run every 60 seconds. =C2=A0All I can s= ee is that the problem might be with the isCurrent() method.=0A>=0A> Could = it be due to holding the reader open for so long? Any other ideas?=0A>=0A> = Thanks a lot,=0A> Nick Bailey=0A>=0A>=0A>=0A> -----------------------------= ----------------------------------------=0A> To unsubscribe, e-mail: java-u= ser-unsubscribe@lucene.apache.org=0A> For additional commands, e-mail: java= -user-help@lucene.apache.org=0A>=0A>=0A=0A---------------------------------= ------------------------------------=0ATo unsubscribe, e-mail: java-user-un= subscribe@lucene.apache.org=0AFor additional commands, e-mail: java-user-he= lp@lucene.apache.org=0A=0A --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org