/** * Allocate a new rowid with the indicated size. */ private Location alloc( int size ) throws IOException { Location retval = freePageManager.get( size ); if ( retval == null ) { // temporary work around for DIRSERVER-1459 retval = allocNew( size * 2, pageManager.getLast( Magic.USED_PAGE ) ); } return retval; }
/** * Allocate a new rowid with the indicated size. */ private Location alloc( int size ) throws IOException { Location retval = freeman.get( size ); if ( retval == null ) { // temporary work around for DIRSERVER-1459 retval = allocNew( size * 2, pageManager.getLast( Magic.USED_PAGE ) ); } return retval; }
/** * Allocate a new rowid with the indicated size. */ private Location alloc( int size ) throws IOException { Location retval = freeman.get( size ); if ( retval == null ) { // temporary work around for DIRSERVER-1459 retval = allocNew( size * 2, pageman.getLast( Magic.USED_PAGE ) ); } return retval; }
/** * Allocate a new rowid with the indicated size. */ private long alloc(int size) throws IOException { size = RecordHeader.roundAvailableSize(size); long retval = freeman.get(size); if (retval == 0) { retval = allocNew(size, pageman.getLast(Magic.USED_PAGE)); } return retval; }
/** * Insert at forced location, use only for defragmentation !! * @param logicalRowId * @param physLoc * @throws IOException */ void forceInsert(long logicalRowId, long physLoc) throws IOException { //create pages until we reach requested block long lastBlock = pageman.getLast(Magic.TRANSLATION_PAGE); while(lastBlock!=Location.getBlock(logicalRowId)){ lastBlock = pageman.allocate(Magic.TRANSLATION_PAGE); if(lastBlock>Location.getBlock(logicalRowId)) throw new Error("outallocated"); } if(fetch(logicalRowId) != 0) throw new Error("can not forceInsert, record already exists: "+logicalRowId); update(logicalRowId, physLoc); }
/** * Returns a mapping * * @param rowid * The logical rowid * @return The physical rowid, 0 if does not exist */ long fetch(long rowid) throws IOException { final long block = Location.getBlock(rowid); long last = pageman.getLast(Magic.TRANSLATION_PAGE); if(last+1<block) return 0; final short offset = Location.getOffset(rowid); BlockIo bio = file.get(block); TranslationPage xlatPage = TranslationPage.getTranslationPageView(bio,blockSize); try { long retval = Location.toLong( xlatPage.getLocationBlock(offset), xlatPage.getLocationOffset(offset)); return retval; } finally { file.release(block, false); } }