Top Constructors Methods
org.apache.derby.impl.store.access.heap

public Class HeapController

extends GenericConglomerateController
implements ConglomerateController
Class Inheritance
All Implemented Interfaces
org.apache.derby.iapi.store.access.ConglomerateController, org.apache.derby.iapi.store.access.ConglomPropertyQueryable
Imports
java.util.List, org.apache.derby.catalog.UUID, org.apache.derby.shared.common.reference.SQLState, org.apache.derby.shared.common.sanity.SanityManager, org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.conglomerate.TransactionManager, org.apache.derby.iapi.store.access.AccessFactoryGlobals, .ConglomerateController, .DynamicCompiledOpenConglomInfo, .RowLocationRetRowSource, .RowUtil, .TransactionController, org.apache.derby.iapi.store.raw.ContainerHandle, .LockingPolicy, .Page, .RecordHandle, org.apache.derby.iapi.types.DataValueDescriptor, .RowLocation, org.apache.derby.impl.store.access.conglomerate.OpenConglomerate, .GenericConglomerateController, .RowPosition, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.impl.sql.execute.DeferredConstraintsMemory

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private RecordHandle

Returns:

The record handle of the inserted row.
doInsert
(DataValueDescriptor[]
The row to insert.
row
)

Insert a new row into the heap.

public OpenConglomerate
getOpenConglomerate()

Public Methods of XXXX class:

protected final void
getRowPositionFromRowLocation(RowLocation row_loc, RowPosition pos)

Overrides org.apache.derby.impl.store.access.conglomerate.GenericController.getRowPositionFromRowLocation.

Protected concrete impl of abstract methods of GenericConglomerateController class:

protected Page
getUserPageNoWait(long pageno)

protected Page
getUserPageWait(long pageno)

public int
insert(DataValueDescriptor[]
The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.
row
)

Implements org.apache.derby.iapi.store.access.ConglomerateController.insert.

Public Methods of This class:

public void
insertAndFetchLocation(DataValueDescriptor[]
The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.
row
,
RowLocation
The rowlocation to read the inserted row location into.
templateRowLocation
)

Implements org.apache.derby.iapi.store.access.ConglomerateController.insertAndFetchLocation.

insert row and fetch it's row location in one operation.

protected long
load(TransactionManager xact_manager, Heap heap, boolean createConglom, RowLocationRetRowSource rowSource)

protected boolean
lockRow(RecordHandle rh, int lock_oper, boolean wait, int lock_duration)

public boolean

Returns:

true if lock was granted, only can be false if wait was false.
lockRow
(RowLocation
The "RowLocation" which describes the exact row to lock.
loc
,
int
For what operation are we requesting the lock, this should be one of the following 4 options: LOCK_READ [read lock], (LOCK_INS | LOCK_UPD) [ lock for insert], (LOCK_INSERT_PREVKEY | LOCK_UPD) [lock for previous key to insert], (LOCK_UPD) [lock for delete or replace] (LOCK_UPD | LOCK_UPDATE_LOCKS) [lock scan for update, will upgrade lock later if actual update is take place]
lock_operation
,
boolean
Should the lock call wait to be granted?
wait
,
int
If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.
lock_duration
)

Implements org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

Lock the given row location.

public boolean

Returns:

true if lock was granted, only can be false if wait was false.
lockRow
(long
Page number of row to lock.
page_num
,
int
Record id of row on page_num to lock.
record_id
,
int
Desc of what to lock for, ie. update, insert ...
lock_operation
,
boolean
Should the lock call wait to be granted?
wait
,
int
If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.
lock_duration
)

Implements org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

Lock the given record id/page num pair.

protected boolean
public RowLocation
protected final boolean

Returns:

true, if no purging has been done on page, and thus latch can be released before end transaction. Otherwise the latch on the page can not be released before commit.
purgeCommittedDeletes
(Page
A non-null, latched page must be passed in. If all rows on page are purged, then page will be removed and latch released.
page
)

Check and purge committed deleted rows on a page.

protected void
protected void
public void
unlockRowAfterRead(RowLocation
The "RowLocation" which describes the row to unlock.
loc
,
boolean
Row was previously Locked the record for read or update.
forUpdate
,
boolean
Row was qualified and returned to the user.
row_qualified
)

Implements org.apache.derby.iapi.store.access.ConglomerateController.unlockRowAfterRead.

UnLock the given row location.

Inherited from org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController:
closecloseForEndTransactiondeletefetchfetchreplace

Constructor Detail

HeapControllerback to summary
public HeapController()

Method Detail

doInsertback to summary
private RecordHandle doInsert(DataValueDescriptor[] row) throws StandardException

Insert a new row into the heap.

Overflow policy: The current heap access method implements an algorithm that optimizes for fetch efficiency vs. space efficiency. A row will not be over flowed unless it is bigger than a page. If it is bigger than a page then it's initial part will be placed on a page and then subsequent parts will be overflowed to other pages.

Parameters
row:DataValueDescriptor[]

The row to insert.

Returns:RecordHandle

The record handle of the inserted row.

Exceptions
StandardException:
Standard exception policy.
getOpenConglomerateback to summary
public OpenConglomerate getOpenConglomerate()

Public Methods of XXXX class:

getRowPositionFromRowLocationback to summary
protected final void getRowPositionFromRowLocation(RowLocation row_loc, RowPosition pos) throws StandardException

Overrides org.apache.derby.impl.store.access.conglomerate.GenericController.getRowPositionFromRowLocation.

Protected concrete impl of abstract methods of GenericConglomerateController class:

getUserPageNoWaitback to summary
protected Page getUserPageNoWait(long pageno) throws StandardException
getUserPageWaitback to summary
protected Page getUserPageWait(long pageno) throws StandardException
insertback to summary
public int insert(DataValueDescriptor[] row) throws StandardException

Implements org.apache.derby.iapi.store.access.ConglomerateController.insert.

Public Methods of This class:

Parameters
row:DataValueDescriptor[]

Doc from org.apache.derby.iapi.store.access.ConglomerateController.insert.

The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.

Returns:int

Doc from org.apache.derby.iapi.store.access.ConglomerateController.insert.

Returns 0 if insert succeeded. Returns ConglomerateController.ROWISDUPLICATE if conglomerate supports uniqueness checks and has been created to disallow duplicates, and the row inserted had key columns which were duplicate of a row already in the table. Other insert failures will raise StandardException's.

Exceptions
StandardException:

Doc from org.apache.derby.iapi.store.access.ConglomerateController.insert.

Standard exception policy.

insertAndFetchLocationback to summary
public void insertAndFetchLocation(DataValueDescriptor[] row, RowLocation templateRowLocation) throws StandardException

Implements org.apache.derby.iapi.store.access.ConglomerateController.insertAndFetchLocation.

Doc from org.apache.derby.iapi.store.access.ConglomerateController.insertAndFetchLocation.

insert row and fetch it's row location in one operation.

Insert a row into the conglomerate, and store its location in the provided destination row location. The row location must be of the correct type for this conglomerate (a new row location of the correct type can be obtained from newRowLocationTemplate()).

Parameters
row:DataValueDescriptor[]

The row to insert into the conglomerate. The stored representations of the row's columns are copied into a new row somewhere in the conglomerate.

templateRowLocation:RowLocation

The rowlocation to read the inserted row location into.

Exceptions
StandardException:
Standard exception policy.
loadback to summary
protected long load(TransactionManager xact_manager, Heap heap, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException
lockRowback to summary
protected boolean lockRow(RecordHandle rh, int lock_oper, boolean wait, int lock_duration) throws StandardException
lockRowback to summary
public boolean lockRow(RowLocation loc, int lock_operation, boolean wait, int lock_duration) throws StandardException

Implements org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

Lock the given row location.

Should only be called by access.

This call can be made on a ConglomerateController that was opened for locking only.

RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Parameters
loc:RowLocation

The "RowLocation" which describes the exact row to lock.

lock_operation:int

Doc from org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

For what operation are we requesting the lock, this should be one of the following 4 options: LOCK_READ [read lock], (LOCK_INS | LOCK_UPD) [ lock for insert], (LOCK_INSERT_PREVKEY | LOCK_UPD) [lock for previous key to insert], (LOCK_UPD) [lock for delete or replace] (LOCK_UPD | LOCK_UPDATE_LOCKS) [lock scan for update, will upgrade lock later if actual update is take place]

wait:boolean

Should the lock call wait to be granted?

lock_duration:int

Doc from org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.

Returns:boolean

true if lock was granted, only can be false if wait was false.

Exceptions
StandardException:
Standard exception policy.
lockRowback to summary
public boolean lockRow(long page_num, int record_id, int lock_operation, boolean wait, int lock_duration) throws StandardException

Implements org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

Lock the given record id/page num pair.

Should only be called by access, to lock "special" locks formed from the Recordhandle.* reserved constants for page specific locks.

This call can be made on a ConglomerateController that was opened for locking only.

RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Parameters
page_num:long

Page number of row to lock.

record_id:int

Record id of row on page_num to lock.

lock_operation:int

Desc of what to lock for, ie. update, insert ...

wait:boolean

Should the lock call wait to be granted?

lock_duration:int

Doc from org.apache.derby.iapi.store.access.ConglomerateController.lockRow.

If set to TransactionManager.LOCK_INSTANT_DURATION, then lock will be released immediately after being granted.

Returns:boolean

true if lock was granted, only can be false if wait was false.

Exceptions
StandardException:
Standard exception policy.
lockRowAtSlotNoWaitExclusiveback to summary
protected boolean lockRowAtSlotNoWaitExclusive(RecordHandle rh) throws StandardException
newRowLocationTemplateback to summary
public RowLocation newRowLocationTemplate() throws StandardException

Overrides org.apache.derby.impl.store.access.conglomerate.GenericController.newRowLocationTemplate.

Implements org.apache.derby.iapi.store.access.ConglomerateController.newRowLocationTemplate.

Doc from org.apache.derby.iapi.store.access.ConglomerateController.newRowLocationTemplate.

Return a row location object of the correct type to be used in calls to insertAndFetchLocation.

Exceptions
StandardException:
Standard exception policy.
purgeCommittedDeletesback to summary
protected final boolean purgeCommittedDeletes(Page page) throws StandardException

Check and purge committed deleted rows on a page.

Parameters
page:Page

A non-null, latched page must be passed in. If all rows on page are purged, then page will be removed and latch released.

Returns:boolean

true, if no purging has been done on page, and thus latch can be released before end transaction. Otherwise the latch on the page can not be released before commit.

Exceptions
StandardException:
Standard exception policy.
queueDeletePostCommitWorkback to summary
protected void queueDeletePostCommitWork(RowPosition pos) throws StandardException

Overrides org.apache.derby.impl.store.access.conglomerate.GenericController.queueDeletePostCommitWork.

removePageback to summary
protected void removePage(Page page) throws StandardException
unlockRowAfterReadback to summary
public void unlockRowAfterRead(RowLocation loc, boolean forUpdate, boolean row_qualified) throws StandardException

Implements org.apache.derby.iapi.store.access.ConglomerateController.unlockRowAfterRead.

UnLock the given row location.

Should only be called by access.

This call can be made on a ConglomerateController that was opened for locking only.

RESOLVE (mikem) - move this call to ConglomerateManager so it is obvious that non-access clients should not call this.

Parameters
loc:RowLocation

The "RowLocation" which describes the row to unlock.

forUpdate:boolean

Row was previously Locked the record for read or update.

row_qualified:boolean

Doc from org.apache.derby.iapi.store.access.ConglomerateController.unlockRowAfterRead.

Row was qualified and returned to the user.

Exceptions
StandardException:
Standard exception policy.