Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

diverses; b.o. fix for http://www.yacy-forum.de/viewtopic.php?p=33914#33914

orbiter159bd0cab56a
diff --git a/source/de/anomic/kelondro/kelondroCollectionIndex.java b/source/de/anomic/kelondro/kelondroCollectionIndex.java
index d7656a077..1bf72697c 100644
--- a/source/de/anomic/kelondro/kelondroCollectionIndex.java
+++ b/source/de/anomic/kelondro/kelondroCollectionIndex.java
@@ -572,7 +572,7 @@ public class kelondroCollectionIndex {
ArrayList actionList;
TreeMap actionMap;
boolean madegc = false;
- System.out.println("DEBUG existingContainer: " + existingContainer.toString());
+ //System.out.println("DEBUG existingContainer: " + existingContainer.toString());
while (existingContainer.size() > 0) {
oldPartitionNumber1 = ((Integer) existingContainer.lastKey()).intValue();
containerMap = (TreeMap) existingContainer.remove(new Integer(oldPartitionNumber1));
diff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.java
index 353b1fe0d..ebe428f67 100644
--- a/source/de/anomic/kelondro/kelondroDyn.java
+++ b/source/de/anomic/kelondro/kelondroDyn.java
@@ -109,31 +109,12 @@ public class kelondroDyn {
buffer = new kelondroObjectBuffer(file.toString());
}
- public static final kelondroDyn open(File file, boolean useNodeCache, boolean useObjectCache, long preloadTime, int key, int nodesize, char fillChar, boolean usetree, boolean writebuffer, boolean resetOnFail) {
- return open(file, useNodeCache, useObjectCache, preloadTime, key, nodesize, fillChar, new kelondroNaturalOrder(true), usetree, writebuffer, resetOnFail);
- }
-
- public static final kelondroDyn open(File file, boolean useNodeCache, boolean useObjectCache, long preloadTime, int key,
- int nodesize, char fillChar, kelondroOrder objectOrder, boolean usetree, boolean writebuffer, boolean resetOnFail) {
- return new kelondroDyn(file, useNodeCache, useObjectCache, preloadTime, key, nodesize, fillChar, objectOrder, usetree, writebuffer, resetOnFail);
- }
-
public void reset() throws IOException {
String name = this.index.filename();
this.index.reset();
this.buffer = new kelondroObjectBuffer(name);
}
- /*
- private void writeSegmentCount() {
- try {
- setText(0, kelondroBase64Order.enhancedCoder.encodeLong(segmentCount, 8).getBytes());
- } catch (Exception e) {
-
- }
- }
- */
-
public kelondroRow row() {
return this.rowdef;
}
diff --git a/source/de/anomic/kelondro/kelondroFlexTable.java b/source/de/anomic/kelondro/kelondroFlexTable.java
index 3f9e3cbff..08b27cc44 100644
--- a/source/de/anomic/kelondro/kelondroFlexTable.java
+++ b/source/de/anomic/kelondro/kelondroFlexTable.java
@@ -151,7 +151,9 @@ public class kelondroFlexTable extends kelondroFlexWidthArray implements kelondr
}
private kelondroIndex initializeRamIndex() {
- kelondroRowSet ri = new kelondroRowSet(new kelondroRow(new kelondroColumn[]{super.row().column(0), new kelondroColumn("int c-4 {b256}")}, super.rowdef.objectOrder, super.rowdef.primaryKey), super.col[0].size() + 1);
+ int space = super.col[0].size() + 1;
+ if (space < 0) throw new kelondroException("wrong space: " + space);
+ kelondroRowSet ri = new kelondroRowSet(new kelondroRow(new kelondroColumn[]{super.row().column(0), new kelondroColumn("int c-4 {b256}")}, super.rowdef.objectOrder, super.rowdef.primaryKey), space);
Iterator content = super.col[0].contentNodes(-1);
kelondroRecords.Node node;
kelondroRow.Entry indexentry;
diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.java
index d2100c1a0..0370db8ea 100644
--- a/source/de/anomic/plasma/plasmaSwitchboard.java
+++ b/source/de/anomic/plasma/plasmaSwitchboard.java
@@ -2801,13 +2801,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements ser
//snippet = null;
result.setSnippet(null);
}
- /*
- if ((snippet != null) && (snippet.getSource() == plasmaSnippetCache.ERROR_NO_MATCH)) {
- // suppress line: there is no match in that resource
- } else {*/
- i++;
- results.appendResult(result);
- //}
+ i++;
+ results.appendResult(result);
}
}
log.logFine("SEARCH TIME AFTER RESULT PREPARATION: " + ((System.currentTimeMillis() - timestamp) / 1000) + " seconds");
diff --git a/source/de/anomic/plasma/plasmaWordIndex.java b/source/de/anomic/plasma/plasmaWordIndex.java
index e0d57deda..9a088eb0e 100644
--- a/source/de/anomic/plasma/plasmaWordIndex.java
+++ b/source/de/anomic/plasma/plasmaWordIndex.java
@@ -139,7 +139,7 @@ public final class plasmaWordIndex implements indexRI {
public void dhtOutFlushControl() {
// check for forced flush
- synchronized (this) {
+ synchronized (dhtOutCache) {
if ((dhtOutCache.getMaxWordCount() > wCacheMaxChunk ) ||
(dhtOutCache.size() > dhtOutCache.getMaxWordCount()) ||
(serverMemory.available() < collections.minMem())) {
@@ -149,7 +149,7 @@ public final class plasmaWordIndex implements indexRI {
}
public void dhtInFlushControl() {
// check for forced flush
- synchronized (this) {
+ synchronized (dhtInCache) {
if ((dhtInCache.getMaxWordCount() > wCacheMaxChunk ) ||
(dhtInCache.size() > dhtInCache.getMaxWordCount())||
(serverMemory.available() < collections.minMem())) {
@@ -173,10 +173,10 @@ public final class plasmaWordIndex implements indexRI {
if ((!dhtInCase) && (yacyDHTAction.shallBeOwnWord(wordHash))) dhtInCase = true;
// add the entry
- if (dhtInCase) {
+ if (dhtInCase) synchronized (dhtInCache) {
dhtInCache.addEntry(wordHash, entry, updateTime, true);
dhtInFlushControl();
- } else {
+ } else synchronized (dhtOutCache) {
dhtOutCache.addEntry(wordHash, entry, updateTime, false);
dhtOutFlushControl();
}
@@ -189,10 +189,10 @@ public final class plasmaWordIndex implements indexRI {
if ((!dhtInCase) && (yacyDHTAction.shallBeOwnWord(entries.getWordHash()))) dhtInCase = true;
// add the entry
- if (dhtInCase) {
+ if (dhtInCase) synchronized (dhtInCache) {
dhtInCache.addEntries(entries, updateTime, true);
dhtInFlushControl();
- } else {
+ } else synchronized (dhtOutCache) {
dhtOutCache.addEntries(entries, updateTime, false);
dhtOutFlushControl();
}
@@ -329,13 +329,18 @@ public final class plasmaWordIndex implements indexRI {
public indexContainer getContainer(String wordHash, Set urlselection, long maxTime) {
// get from cache
- indexContainer container = dhtOutCache.getContainer(wordHash, urlselection, -1);
- if (container == null) {
- container = dhtInCache.getContainer(wordHash, urlselection, -1);
- } else {
- container.addAllUnique(dhtInCache.getContainer(wordHash, urlselection, -1));
+ indexContainer container;
+ synchronized (dhtOutCache) {
+ container = dhtOutCache.getContainer(wordHash, urlselection, -1);
}
-
+ synchronized (dhtInCache) {
+ if (container == null) {
+ container = dhtInCache.getContainer(wordHash, urlselection, -1);
+ } else {
+ container.addAllUnique(dhtInCache.getContainer(wordHash, urlselection, -1));
+ }
+ }
+
// get from collection index
if (container == null) {
container = collections.getContainer(wordHash, urlselection, (maxTime < 0) ? -1 : maxTime);
diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java
index f46898f6b..10d7ba459 100644
--- a/source/de/anomic/yacy/yacySeedDB.java
+++ b/source/de/anomic/yacy/yacySeedDB.java
@@ -192,11 +192,11 @@ public final class yacySeedDB {
initializeHandlerMethod = null;
}
try {
- return new kelondroMapObjects(kelondroDyn.open(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', false, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
+ return new kelondroMapObjects(new kelondroDyn(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', false, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
} catch (Exception e) {
seedDBFile.delete();
// try again
- return new kelondroMapObjects(kelondroDyn.open(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', false, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
+ return new kelondroMapObjects(new kelondroDyn(seedDBFile, true, true, preloadTime / 3, commonHashLength, 480, '#', false, false, true), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
}
}