Skip to content

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

- added another catch case for the index dump and index merge process that should cause non-blocking behavior in case that index dump and/or index merge caused any unexpected exception. - reverted SVN 6766, this is too dangerous (may cause unexpected memory usage) and should not be necessary

orbiter749ffbd64281
diff --git a/source/de/anomic/search/Segment.java b/source/de/anomic/search/Segment.java
index 547c68d60..b0ad82a6f 100644
--- a/source/de/anomic/search/Segment.java
+++ b/source/de/anomic/search/Segment.java
@@ -100,7 +100,7 @@ public class Segment {
this.log = log;
this.segmentPath = segmentPath;
- this.merger = new IODispatcher(2, 2, writeBufferSize);
+ this.merger = new IODispatcher(1, 1, writeBufferSize);
this.merger.start();
this.termIndex = new IndexCell<WordReference>(
diff --git a/source/net/yacy/kelondro/rwi/IndexCell.java b/source/net/yacy/kelondro/rwi/IndexCell.java
index d611890b1..d6de1e39b 100644
--- a/source/net/yacy/kelondro/rwi/IndexCell.java
+++ b/source/net/yacy/kelondro/rwi/IndexCell.java
@@ -389,16 +389,19 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
(this.ram.size() > 3000 && !MemoryControl.request(80L * 1024L * 1024L, false)))) {
try {
this.dumperSemaphore.acquire(); // only one may pass
- if (this.ram.size() >= this.maxRamEntries || (this.ram.size() > 3000 && !MemoryControl.request(80L * 1024L * 1024L, false))) {
+ if (this.ram.size() >= this.maxRamEntries || (this.ram.size() > 3000 && !MemoryControl.request(80L * 1024L * 1024L, false))) try {
// dump the ram
File dumpFile = this.array.newContainerBLOBFile();
// a critical point: when the ram is handed to the dump job,
- // dont write into it any more. Use a fresh one instead
+ // don't write into it any more. Use a fresh one instead
ReferenceContainerCache<ReferenceType> ramdump = this.ram;
// get a fresh ram cache
this.ram = new ReferenceContainerCache<ReferenceType>(factory, this.array.rowdef(), this.array.ordering());
// dump the buffer
merger.dump(ramdump, dumpFile, array);
+ } catch (Exception e) {
+ // catch all exceptions to prevent that no semaphore is released
+ Log.logException(e);
}
this.dumperSemaphore.release();
} catch (InterruptedException e) {
@@ -412,9 +415,13 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu
this.lastCleanup + cleanupCycle < System.currentTimeMillis())) {
try {
this.cleanerSemaphore.acquire();
- if (this.array.entries() > 50 || (this.lastCleanup + cleanupCycle < System.currentTimeMillis())) {
+ if (this.array.entries() > 50 || (this.lastCleanup + cleanupCycle < System.currentTimeMillis())) try {
+ this.lastCleanup = System.currentTimeMillis(); // set time to prevent that this is called to soo again
this.array.shrink(this.targetFileSize, this.maxFileSize);
- this.lastCleanup = System.currentTimeMillis();
+ this.lastCleanup = System.currentTimeMillis(); // set again to mark end of procedure
+ } catch (Exception e) {
+ // catch all exceptions to prevent that no semaphore is released
+ Log.logException(e);
}
this.cleanerSemaphore.release();
} catch (InterruptedException e) {