Return-Path: Delivered-To: apmail-jackrabbit-dev-archive@www.apache.org Received: (qmail 3180 invoked from network); 27 Nov 2007 10:40:09 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 27 Nov 2007 10:40:09 -0000 Received: (qmail 6936 invoked by uid 500); 27 Nov 2007 10:39:56 -0000 Delivered-To: apmail-jackrabbit-dev-archive@jackrabbit.apache.org Received: (qmail 6895 invoked by uid 500); 27 Nov 2007 10:39:56 -0000 Mailing-List: contact dev-help@jackrabbit.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@jackrabbit.apache.org Delivered-To: mailing list dev@jackrabbit.apache.org Received: (qmail 6508 invoked by uid 99); 27 Nov 2007 10:39:54 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Nov 2007 02:39:54 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO brutus.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 27 Nov 2007 10:40:04 +0000 Received: from brutus (localhost [127.0.0.1]) by brutus.apache.org (Postfix) with ESMTP id 0C15C7141FD for ; Tue, 27 Nov 2007 02:39:43 -0800 (PST) Message-ID: <15299206.1196159983040.JavaMail.jira@brutus> Date: Tue, 27 Nov 2007 02:39:43 -0800 (PST) From: "Marcel Reutegger (JIRA)" To: dev@jackrabbit.apache.org Subject: [jira] Commented: (JCR-1213) UUIDDocId cache does not work properly because of weakReferences in combination with new instance for combined indexreader In-Reply-To: <4587580.1194865070552.JavaMail.jira@brutus> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org [ https://issues.apache.org/jira/browse/JCR-1213?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12545786 ] Marcel Reutegger commented on JCR-1213: --------------------------------------- Ard, thank you very much for the patch. I'm about to create a performance test, which basically does the following: - create lots of nodes ;) - run queries that use DescendantSelfAxisQuery and/or ChildAxisQuery - at the same time randomly modify content I reviewed you patch and I also don't like the dependency to SingleTermDocs in UUIDDocId. I've created a patch as well, but took a somewhat different approach. Instead of using a weak reference to the index reader, I used the creation tick in the CachingIndexReader. The creation tick uniquely identifies an index segment as well as the version of the segment. E.g. if a document is added a new CachingIndexReader is created for that segment with a new creation tick. The same will probably also work for the DocNumberCache, which currently uses strong references. I'd like to change that as well, but that's a bit off topic and and different issue. I will run the above test with 1) the current code base, 2) your patch and 3) my patch. I'll let you know about the results.... > UUIDDocId cache does not work properly because of weakReferences in combination with new instance for combined indexreader > --------------------------------------------------------------------------------------------------------------------------- > > Key: JCR-1213 > URL: https://issues.apache.org/jira/browse/JCR-1213 > Project: Jackrabbit > Issue Type: Improvement > Components: query > Affects Versions: 1.3.3 > Reporter: Ard Schrijvers > Fix For: 1.4 > > Attachments: JCR-1213-mreutegg.patch, JCR-1213.patch > > > Queries that use ChildAxisQuery or DescendantSelfAxisQuery make use of getParent() functions to know wether the parents are correct and if the result is allowed. The getParent() is called recursively for every hit, and can become very expensive. Hence, in DocId.UUIDDocId, the parents are cached. > Currently, docId.UUIDDocId's are cached by having a WeakRefence to the CombinedIndexReader, but, this CombinedIndexReader is recreated all the time, implying that a gc() is allowed to remove the 'expensive' cache. > A much better solution is to not have a weakReference to the CombinedIndexReader, but to a reference of each indexreader segment. This means, that in getParent(int n) in SearchIndex the return > return id.getDocumentNumber(this) needs to be replaced by return id.getDocumentNumber(subReaders[i]); and something similar in CachingMultiReader. > That is all. Obviously, when a node/property is added/removed/changed, some parts of the cached DocId.UUIDDocId will be invalid, but mainly small indexes are updated frequently, which obviously are less expensive to recompute. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.