Return-Path: X-Original-To: apmail-lucene-dev-archive@www.apache.org Delivered-To: apmail-lucene-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 83530629B for ; Wed, 6 Jul 2011 17:33:40 +0000 (UTC) Received: (qmail 4086 invoked by uid 500); 6 Jul 2011 17:33:39 -0000 Delivered-To: apmail-lucene-dev-archive@lucene.apache.org Received: (qmail 4040 invoked by uid 500); 6 Jul 2011 17:33:38 -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 4033 invoked by uid 99); 6 Jul 2011 17:33:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jul 2011 17:33:38 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED,T_RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 06 Jul 2011 17:33:37 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 233FC4638C for ; Wed, 6 Jul 2011 17:33:17 +0000 (UTC) Date: Wed, 6 Jul 2011 17:33:17 +0000 (UTC) From: "Yonik Seeley (JIRA)" To: dev@lucene.apache.org Message-ID: <1165780261.4643.1309973597138.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <153358305.4540.1309971796920.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (LUCENE-3281) OpenBitSet should report the configured capacity/size MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/LUCENE-3281?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060711#comment-13060711 ] Yonik Seeley commented on LUCENE-3281: -------------------------------------- See LUCENE-3280, it looks like Lucene will be switching to FastBitSet for most things? OpenBitSet is meant to be expert level and not impose any additional overhead (like keeping track of the largest bit that has been set). But yeah, the new asserts do make things a little odd w.r.t. capacity()... how about the following: {code} /** Returns the current capacity in bits (1 greater than the index of the last bit) */ - public long capacity() { return bits.length << 6; } + public long capacity() { + long cap = bits.length << 6; + assert( (cap = numBits) >= 0); + return cap; + } {code} > OpenBitSet should report the configured capacity/size > ----------------------------------------------------- > > Key: LUCENE-3281 > URL: https://issues.apache.org/jira/browse/LUCENE-3281 > Project: Lucene - Java > Issue Type: Bug > Components: core/other > Affects Versions: 3.0, 3.0.1, 3.0.2, 3.0.3, 3.1, 3.2 > Reporter: Robert Ragno > Priority: Minor > Original Estimate: 2m > Remaining Estimate: 2m > > OpenBitSet rounds up the capacity() to the next multiple of 64 from what was specified. However, this is particularly damaging with the new asserts, which trigger when anything above the specified capacity is used as an index. The simple fix is to return numBits for capacity(). -- This message is automatically generated by JIRA. For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org For additional commands, e-mail: dev-help@lucene.apache.org