@Override public void prepare( RECORD record, int recordSize, IdSequence idSequence ) { actual.prepare( record, recordSize, idSequence ); if ( !record.hasSecondaryUnitId() ) { record.setSecondaryUnitId( idSequence.nextId() ); } }
if ( (!record.inUse() || !record.requiresSecondaryUnit()) && record.hasSecondaryUnitId() )
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } }
protected void markAsUnused( PageCursor cursor, RECORD record, int recordSize ) throws IOException { markAsUnused( cursor ); if ( record.hasSecondaryUnitId() ) { long secondaryUnitId = record.getSecondaryUnitId(); long pageIdForSecondaryRecord = pageIdForRecord( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); int offsetForSecondaryId = offsetForId( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); if ( !cursor.next( pageIdForSecondaryRecord ) ) { throw new UnderlyingStorageException( "Couldn't move to secondary page " + pageIdForSecondaryRecord ); } cursor.setOffset( offsetForSecondaryId ); markAsUnused( cursor ); } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
protected void markAsUnused( PageCursor cursor, RECORD record, int recordSize ) throws IOException { markAsUnused( cursor ); if ( record.hasSecondaryUnitId() ) { long secondaryUnitId = record.getSecondaryUnitId(); long pageIdForSecondaryRecord = pageIdForRecord( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); int offsetForSecondaryId = offsetForId( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); if ( !cursor.next( pageIdForSecondaryRecord ) ) { throw new UnderlyingStorageException( "Couldn't move to secondary page " + pageIdForSecondaryRecord ); } cursor.setOffset( offsetForSecondaryId ); markAsUnused( cursor ); } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
@Override public final void prepare( RECORD record, int recordSize, IdSequence idSequence ) { if ( record.inUse() ) { record.setUseFixedReferences( canUseFixedReferences( record, recordSize )); if ( !record.isUseFixedReferences() ) { int requiredLength = HEADER_BYTE + requiredDataLength( record ); boolean requiresSecondaryUnit = requiredLength > recordSize; record.setRequiresSecondaryUnit( requiresSecondaryUnit ); if ( record.requiresSecondaryUnit() && !record.hasSecondaryUnitId() ) { // Allocate a new id at this point, but this is not the time to free this ID the the case where // this record doesn't need this secondary unit anymore... that needs to be done when applying to store. record.setSecondaryUnitId( idSequence.nextId() ); } } } }
protected void markAsUnused( PageCursor cursor, RECORD record, int recordSize ) throws IOException { markAsUnused( cursor ); if ( record.hasSecondaryUnitId() ) { long secondaryUnitId = record.getSecondaryUnitId(); long pageIdForSecondaryRecord = pageIdForRecord( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); int offsetForSecondaryId = offsetForId( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); if ( !cursor.next( pageIdForSecondaryRecord ) ) { throw new UnderlyingStorageException( "Couldn't move to secondary page " + pageIdForSecondaryRecord ); } cursor.setOffset( offsetForSecondaryId ); markAsUnused( cursor ); } }
protected void markAsUnused( PageCursor cursor, RECORD record, int recordSize ) throws IOException { markAsUnused( cursor ); if ( record.hasSecondaryUnitId() ) { long secondaryUnitId = record.getSecondaryUnitId(); long pageIdForSecondaryRecord = pageIdForRecord( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); int offsetForSecondaryId = offsetForId( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); if ( !cursor.next( pageIdForSecondaryRecord ) ) { throw new UnderlyingStorageException( "Couldn't move to secondary page " + pageIdForSecondaryRecord ); } cursor.setOffset( offsetForSecondaryId ); markAsUnused( cursor ); } }
protected void markAsUnused( PageCursor cursor, RECORD record, int recordSize ) throws IOException { markAsUnused( cursor ); if ( record.hasSecondaryUnitId() ) { long secondaryUnitId = record.getSecondaryUnitId(); long pageIdForSecondaryRecord = pageIdForRecord( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); int offsetForSecondaryId = offsetForId( secondaryUnitId, cursor.getCurrentPageSize(), recordSize ); if ( !cursor.next( pageIdForSecondaryRecord ) ) { throw new UnderlyingStorageException( "Couldn't move to secondary page " + pageIdForSecondaryRecord ); } cursor.setOffset( offsetForSecondaryId ); markAsUnused( cursor ); } }
if ( (!record.inUse() || !record.requiresSecondaryUnit()) && record.hasSecondaryUnitId() )