- some bugs may have been fixed with wrong removal operations
- removed temporary storage of remove-positions and replaced by direct deletions
- changed synchronization
- added many assets
- modified dbtest to also test remove during threaded stresstest
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3576 6c8d7289-2bf4-0310-a012-ef5d649a1542
serverLog.logSevere("kelondroCollectionIndex","UPDATE (put) ERROR: array has different chunkcount than index after merge: index = "+(int)indexrow.getColLong(idx_col_chunkcount)+", collection.size() = "+collection.size());
@ -684,9 +671,6 @@ public class kelondroCollectionIndex {
indexrows_new.add(indexrow);// collect new index rows
}
// remove all to-be-removed marked entries
arrayResolveRemoved();
// write index entries
index.putMultiple(indexrows_existing,newDate());// write modified indexrows in optimized manner
index.addUniqueMultiple(indexrows_new,newDate());// write new indexrows in optimized manner
@ -752,8 +736,7 @@ public class kelondroCollectionIndex {
// cleanup for a bad bug that corrupted the database
index.remove(indexkey);// the RowCollection must be considered lost
array.remove(rownumber, false);// loose the RowCollection (we don't know how much is lost)
array.remove(rownumber);// loose the RowCollection (we don't know how much is lost)
serverLog.logSevere("kelondroCollectionIndex."+array.filename,"lost a RowCollection because of a bad arraykey");
returnnewkelondroRowSet(this.payloadrow,0);
}
@ -969,7 +954,7 @@ public class kelondroCollectionIndex {
index.put(indexrow);
array.logFailure("INCONSISTENCY (get) in "+arrayFile(this.path,this.filenameStub,this.loadfactor,chunksize,clusteridx,serialnumber).toString()+": array has different chunkcount than index: index = "+chunkcount+", array = "+chunkcountInArray+"; the index has been auto-fixed");
}
if(remove)array.remove(rownumber, false);// index is removed in calling method
if(remove)array.remove(rownumber);// index is removed in calling method
returncollection;
}
@ -1043,7 +1028,7 @@ public class kelondroCollectionIndex {
@ -292,19 +292,18 @@ public class kelondroRecords {
USAGE.USEDC++;
USAGE.FREEC--;
// take link
intindex;
if(USAGE.FREEH.index ==NUL){
intindex=USAGE.FREEH.index;
if(index ==NUL){
serverLog.logSevere("kelondroRecords/"+filename,"INTERNAL ERROR (DATA INCONSISTENCY): re-use of records failed, lost "+(USAGE.FREEC+1)+" records.");
// try to heal..
USAGE.USEDC=USAGE.allCount()+1;
USAGE.FREEC=0;
index=USAGE.USEDC-1;
}else{
index=USAGE.FREEH.index;
//System.out.println("*DEBUG* ALLOCATED DELETED INDEX " + index);
// check for valid seek position
longseekp=seekpos(USAGE.FREEH);
if(seekp>entryFile.length()){
if(seekp>=entryFile.length()){
// this is a severe inconsistency. try to heal..
serverLog.logSevere("kelondroRecords/"+filename,"new Handle: lost "+USAGE.FREEC+" marked nodes; seek position "+seekp+"/"+USAGE.FREEH.index+" out of file size "+entryFile.length()+"/"+((entryFile.length()-POS_NODES)/recordsize));
index=USAGE.allCount();// a place at the end of the file
@ -1316,13 +1318,11 @@ public class kelondroRecords {
}
// Returns the number of key-value mappings in this map.
publicintsize(){
synchronized(entryFile){
returnUSAGE.used();
}
publicsynchronizedintsize(){
returnUSAGE.used();
}
protected final intfree(){
protectedsynchronized final intfree(){
returnUSAGE.FREEC;
}
@ -1379,13 +1379,12 @@ public class kelondroRecords {
if(USAGE.FREEC!=0){
Handleh=USAGE.FREEH;
longrepair_position=POS_FREEH;
intiter=0;
while(h.index!=NUL){
// check handle
seekp=seekpos(h);
if(seekp>entryFile.length()){
// repair last hande store position
this.theLogger.severe("KELONDRO WARNING "+this.filename+": seek position "+seekp+"/"+h.index+" out of file size "+entryFile.length()+"/"+((entryFile.length()-POS_NODES)/recordsize)+" after "+iter+" iterations; patched wrong node");
this.theLogger.severe("KELONDRO WARNING "+this.filename+": seek position "+seekp+"/"+h.index+" out of file size "+entryFile.length()+"/"+((entryFile.length()-POS_NODES)/recordsize)+" after "+markedDeleted.size()+" iterations; patched wrong node");
entryFile.writeInt(repair_position,NUL);
returnmarkedDeleted;
}
@ -1407,10 +1406,9 @@ public class kelondroRecords {
}
// this appears to be correct. go on.
iter++;
if(System.currentTimeMillis()>timeLimit)thrownewkelondroException(filename,"time limit of "+maxTime+" exceeded; > "+markedDeleted.size()+" deleted entries");
}
System.out.println("\nDEBUG: "+iter+" deleted entries in "+entryFile.name());
System.out.println("\nDEBUG: "+markedDeleted.size()+" deleted entries in "+entryFile.name());
asserturlFileIndex.size()+1==s:"urlFileIndex.size() = "+urlFileIndex.size()+", s = "+s+", result = "+result;
if(entry==null){
serverLog.logSevere("PLASMA BALANCER","get() found a valid urlhash, but failed to fetch the corresponding url entry - total size = "+size()+", fileStack.size() = "+urlFileStack.size()+", ramStack.size() = "+urlRAMStack.size()+", domainStacks.size() = "+domainStacks.size());
returnnull;
}
returnnewplasmaCrawlEntry(entry);
}
@ -444,13 +454,13 @@ public class plasmaCrawlBalancer {