From 4cc6e6551fef3a3b31313453a27ea45f1b5b51cf Mon Sep 17 00:00:00 2001 From: orbiter Date: Mon, 26 Jun 2006 09:52:23 +0000 Subject: [PATCH] bugfix git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2245 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/PerformanceMemory_p.html | 2 -- source/de/anomic/kelondro/kelondroRecords.java | 11 +++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/htroot/PerformanceMemory_p.html b/htroot/PerformanceMemory_p.html index 115eaeeb4..3ce205726 100644 --- a/htroot/PerformanceMemory_p.html +++ b/htroot/PerformanceMemory_p.html @@ -338,7 +338,6 @@ Increasing this cache may speed up crawling, but not much space is needed, so th #[usedTotal]# MB #[currTotal]# MB #[dfltTotal]# MB -#[goodTotal]# MB #[bestTotal]# MB Sum of memory amounts @@ -347,7 +346,6 @@ Increasing this cache may speed up crawling, but not much space is needed, so th Re-Configuration:
these
custom
values
 
all
default
values
  -
all
recom-
mended values
 
all
optimum
values
  Changes take effect after re-start of YaCy diff --git a/source/de/anomic/kelondro/kelondroRecords.java b/source/de/anomic/kelondro/kelondroRecords.java index 1c1a4c7ad..a019618a4 100644 --- a/source/de/anomic/kelondro/kelondroRecords.java +++ b/source/de/anomic/kelondro/kelondroRecords.java @@ -550,8 +550,6 @@ public class kelondroRecords { this.tailChunk = new byte[tailchunksize]; for (int i = 0; i < headchunksize; i++) this.headChunk[i] = 0; for (int i = 0; i < tailchunksize; i++) this.tailChunk[i] = 0; - this.headChanged = true; - this.tailChanged = true; } private Node(Handle handle) throws IOException { @@ -608,7 +606,6 @@ public class kelondroRecords { //System.out.println("**NO CACHE for " + this.handle.index + "**"); this.headChunk = new byte[headchunksize]; entryFile.readFully(seekpos(this.handle), this.headChunk, 0, this.headChunk.length); - this.headChanged = false; } else synchronized(cacheHeaders) { byte[] cacheEntry = null; int cp = CP_HIGH; @@ -621,7 +618,7 @@ public class kelondroRecords { //this.tailChunk = new byte[tailchunksize]; entryFile.readFully(seekpos(this.handle), this.headChunk, 0, this.headChunk.length); - this.headChanged = true; // provoke a cache store + // calculate cache priority cp = CP_HIGH; if (OHHANDLEC == 3) { Handle l = getOHHandle(1); @@ -629,6 +626,7 @@ public class kelondroRecords { if ((l == null) && (r == null)) cp = CP_LOW; else if ((l == null) || (r == null)) cp = CP_MEDIUM; } + // if space left in cache, copy these value to the cache update2Cache(cp); } else { @@ -641,7 +639,6 @@ public class kelondroRecords { //this.headChunk = new byte[headchunksize]; //System.arraycopy(cacheEntry, 0, this.headChunk, 0, headchunksize); this.headChunk = cacheEntry; - this.headChanged = false; } } } @@ -752,12 +749,14 @@ public class kelondroRecords { //System.out.println("WRITEH(" + filename + ", " + seekpos(this.handle) + ", " + this.headChunk.length + ")"); entryFile.write(seekpos(this.handle), this.headChunk); update2Cache(cachePriority); + this.headChanged = false; } // save tail if ((this.tailChunk != null) && (this.tailChanged)) { //System.out.println("WRITET(" + filename + ", " + (seekpos(this.handle) + headchunksize) + ", " + this.tailChunk.length + ")"); entryFile.write(seekpos(this.handle) + headchunksize, this.tailChunk); + this.tailChanged = false; } } @@ -837,7 +836,7 @@ public class kelondroRecords { // store the cache entry boolean upd = false; - cacheHeaders.putb(cacheHandle.index, headChunk); + upd = (cacheHeaders.putb(cacheHandle.index, headChunk) != null); if (upd) writeDouble++; else writeUnique++; // delete the cache entry buffer