You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by bu...@apache.org on 2004/07/21 20:30:20 UTC
DO NOT REPLY [Bug 30240] New: -
FieldCacheImpl cache gets rebuilt every time
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30240>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30240
FieldCacheImpl cache gets rebuilt every time
Summary: FieldCacheImpl cache gets rebuilt every time
Product: Lucene
Version: 1.4
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: Other
Component: Search
AssignedTo: lucene-dev@jakarta.apache.org
ReportedBy: amordo@infosciences.com
FieldCacheImpl uses WeakHashMap to store the cached objects, but since
there is no other reference to this cache it is getting released every time.
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: new Lucene release: 1.4.1
Posted by Doug Cutting <cu...@apache.org>.
Erik Hatcher wrote:
> Did you release this officially through the mirror instructions? We
> need to be sure to do this for all releases.
No, I have not done this.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: new Lucene release: 1.4.1
Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Doug,
Did you release this officially through the mirror instructions? We
need to be sure to do this for all releases.
Erik
On Aug 2, 2004, at 5:14 PM, Doug Cutting wrote:
> I just made a new Lucene release, 1.4.1, which contains a few patches
> to 1.4-final, notably for bug 30240:
>
> http://issues.apache.org/bugzilla/show_bug.cgi?id=30240
>
> This caused the new Sort feature to perform very badly.
>
> Doug
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
new Lucene release: 1.4.1
Posted by Doug Cutting <cu...@apache.org>.
I just made a new Lucene release, 1.4.1, which contains a few patches to
1.4-final, notably for bug 30240:
http://issues.apache.org/bugzilla/show_bug.cgi?id=30240
This caused the new Sort feature to perform very badly.
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
RE: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every time
Posted by Aviran <am...@infosciences.com>.
I believe so. This is a pretty significant bug.
Aviran
-----Original Message-----
From: Doug Cutting [mailto:cutting@apache.org]
Sent: Wednesday, July 21, 2004 15:33 PM
To: Lucene Developers List
Subject: Re: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every
time
I wonder if we ought to make a 1.4.1 release for this. Thoughts?
Doug
Aviran wrote:
> Works like a charm (-:
>
> -----Original Message-----
> From: Doug Cutting [mailto:cutting@apache.org]
> Sent: Wednesday, July 21, 2004 15:10 PM
> To: Lucene Developers List
> Subject: Re: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every
> time
>
>
> Aviran wrote:
>
>> Entry (IndexReader reader, String field, int type) {
>>- this.reader = reader;
>
>
> The IndexReader also needed to be removed from the constructor
> parameters, and a few other places. Doing this revealed that
> FieldSortedHitQueue.java also needed to be fixed. Check out the diff
> posted by CVS.
>
> Anyway, this should now work. Can you please benchmark the code that
> I
> just checked in to make sure it resolves the issue?
>
> Thanks,
>
> Doug
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every
time
Posted by Doug Cutting <cu...@apache.org>.
I wonder if we ought to make a 1.4.1 release for this. Thoughts?
Doug
Aviran wrote:
> Works like a charm (-:
>
> -----Original Message-----
> From: Doug Cutting [mailto:cutting@apache.org]
> Sent: Wednesday, July 21, 2004 15:10 PM
> To: Lucene Developers List
> Subject: Re: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every
> time
>
>
> Aviran wrote:
>
>> Entry (IndexReader reader, String field, int type) {
>>- this.reader = reader;
>
>
> The IndexReader also needed to be removed from the constructor
> parameters, and a few other places. Doing this revealed that
> FieldSortedHitQueue.java also needed to be fixed. Check out the diff
> posted by CVS.
>
> Anyway, this should now work. Can you please benchmark the code that I
> just checked in to make sure it resolves the issue?
>
> Thanks,
>
> Doug
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
RE: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every time
Posted by Aviran <am...@infosciences.com>.
Works like a charm (-:
-----Original Message-----
From: Doug Cutting [mailto:cutting@apache.org]
Sent: Wednesday, July 21, 2004 15:10 PM
To: Lucene Developers List
Subject: Re: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every
time
Aviran wrote:
> Entry (IndexReader reader, String field, int type) {
> - this.reader = reader;
The IndexReader also needed to be removed from the constructor
parameters, and a few other places. Doing this revealed that
FieldSortedHitQueue.java also needed to be fixed. Check out the diff
posted by CVS.
Anyway, this should now work. Can you please benchmark the code that I
just checked in to make sure it resolves the issue?
Thanks,
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
Re: [PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every
time
Posted by Doug Cutting <cu...@apache.org>.
Aviran wrote:
> Entry (IndexReader reader, String field, int type) {
> - this.reader = reader;
The IndexReader also needed to be removed from the constructor
parameters, and a few other places. Doing this revealed that
FieldSortedHitQueue.java also needed to be fixed. Check out the diff
posted by CVS.
Anyway, this should now work. Can you please benchmark the code that I
just checked in to make sure it resolves the issue?
Thanks,
Doug
---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-dev-help@jakarta.apache.org
[PATCH] [Bug 30240] - FieldCacheImpl cache gets rebuilt every time
Posted by Aviran <am...@infosciences.com>.
Index: FieldCacheImpl.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/FieldCacheI
mpl.java,v
retrieving revision 1.2
diff -u -r1.2 FieldCacheImpl.java
--- FieldCacheImpl.java 24 May 2004 22:51:42 -0000 1.2
+++ FieldCacheImpl.java 21 Jul 2004 18:25:02 -0000
@@ -24,6 +24,7 @@
import java.io.IOException;
import java.util.Map;
import java.util.WeakHashMap;
+import java.util.HashMap;
/**
* Expert: The default cache implementation, storing all values in memory.
@@ -40,7 +41,6 @@
/** Expert: Every key in the internal cache is of this type. */
static class Entry {
- final IndexReader reader; // which Reader
final String field; // which Field
final int type; // which SortField type
final Object custom; // which custom comparator
@@ -48,7 +48,6 @@
/** Creates one of these objects. */
Entry (IndexReader reader, String field, int type) {
- this.reader = reader;
this.field = field.intern();
this.type = type;
this.custom = null;
@@ -57,7 +56,6 @@
/** Creates one of these objects for a custom comparator. */
Entry (IndexReader reader, String field, Object custom) {
- this.reader = reader;
this.field = field.intern();
this.type = SortField.CUSTOM;
this.custom = custom;
@@ -68,7 +66,7 @@
public boolean equals (Object o) {
if (o instanceof Entry) {
Entry other = (Entry) o;
- if (other.reader == reader && other.field == field && other.type ==
type) {
+ if (other.field == field && other.type == type) {
if (other.custom == null) {
if (custom == null) return true;
} else if (other.custom.equals (custom)) {
@@ -93,7 +91,9 @@
Object lookup (IndexReader reader, String field, int type) {
Entry entry = new Entry (reader, field, type);
synchronized (this) {
- return cache.get (entry);
+ HashMap readerCache = (HashMap)cache.get(reader);
+ if (readerCache == null) return null;
+ return readerCache.get (entry);
}
}
@@ -101,7 +101,9 @@
Object lookup (IndexReader reader, String field, Object comparer) {
Entry entry = new Entry (reader, field, comparer);
synchronized (this) {
- return cache.get (entry);
+ HashMap readerCache = (HashMap)cache.get(reader);
+ if (readerCache == null) return null;
+ return readerCache.get (entry);
}
}
@@ -109,7 +111,12 @@
Object store (IndexReader reader, String field, int type, Object value) {
Entry entry = new Entry (reader, field, type);
synchronized (this) {
- return cache.put (entry, value);
+ HashMap readerCache = (HashMap)cache.get(reader);
+ if (readerCache == null) {
+ readerCache = new HashMap();
+ cache.put(reader,readerCache);
+ }
+ return readerCache.put (entry, value);
}
}
@@ -117,7 +124,12 @@
Object store (IndexReader reader, String field, Object comparer, Object
value) {
Entry entry = new Entry (reader, field, comparer);
synchronized (this) {
- return cache.put (entry, value);
+ HashMap readerCache = (HashMap)cache.get(reader);
+ if (readerCache == null) {
+ readerCache = new HashMap();
+ cache.put(reader, readerCache);
+ }
+ return readerCache.put (entry, value);
}
}
http://issues.apache.org/bugzilla/show_bug.cgi?id=30240