Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed a bug in rwi storage data size allocation
orbiterb6cce0801988
diff --git a/source/net/yacy/kelondro/index/ObjectIndexCache.java b/source/net/yacy/kelondro/index/ObjectIndexCache.javaindex 98735ef4b..5fbbc6e57 100644--- a/source/net/yacy/kelondro/index/ObjectIndexCache.java+++ b/source/net/yacy/kelondro/index/ObjectIndexCache.java@@ -92,7 +92,7 @@ public final class ObjectIndexCache implements ObjectIndex, Iterable<Row.Entry>// finish initialization phaseindex0.sort();index0.uniq();- index0.trim(false);+ index0.trim();index1 = new RowSet(rowdef); //new RowSetArray(rowdef, spread);}}diff --git a/source/net/yacy/kelondro/index/RowCollection.java b/source/net/yacy/kelondro/index/RowCollection.javaindex f533d5b05..a9acee52c 100644--- a/source/net/yacy/kelondro/index/RowCollection.java+++ b/source/net/yacy/kelondro/index/RowCollection.java@@ -220,11 +220,12 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {public synchronized byte[] exportCollection() {// returns null if the collection is empty- trim(false);sort(); // experimental; supervise CPU load+ //uniq();+ //trim();assert this.sortBound == this.chunkcount; // on case the collection is sorted- assert this.size() * this.rowdef.objectsize == this.chunkcache.length : "this.size() = " + this.size() + ", objectsize = " + this.rowdef.objectsize + ", chunkcache.length = " + this.chunkcache.length;- final Row row = exportRow(chunkcache.length);+ assert this.size() * this.rowdef.objectsize <= this.chunkcache.length : "this.size() = " + this.size() + ", objectsize = " + this.rowdef.objectsize + ", chunkcache.length = " + this.chunkcache.length;+ final Row row = exportRow(this.size() * this.rowdef.objectsize);final Row.Entry entry = row.newEntry();assert (sortBound <= chunkcount) : "sortBound = " + sortBound + ", chunkcount = " + chunkcount;assert (this.chunkcount <= chunkcache.length / rowdef.objectsize) : "chunkcount = " + this.chunkcount + ", chunkcache.length = " + chunkcache.length + ", rowdef.objectsize = " + rowdef.objectsize;@@ -296,10 +297,10 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {return neededSpaceForEnsuredSize(chunkcount + 1, false);}- protected synchronized void trim(final boolean plusGrowFactor) {+ protected synchronized void trim() {if (chunkcache.length == 0) return;long needed = chunkcount * rowdef.objectsize;- if (plusGrowFactor) needed = neededSpaceForEnsuredSize(chunkcount, false);+ assert needed <= chunkcache.length;if (needed >= chunkcache.length)return; // in case that the growfactor causes that the cache would// grow instead of shrink, simply ignore the growfactor@@ -308,8 +309,7 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {// This is not critical. Otherwise we provoke a serious// problem with OOMfinal byte[] newChunkcache = new byte[(int) needed];- System.arraycopy(chunkcache, 0, newChunkcache, 0, Math.min(- chunkcache.length, newChunkcache.length));+ System.arraycopy(chunkcache, 0, newChunkcache, 0, Math.min(chunkcache.length, newChunkcache.length));chunkcache = newChunkcache;}@@ -945,7 +945,7 @@ public class RowCollection implements Iterable<Row.Entry>, Cloneable {collection.addUnique(get(i + 1, false));removeRow(i + 1, false);if (i + 1 < chunkcount - 1) u = false;- collection.trim(false);+ collection.trim();report.add(collection);collection = new RowSet(this.rowdef, 2);}diff --git a/source/net/yacy/kelondro/index/RowSet.java b/source/net/yacy/kelondro/index/RowSet.javaindex 06ae061b8..4dca8e49a 100644--- a/source/net/yacy/kelondro/index/RowSet.java+++ b/source/net/yacy/kelondro/index/RowSet.java@@ -515,7 +515,7 @@ public class RowSet extends RowCollection implements ObjectIndex, Iterable<Row.ESystem.out.println("SORTED : " + d.toString());d.uniq();System.out.println("UNIQ : " + d.toString());- d.trim(false);+ d.trim();System.out.println("TRIM : " + d.toString());