Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C283A9F27 for ; Wed, 6 Jun 2012 11:38:14 +0000 (UTC) Received: (qmail 59048 invoked by uid 500); 6 Jun 2012 11:38:09 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 58841 invoked by uid 500); 6 Jun 2012 11:38:09 -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 57892 invoked by uid 99); 6 Jun 2012 11:38:08 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 11:38:08 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=FSL_RCVD_USER,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [74.125.82.42] (HELO mail-wg0-f42.google.com) (74.125.82.42) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jun 2012 11:38:02 +0000 Received: by wgbds11 with SMTP id ds11so4110500wgb.5 for ; Wed, 06 Jun 2012 04:37:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type:content-transfer-encoding:x-gm-message-state; bh=fZShG2yLQO5s59zQ4yd+4tHDhtAy5SJ9ec7lStOWvWs=; b=KyiRWuVRAM37TXkcUgTiN5GtwQGs8c1QZtFBPMVAbJo2SpYVj862MTEVIeBkcBRB1c Zqr9CZYo32ZfhxPClDGwK5CeRr4lbirmvWm8UMs+YWQVVKDeJZZz390fktq3bwgkDknz 2V+/1bOLe8mjt1CQcOvj57ae9I9LsJQ72XtWJnT+aEiSuNdtGgOKjKtl9QcCTu9Dnwz4 zJSgHd3Qof1uw/rJZ+m4HN79n97ZQT1RdDj5BtNYlKbqGe4xfUH4hocZy0nE62rN5ISw Euh+KS5VpeOH9byzUYxKI4ilHR3yCg2TZZLp7aKdkDohs1tf6U3STlppjH8khJsyBt3U DrSA== Received: by 10.216.226.218 with SMTP id b68mr17026402weq.167.1338982662038; Wed, 06 Jun 2012 04:37:42 -0700 (PDT) MIME-Version: 1.0 Received: by 10.216.39.9 with HTTP; Wed, 6 Jun 2012 04:37:21 -0700 (PDT) In-Reply-To: References: From: Michael McCandless Date: Wed, 6 Jun 2012 07:37:21 -0400 Message-ID: Subject: Re: IndexCommit.delete() outside of IndexDeletionPolicy To: java-user@lucene.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnbKgmBYLpItg6eBrZ7jZbU/wj0yWI/zg2IIKk0vRkt8waxm5G7FXqs653jpR2+9kC4RM7X I think this use case makes sense; such logic (for a distributed / ref counted deletion policy) would make a nice contribution ... it's the "proper" way to delete commits when multiple nodes are in use (vs eg using a timeout deletion policy). You can actually do it today: call IndexWriter.deleteUnusedFiles. That visits the deletion policy and then you have a chance to delete commit points (it'd mean you have to set a real deletion policy on the writer, which in turn goes and checks the reference counts across all nodes). Mike McCandless http://blog.mikemccandless.com On Wed, Jun 6, 2012 at 7:16 AM, Colin Goodheart-Smithe wrote: > I was looking at the Lucene API for IndexCommit and noticed that the > JavaDoc states that > > *'Decision that a commit-point should be deleted is taken by the > IndexDeletionPolicy > in > effect and therefore this should only be called by its > onInit() > =A0or onCommit() > =A0methods.'* > ( > http://lucene.apache.org/core/3_6_0/api/all/org/apache/lucene/index/Index= Commit.html#delete() > =A0) > > I was wondering why this is the case and whether deleting IndexCommits > outside of a IndexDeletionPolicy is actually a bad idea? > > To put some context around this I am looking to implement a deletion poli= cy > which is independant of the IndexWriter commit and more dependant on > Processes using particular Commit points being finished with it. > The logic would look something like the following and state would be stor= ed > in something like ZooKeeper so I can have use of ephremal nodes and watch= er > events: > > =A0 - IndexWriters would have a NoDeletionPolicy set > =A0 - Each time a process opens a session it registers an ephremal node > =A0 - The session is assigned the current (latest) commit point > =A0 - Each time a process removes the node (either through crashing or > =A0 having finished the job) a watch event is fired where a separate proc= ess > =A0 will delete the commit point the process was using if no other proces= ses > =A0 are using the commit point and if it is not the latest commit point > > Processes may have fairly long running sessions so across all the process= es > a reasonable number of commit points might be in use. =A0I don't really w= ant > to have to wait for a commit from the IndexWriter (which may not happen f= or > a while) to clear up the older commit points I no longer need. =A0Would t= his > logic pose any issues given that it is going to be deleting Commit points > outside of the IndexDeletionPolicy --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org