Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 9F507200D43 for ; Tue, 21 Nov 2017 16:03:25 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 9DDA6160BFC; Tue, 21 Nov 2017 15:03:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id BD21D160BED for ; Tue, 21 Nov 2017 16:03:24 +0100 (CET) Received: (qmail 60116 invoked by uid 500); 21 Nov 2017 15:03:23 -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 60103 invoked by uid 99); 21 Nov 2017 15:03:23 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd1-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Nov 2017 15:03:23 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd1-us-west.apache.org (ASF Mail Server at spamd1-us-west.apache.org) with ESMTP id 5FAF3C38A6 for ; Tue, 21 Nov 2017 15:03:22 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd1-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 2.079 X-Spam-Level: ** X-Spam-Status: No, score=2.079 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, KB_WAM_FROM_NAME_SINGLEWORD=0.2, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd1-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=kinetica.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd1-us-west.apache.org [10.40.0.7]) (amavisd-new, port 10024) with ESMTP id mZ5SxVneMbLK for ; Tue, 21 Nov 2017 15:03:21 +0000 (UTC) Received: from mail-wm0-f47.google.com (mail-wm0-f47.google.com [74.125.82.47]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id A15E35F566 for ; Tue, 21 Nov 2017 15:03:20 +0000 (UTC) Received: by mail-wm0-f47.google.com with SMTP id r68so4085170wmr.3 for ; Tue, 21 Nov 2017 07:03:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kinetica.com; s=google; h=mime-version:from:date:message-id:subject:to; bh=7ms5DdAxuuVl5fwJ+At8e5aCoFimHlLsniO7kQkl1FU=; b=Y6gPVo5ntC5ULiCxvl0qL+qkkbAutNrPcjdGdK/99dNcfNU264lV+S4TaaWD6ifzH2 ksYXKQ3aLoj3pTbn92RQRom+losAikDfr6YdzYj6zO32vW4WaYP7LkqEaFtJtmFQXFY1 jIKXd9PCIh0SvtXEczfjJBaidpkXxlZAWqqRJP/Q845UW8LEhoZqD3fr4M1hbt3gYXiq dampub+UFv7i0Vb/48xBHVaF1Nv6zZuNYm3pAqYC/s6pJnjtTn7EWuQnQnWM6pIAGYFH j6U0jCT5T5sCvI2cKZ/pnnxFg0t3fvssAlFo0wSHzdGKQKkc6Z9SIXScA+f1su82h9jf DsBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=7ms5DdAxuuVl5fwJ+At8e5aCoFimHlLsniO7kQkl1FU=; b=oWzj0lSNE84VuZE0bcmKK9ee8+u40+6iX0LqDvqI+rJ6bfl7ltAXxF3auUM3rSs5kx eL0ZMgYZ5zu1SMhqSV95lPAx20Wg9q4Im9ruIbbOPVOnco9h/cTWbDIxNNwf8iDKtZha ORsk/HG4KZRCrq3siYlxJr+Nq5vIL3b3KZ3x1SKguAc1V6WgufmW/6KAxDI0ZjiYRazg IFVUqoRgi2niia+/iNHruX0FbEmCKZi0iT0Dyz6xxNM7c1880o7URMp54bN3LY/etFZf neVCnQckZe2edGkLQy6/vaZH2aw+Rbg2ALqkqd46mxntLMXAJneD6eZ2gfstkr+W95CZ UfGg== X-Gm-Message-State: AJaThX4v9mneib4+yAYj7QMiy+Ik8kE1MPEoLEqmzrSLiDVeVyG4Tsmx jfyV0pcoZufF1XAgYB9f6CBr6uOo3lGiXLOYLWnUfaiwwcY= X-Google-Smtp-Source: AGs4zMbhS+njFjLHD2Y+X28Q2VOFgPwVSxWX6uV8UlG6j11kR6QmITa0gBFL6/+tMgxFtBryhWoCX4bAHc8FdQtb/1k= X-Received: by 10.28.30.212 with SMTP id e203mr665991wme.40.1511276599288; Tue, 21 Nov 2017 07:03:19 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.153.22 with HTTP; Tue, 21 Nov 2017 07:03:18 -0800 (PST) From: Shouvik Bardhan Date: Tue, 21 Nov 2017 10:03:18 -0500 Message-ID: Subject: Index file deleting.... To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary="001a114b4388dbda93055e7f808a" archived-at: Tue, 21 Nov 2017 15:03:25 -0000 --001a114b4388dbda93055e7f808a Content-Type: text/plain; charset="UTF-8" Apologies if this has been discussed and thrashed out before. I found some discussion but still not clear about several things. Based on one of Mike's answers a while back, I have ran my test program with a lucene-core jar which was built with VERBOSE_REF_COUNTS = true. This is all on Lucene 6.6.2 on Centos. I have a small test program whose structure if roughly like so try { FSDirectory dir = FSDirectory.open(Paths.get(INDEX_DIR)); IndexWriterConfig iwc = new IndexWriterConfig(new StandardAnalyzer()); TieredMergePolicy tmp = new TieredMergePolicy(); tmp.setSegmentsPerTier(10); iwc.setInfoStream(System.out); iwc.setMergePolicy(tmp); iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND); IndexWriter writer = new IndexWriter(dir, iwc); for( int madness = 0; madness < 2; madness++ ) { indexDocs(writer, new File(args[0])); SearcherManager sm = new SearcherManager(writer, new SearcherFactory()); IndexSearcher is = sm.acquire(); System.out.println(" Bad news Ref1 cnt is " + is.getIndexReader().getRefCount()); sm.release(is); deleteData(writer, true); deleteData(writer, false); //is.getIndexReader().close(); } writer.close(); } catch (IOException e) { } deleteData() is like so. Its goal is to delete half of the index with each call. So after 2 calls all the docs are deleted. MultiFieldQueryParser parser = new MultiFieldQueryParser(fields, analyzer); Query q = parser.parse(queries_str); if (q != null) { writer.deleteDocuments(q); writer.deleteUnusedFiles(); writer.forceMergeDeletes(); writer.commit(); System.out.println(" Attempted delete and committed..."); } else { System.out.println(" Delete requested but data incorrect..."); } My goal is to test disk reclaim (file deletes). I notice that when when is.getIndexReader().close() is commented out (see in the main madness loop) the files remain but when reader close is called, the files get deleted. Is that expected? I thought searchermanager acquire/release should free the files up (meaning indexreader will not hold on to file handles). Now as far as the streaminfo is concerned, what I see (pasted below) between the madness loop (when indexreader is closed) which I dont see when the indexreader is not closed (when the files remain). Also at the end of the madness loop, with reader.close() command alive, I am left with only couple of files (the behavior I want). IFD 0 [2017-11-21T03:47:08.983Z; main]: DecRef "_1.cfs": pre-decr count is 1 IFD 0 [2017-11-21T03:47:08.983Z; main]: DecRef "_0.cfe": pre-decr count is 1 IFD 0 [2017-11-21T03:47:08.984Z; main]: DecRef "_0.si": pre-decr count is 1 IFD 0 [2017-11-21T03:47:08.984Z; main]: DecRef "_1.cfe": pre-decr count is 1 IFD 0 [2017-11-21T03:47:08.984Z; main]: DecRef "_1.si": pre-decr count is 1 IFD 0 [2017-11-21T03:47:08.984Z; main]: DecRef "_0.cfs": pre-decr count is 1 IFD 0 [2017-11-21T03:47:08.984Z; main]: delete [_1.cfs, _0.cfe, _0.si, _1.cfe, _1.si, _0.cfs] IW 0 [2017-11-21T03:47:08.987Z; main]: decRefDeleter for NRT reader version=5 segments=_0(6.6.2):c95218 _1(6.6.2):c4781 Also does my program structure look ok? Specifically a) Do I need to create the SearcherManager every time like I have done or can I pull it out of the madness loop? b) Should I be calling the deleteUnusedFiles() and forceMergeDeletes() or are those redundant calls? Thanks for any insight. --001a114b4388dbda93055e7f808a--