parent.thisPage=new IndexPageKey( this,
streams.writeImmovableObject( parent, 0), null);
}
catch ( IOException ioe)
{
throw new ObjectStoreException( "I/O error creating index page",
ioe);
}
catch ( DiskAllocatorException dae)
{
throw new ObjectStoreException( "Error creating index page:",
dae);
}
entry.startPageOffset=parent.thisPage.offset;
topKey=parent.thisPage;
toSplit.thisPage.parent=parent.thisPage;
manager.dirtyClassList();
manager.addNewIndexPageToCache( parent);
splitParentPosition=1;
}
else
{
parent=manager.getIndexPageByKey( toSplit.thisPage.parent);
splitParentPosition=binarySearch( parent.keyArray, 0, parent.size-1,
toSplit.keyArray[0]);
if ( splitParentPosition<0)
throw new ObjectStoreException(
"Index corrupt: splitting page");
splitParentPosition++;
}
int splitPosition=toSplit.size/2;
IndexPage newPage=new IndexPage();
newPage.nextOffsetArray=new int[entry.pageCount];
System.arraycopy( toSplit.nextOffsetArray, splitPosition,
newPage.nextOffsetArray, 0, toSplit.size-splitPosition);
newPage.keyArray=new Comparable[entry.pageCount];
System.arraycopy( toSplit.keyArray, splitPosition,
newPage.keyArray, 0, toSplit.size-splitPosition);
if ( toSplit.reuseArray==null)
newPage.reuseArray=null;
else
{
newPage.reuseArray=new int[entry.pageCount];
System.arraycopy( toSplit.reuseArray, splitPosition,
newPage.reuseArray, 0, toSplit.size-splitPosition);
}
newPage.size=toSplit.size-splitPosition;
newPage.modified=true;
try
{
newPage.thisPage=new IndexPageKey( this,
streams.writeImmovableObject( newPage, 0), toSplit.thisPage.parent);
}
catch ( IOException ioe)
{
throw new ObjectStoreException( "I/O error creating index page",
ioe);
}
catch ( DiskAllocatorException dae)
{
throw new ObjectStoreException( "Error creating index page:",
dae);
}
toSplit.size=splitPosition;
for ( int i=splitPosition; i<entry.pageCount; i++)