Return-Path: Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: (qmail 42316 invoked from network); 19 Apr 2010 09:15:17 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Apr 2010 09:15:17 -0000 Received: (qmail 75016 invoked by uid 500); 19 Apr 2010 09:15:16 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 74855 invoked by uid 500); 19 Apr 2010 09:15:15 -0000 Mailing-List: contact dev-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list dev@lucene.apache.org Received: (qmail 74848 invoked by uid 500); 19 Apr 2010 09:15:14 -0000 Delivered-To: apmail-lucene-java-dev@lucene.apache.org Received: (qmail 74845 invoked by uid 99); 19 Apr 2010 09:15:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Apr 2010 09:15:14 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 19 Apr 2010 09:15:11 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o3J9EnRO010457 for ; Mon, 19 Apr 2010 05:14:50 -0400 (EDT) Message-ID: <9851532.7541271668489871.JavaMail.jira@thor> Date: Mon, 19 Apr 2010 05:14:49 -0400 (EDT) From: "Earwin Burrfoot (JIRA)" To: java-dev@lucene.apache.org Subject: [jira] Commented: (LUCENE-2402) Add an explicit method to invoke IndexDeletionPolicy In-Reply-To: <1966956.5141271658349260.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/LUCENE-2402?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858426#action_12858426 ] Earwin Burrfoot commented on LUCENE-2402: ----------------------------------------- Lets reuse IW.deleteUnusedFiles() ? No need to multiply confusion ) > Add an explicit method to invoke IndexDeletionPolicy > ---------------------------------------------------- > > Key: LUCENE-2402 > URL: https://issues.apache.org/jira/browse/LUCENE-2402 > Project: Lucene - Java > Issue Type: Improvement > Components: Index > Reporter: Shai Erera > Assignee: Shai Erera > Fix For: 3.1 > > > Today, if one uses an IDP which holds onto segments, such as SnapshotDeletionPolicy, or any other IDP in the tests, those segments are left in the index even if the IDP no longer references them, until IW.commit() is called (and actually does something). I'd like to add a specific method to IW which will invoke the IDP's logic and get rid of the unused segments w/o forcing the user to call IW.commit(). There are a couple of reasons for that: > * Segments take up sometimes valuable HD space, and the application may wish to reclaim that space immediately. In some scenarios, the index is updated once in several hours (or even days), and waiting until then may not be acceptable. > * I think it's a cleaner solution than waiting for the next commit() to happen. One can still wait for it if one wants, but otherwise it will give you the ability to immediately get rid of those segments. > * TestSnapshotDeletionPolicy includes this code, which only strengthens (IMO) the need for such method: > {code} > // Add one more document to force writer to commit a > // final segment, so deletion policy has a chance to > // delete again: > Document doc = new Document(); > doc.add(new Field("content", "aaa", Field.Store.YES, Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS_OFFSETS)); > writer.addDocument(doc); > {code} > If IW had an explicit method, that code would not need to exist there at all ... > Here comes the fun part - naming the baby: > * invokeDeletionPolicy -- describes exactly what is going to happen. However, if the user did not set IDP at all (relying on default, which I think many do), users won't understand what is it. > * deleteUnusedSegments - more user-friendly, assuming users understand what 'segments' are. > BTW, IW already has deleteUnusedFiles() which only tries to delete unreferenced files that failed to delete before (such as on Windows, due to e.g. open readers). Perhaps instead of inventing a new name, we can change IW.deleteUnusedFiles to call IndexFileDeleter.checkpoint (instead of deletePendingFiles) which deletes those files + calls IDP.onCommit(). -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online. --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org