* synchronized array and index objects
* auto-fix function for slightly corrupted index entries
* generalized internal access methods
also extended kelondroIndex interface to support ordering access
which is used in kelondroCollectionIndex for string comparisments
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2366 6c8d7289-2bf4-0310-a012-ef5d649a1542
if(oldarrayrow==null)thrownewkelondroException(arrayFile(this.path,this.filenameStub,this.loadfactor,oldchunksize,oldPartitionNumber,oldSerialNumber).toString(),"array does not contain expected row");
// read the row and define a collection
kelondroRowSetoldcollection=newkelondroRowSet(this.rowdef,oldarrayrow.getColBytes(1));// FIXME: this does not yet work with different rowdef in case of several rowdef.objectsize()
// join with new collection
oldcollection.addAll(collection);
collection=oldcollection;
}
if(merge){
// load the old collection and join it with the old
if(oldarrayrow==null)thrownewkelondroException(arrayFile(this.path,this.filenameStub,this.loadfactor,oldchunksize,oldPartitionNumber,oldSerialNumber).toString(),"array does not contain expected row");
kelondroRowSetoldcollection=newkelondroRowSet(this.rowdef,oldarrayrow.getColBytes(1));// FIXME: this does not yet work with different rowdef in case of several rowdef.objectsize()
@ -319,8 +314,17 @@ public class kelondroCollectionIndex {
// read the row and define a collection
kelondroRowSetcollection=newkelondroRowSet(this.rowdef,arrayrow.getColBytes(1));// FIXME: this does not yet work with different rowdef in case of several rowdef.objectsize()
// check if we got the right row; this row is wrong
thrownewkelondroException(arrayFile(this.path,this.filenameStub,this.loadfactor,chunksize,partitionnumber,serialnumber).toString(),"array contains wrong row '"+newString(arrayrow.getColBytes(0))+"', expected is '"+newString(indexrow.getColBytes(idx_col_key)+"'"));
}
intchunkcountInArray=collection.size();
if(chunkcountInArray!=chunkcount)thrownewkelondroException(arrayFile(this.path,this.filenameStub,this.loadfactor,chunksize,partitionnumber,serialnumber).toString(),"array has different chunkcount than index: index = "+chunkcount+", array = "+chunkcountInArray);
array.logFailure("INCONSISTENCY in "+arrayFile(this.path,this.filenameStub,this.loadfactor,chunksize,partitionnumber,serialnumber).toString()+": array has different chunkcount than index: index = "+chunkcount+", array = "+chunkcountInArray+"; the index has been auto-fixed");