Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 57335 invoked from network); 3 Feb 2005 17:09:13 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 3 Feb 2005 17:09:13 -0000 Received: (qmail 70567 invoked by uid 500); 3 Feb 2005 17:09:07 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 70539 invoked by uid 500); 3 Feb 2005 17:09:07 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 70525 invoked by uid 99); 3 Feb 2005 17:09:07 -0000 X-ASF-Spam-Status: No, hits=0.1 required=10.0 tests=FORGED_RCVD_HELO X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from 87.52.220-216.q9.net (HELO mail.futurebrandexp.com) (216.220.52.87) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 03 Feb 2005 09:09:05 -0800 Received: from p001002 ([204.225.84.27]) by mail.futurebrandexp.com with Microsoft SMTPSVC(5.0.2195.5329); Thu, 3 Feb 2005 12:13:31 -0500 Message-ID: <00fc01c50a13$af7f0240$7703d00a@hypermedia.com> From: "Luke Shannon" To: "Lucene Users List" References: <4202590F.8080209@polopoly.com> Subject: Re: Lock failure recovery Date: Thu, 3 Feb 2005 12:13:31 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-OriginalArrivalTime: 03 Feb 2005 17:13:31.0595 (UTC) FILETIME=[AF8EB9B0:01C50A13] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N The indexing process is totally synchronized in our system. Thus if an Indexing thread starts up and the index exists, but is locked, I know this to be the only indexing processing running so the lock must be from a process that got stopped before it could finish. So right before I begin writing to the index I have this check: //if we have gotten to here that this is the only index running. //the index should not be locked. if it is, the lock is "stale" //and must be released before we can continue try { if (index.exists() && IndexReader.isLocked(indexFileLocation)) { Trace.ERROR("INDEX INFO: Had to clear a stale index lock"); IndexReader.unlock(FSDirectory.getDirectory(index, false)); } } catch (IOException e3) { Trace.ERROR("INDEX ERROR: Was unable to clear a stale index lock: " + e3); } Luke ----- Original Message ----- From: "Claes Holmerson" To: "Lucene Users List" Sent: Thursday, February 03, 2005 12:02 PM Subject: Lock failure recovery > Hello > > A commit.lock can get left by a process that dies in the middle of > reading the index, for example because of an OutOfMemoryError. How can I > handle such a left lock gracefully the next time the process runs? > Checking if there is a lock is straight forward - but how can I be sure > that it is not just a current lock created by another thread? The only > methods I find to deal with the lock is IndexReader.isLocked() and > IndexReader.unlock(). I would like to know the lock age - if it is older > than a certain age then I can remove it. How do other people deal with > left over locks? > > Claes > -- > > Claes Holmerson > Polopoly - Cultivating the information garden > Kungsgatan 88, SE-112 27 Stockholm, SWEDEN > Direct: +46 8 506 782 59 > Mobile: +46 704 47 82 59 > Fax: +46 8 506 782 51 > claes.holmerson@polopoly.com, http://www.polopoly.com > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org > For additional commands, e-mail: lucene-user-help@jakarta.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org