- 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

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6773 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 15 years ago
parent 9ddb8e4a43
commit 749ffbd642

@ -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>(

@ -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) {

Loading…
Cancel
Save