PageHeader hdr = page.getPageHeader();
hdr.setRecordLength(value.getLength());
try {
page.readData(is);
} catch (IOException e) {
throw new DbException(e);
}
// Write out the rest of the value onto any needed overflow pages
Page lastPage = page;
while(true) {
final int available;
try {
available = is.available();
} catch (IOException e) {
throw new DbException(e);
}
if(available == 0) {
break;
}
LOG.debug("page overflowed");
Page lpage = lastPage;
PageHeader lhdr = hdr;
// Find an overflow page to use
long np = lhdr.getNextPage();
if(np != NO_PAGE) {
// Use an existing page
lastPage = getPage(np);
} else {
// Create a new overflow page
lastPage = getFreePage();
lhdr.setNextPage(lastPage.getPageNum());
}
// Mark the page as an overflow page
hdr = lastPage.getPageHeader();
hdr.setStatus(OVERFLOW);
// Write some more of the value to the overflow page
try {
lastPage.readData(is);
} catch (IOException e) {
throw new DbException(e);
}
lpage.write();
}
// Cleanup any unused overflow pages. i.e. the value is smaller then the