private void readRecordFromPage( long id, RECORD record, RecordLoad mode, PageCursor cursor ) throws IOException { cursor.mark(); do { prepareForReading( cursor, record ); recordFormat.read( record, cursor, mode, recordSize ); } while ( cursor.shouldRetry() ); checkForDecodingErrors( cursor, id, mode ); verifyAfterReading( record, mode ); }
public byte[] getRawRecordData( long id ) throws IOException { byte[] data = new byte[recordSize]; long pageId = pageIdForRecord( id ); int offset = offsetForId( id ); try ( PageCursor cursor = pagedFile.io( pageId, PagedFile.PF_SHARED_READ_LOCK ) ) { if ( cursor.next() ) { cursor.setOffset( offset ); cursor.mark(); do { cursor.setOffsetToMark(); cursor.getBytes( data ); } while ( cursor.shouldRetry() ); checkForDecodingErrors( cursor, id, CHECK ); } } return data; }
public boolean isInUse( long id ) { long pageId = pageIdForRecord( id ); int offset = offsetForId( id ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_READ_LOCK ) ) { boolean recordIsInUse = false; if ( cursor.next() ) { cursor.setOffset( offset ); cursor.mark(); do { cursor.setOffsetToMark(); recordIsInUse = isInUse( cursor ); } while ( cursor.shouldRetry() ); checkForDecodingErrors( cursor, id, NORMAL ); } return recordIsInUse; } catch ( IOException e ) { throw new UnderlyingStorageException( e ); } }
checkForDecodingErrors( cursor, id, NORMAL ); // We don't free ids if something weird goes wrong if ( !record.inUse() )
private void readRecordFromPage( long id, RECORD record, RecordLoad mode, PageCursor cursor ) throws IOException { cursor.mark(); do { prepareForReading( cursor, record ); recordFormat.read( record, cursor, mode, recordSize ); } while ( cursor.shouldRetry() ); checkForDecodingErrors( cursor, id, mode ); verifyAfterReading( record, mode ); }
public byte[] getRawRecordData( long id ) throws IOException { byte[] data = new byte[recordSize]; long pageId = pageIdForRecord( id ); int offset = offsetForId( id ); try ( PageCursor cursor = pagedFile.io( pageId, PagedFile.PF_SHARED_READ_LOCK ) ) { if ( cursor.next() ) { cursor.setOffset( offset ); cursor.mark(); do { cursor.setOffsetToMark(); cursor.getBytes( data ); } while ( cursor.shouldRetry() ); checkForDecodingErrors( cursor, id, CHECK ); } } return data; }
public boolean isInUse( long id ) { long pageId = pageIdForRecord( id ); int offset = offsetForId( id ); try ( PageCursor cursor = pagedFile.io( pageId, PF_SHARED_READ_LOCK ) ) { boolean recordIsInUse = false; if ( cursor.next() ) { cursor.setOffset( offset ); cursor.mark(); do { cursor.setOffsetToMark(); recordIsInUse = isInUse( cursor ); } while ( cursor.shouldRetry() ); checkForDecodingErrors( cursor, id, NORMAL ); } return recordIsInUse; } catch ( IOException e ) { throw new UnderlyingStorageException( e ); } }
checkForDecodingErrors( cursor, id, NORMAL ); // We don't free ids if something weird goes wrong if ( !record.inUse() )