You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@nutch.apache.org by "Stefan Groschupf (JIRA)" <ji...@apache.org> on 2006/08/21 21:09:17 UTC
[jira] Commented: (NUTCH-354) MapWritable, nextEntry is not reset
when Entries are recycled
[ http://issues.apache.org/jira/browse/NUTCH-354?page=comments#action_12429496 ]
Stefan Groschupf commented on NUTCH-354:
----------------------------------------
Since this issue is already closed I can not attach the patch file, so I attach it as text within this comment.
If you need the file let me know and I send you a offlist mail.
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Index: src/test/org/apache/nutch/crawl/TestMapWritable.java
===================================================================
--- src/test/org/apache/nutch/crawl/TestMapWritable.java (revision 432325)
+++ src/test/org/apache/nutch/crawl/TestMapWritable.java (working copy)
@@ -180,6 +180,31 @@
assertEquals(before, after);
}
+ public void testRecycling() throws Exception {
+ UTF8 value = new UTF8("value");
+ UTF8 key1 = new UTF8("a");
+ UTF8 key2 = new UTF8("b");
+
+ MapWritable writable = new MapWritable();
+ writable.put(key1, value);
+ assertEquals(writable.get(key1), value);
+ assertNull(writable.get(key2));
+
+ DataOutputBuffer dob = new DataOutputBuffer();
+ writable.write(dob);
+ writable.clear();
+ writable.put(key1, value);
+ writable.put(key2, value);
+ assertEquals(writable.get(key1), value);
+ assertEquals(writable.get(key2), value);
+
+ DataInputBuffer dib = new DataInputBuffer();
+ dib.reset(dob.getData(), dob.getLength());
+ writable.readFields(dib);
+ assertEquals(writable.get(key1), value);
+ assertNull(writable.get(key2));
+ }
+
public static void main(String[] args) throws Exception {
TestMapWritable writable = new TestMapWritable();
writable.testPerformance();
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> MapWritable, nextEntry is not reset when Entries are recycled
> --------------------------------------------------------------
>
> Key: NUTCH-354
> URL: http://issues.apache.org/jira/browse/NUTCH-354
> Project: Nutch
> Issue Type: Bug
> Affects Versions: 0.8
> Reporter: Stefan Groschupf
> Priority: Blocker
> Fix For: 0.9.0, 0.8.1
>
> Attachments: resetNextEntryInMapWritableV1.patch
>
>
> MapWritables recycle entries from it internal linked-List for performance reasons. The nextEntry of a entry is not reseted in case a recyclable entry is found. This can cause wrong data in a MapWritable.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira