Top Description Fields Methods
org.apache.derby.iapi.store.access

public Interface ConglomerateController

extends ConglomPropertyQueryable
Known Direct Implementers
org.apache.derby.impl.store.access.btree.BTreeController, org.apache.derby.impl.store.access.conglomerate.GenericConglomerateController, org.apache.derby.impl.store.access.heap.HeapController
Imports
org.apache.derby.iapi.store.access.RowUtil, org.apache.derby.iapi.services.io.Storable, .FormatableBitSet, org.apache.derby.iapi.types.DataValueDescriptor, .RowLocation, org.apache.derby.shared.common.error.StandardException, java.util.Properties

A conglomerate is an abstract storage structure (they correspond to access methods). The ConglomerateController interface is the interface that access manager clients can use to manipulate the contents of the underlying conglomerate.

Each conglomerate holds a set of rows. Each row has a row location. The conglomerate provides methods for:

Conglomerates do not provide any mechanism for associative access to rows within the conglomerate; this type of access is provided by scans via the ScanController interface.

Although all conglomerates have the same interface, they have different implementations. The implementation of a conglomerate determines some of its user-visible semantics; for example whether the rows are ordered or what the types of the rows' columns must be. The implementation is specified by an implementation id. Currently there are two implementations, "heap", and "btree". The details of their behavior are specified in their implementation documentation. (Currently, only "heap" is implemented).

All conglomerate operations are subject to the transactional isolation of the transaction they were opened from. Transaction rollback will close all conglomerates. Transaction commit will close all non-held conglomerates.

Scans are opened from a TransactionController.

A ConglomerateController can handle partial rows. Partial rows are described in RowUtil.

See Also
TransactionController#openConglomerate, RowUtil

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int

Method Summary

Modifier and TypeMethod and Description
public void
checkConsistency()

Check consistency of a conglomerate.

public void
close()

Close the conglomerate controller.

public boolean

Returns:

boolean indicating that the close has resulted in a real close of the controller. A held scan will return false if called by closeForEndTransaction(false), otherwise it will return true. A non-held scan will always return true.
closeForEndTransaction
(boolean
If true, means to close controller even if it has been opened to be kept opened across commit. This is used to close these controllers on abort.
closeHeldScan
)

Close conglomerate controller as part of terminating a transaction.

public void
debugConglomerate()

Dump debugging output to error log.

public boolean

Returns:

Returns true if delete was successful, false if the record pointed at no longer represents a valid record.
delete
(RowLocation loc)

Delete a row from the conglomerate.

public boolean

Returns:

Returns true if fetch was successful, false if the record pointed at no longer represents a valid record.
fetch
(RowLocation
The "RowLocation" which describes the exact row to fetch from the table.
loc
,
DataValueDescriptor[]
The row to read the data into.
destRow
,
FormatableBitSet
A description of which columns to return from row on the page into "destRow." destRow and validColumns work together to describe the row to be returned by the fetch - see RowUtil for description of how these three parameters work together to describe a fetched "row".
validColumns
)

Fetch the (partial) row at the given location.

public boolean

Returns:

Returns true if fetch was successful, false if the record pointed at no longer represents a valid record.
fetch
(RowLocation
The "RowLocation" which describes the exact row to fetch from the table.
loc
,
DataValueDescriptor[]
The row to read the data into.
destRow
,
FormatableBitSet
A description of which columns to return from row on the page into "destRow." destRow and validColumns work together to describe the row to be returned by the fetch - see RowUtil for description of how these three parameters work together to describe a fetched "row".
validColumns
,
boolean
If false, then the call will throw a lock timeout exception immediately, if the lock can not be granted without waiting. If true call will act exactly as fetch() interface with no waitForLock parameter.
waitForLock
)

Fetch the (partial) row at the given location.

public SpaceInfo
getSpaceInfo()

Get information about space used by the conglomerate.

public int

Returns:

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.
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
)

Insert a row into the conglomerate.

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.
destRowLocation
)

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

public boolean
isKeyed()

Return whether this is a keyed conglomerate.

public boolean

Returns:

true if lock was granted, only can be false if wait was false.
lockRow
(RowLocation
The "RowLocation" of 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_oper
,
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
)

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 record to lock.
page_num
,
int
record id of record to lock.
record_id
,
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_oper
,
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
)

Lock the given record id/page num pair.

public RowLocation
newRowLocationTemplate()

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

public boolean

Returns:

true if update was successful, returns false if the update fails because the record pointed at no longer represents a valid record.
replace
(RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns)

Replace the (partial) row at the given location.

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

UnLock the given row location.

Inherited from org.apache.derby.iapi.store.access.ConglomPropertyQueryable:
getInternalTablePropertySetgetTableProperties

Field Detail

LOCK_INSback to summary
public static final int LOCK_INS
LOCK_INS_PREVKEYback to summary
public static final int LOCK_INS_PREVKEY
LOCK_READback to summary
public static final int LOCK_READ
LOCK_UPDback to summary
public static final int LOCK_UPD
LOCK_UPDATE_LOCKSback to summary
public static final int LOCK_UPDATE_LOCKS
ROWISDUPLICATEback to summary
public static final int ROWISDUPLICATE

Method Detail

checkConsistencyback to summary
public void checkConsistency() throws StandardException

Check consistency of a conglomerate. Checks the consistency of the data within a given conglomerate, does not check consistency external to the conglomerate (ie. does not check that base table row pointed at by a secondary index actually exists). Raises a StandardException on first consistency problem.

Exceptions
StandardException:
Standard exception policy.
closeback to summary
public void close() throws StandardException

Close the conglomerate controller.

Close the conglomerate controller. Callers must not use the conglomerate controller after calling close. It is strongly recommended that callers clear out the reference after closing, e.g.,

ConglomerateController cc;
cc.close;
cc = null;
Exceptions
StandardException:
Standard exception policy.
closeForEndTransactionback to summary
public boolean closeForEndTransaction(boolean closeHeldScan) throws StandardException

Close conglomerate controller as part of terminating a transaction.

Use this call to close the conglomerate controller resources as part of committing or aborting a transaction. The normal close() routine may do some cleanup that is either unnecessary, or not correct due to the unknown condition of the controller following a transaction ending error. Use this call when closing all controllers as part of an abort of a transaction.

This call is meant to only be used internally by the Storage system, clients of the storage system should use the simple close() interface.

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

Parameters
closeHeldScan:boolean

If true, means to close controller even if it has been opened to be kept opened across commit. This is used to close these controllers on abort.

Returns:boolean

boolean indicating that the close has resulted in a real close of the controller. A held scan will return false if called by closeForEndTransaction(false), otherwise it will return true. A non-held scan will always return true.

Exceptions
StandardException:
Standard exception policy.
debugConglomerateback to summary
public void debugConglomerate() throws StandardException

Dump debugging output to error log.

Dump information about the conglomerate to error log. This is only for debugging purposes, does nothing in a delivered system, currently.

Exceptions
StandardException:
Standard exception policy.
deleteback to summary
public boolean delete(RowLocation loc) throws StandardException

Delete a row from the conglomerate.

Returns:boolean

Returns true if delete was successful, false if the record pointed at no longer represents a valid record.

Exceptions
StandardException:
Standard exception policy.
fetchback to summary
public boolean fetch(RowLocation loc, DataValueDescriptor[] destRow, FormatableBitSet validColumns) throws StandardException

Fetch the (partial) row at the given location.

Parameters
loc:RowLocation

The "RowLocation" which describes the exact row to fetch from the table.

destRow:DataValueDescriptor[]

The row to read the data into.

validColumns:FormatableBitSet

A description of which columns to return from row on the page into "destRow." destRow and validColumns work together to describe the row to be returned by the fetch - see RowUtil for description of how these three parameters work together to describe a fetched "row".

Returns:boolean

Returns true if fetch was successful, false if the record pointed at no longer represents a valid record.

Exceptions
StandardException:
Standard exception policy.
See Also
RowUtil
fetchback to summary
public boolean fetch(RowLocation loc, DataValueDescriptor[] destRow, FormatableBitSet validColumns, boolean waitForLock) throws StandardException

Fetch the (partial) row at the given location.

Parameters
loc:RowLocation

The "RowLocation" which describes the exact row to fetch from the table.

destRow:DataValueDescriptor[]

The row to read the data into.

validColumns:FormatableBitSet

A description of which columns to return from row on the page into "destRow." destRow and validColumns work together to describe the row to be returned by the fetch - see RowUtil for description of how these three parameters work together to describe a fetched "row".

waitForLock:boolean

If false, then the call will throw a lock timeout exception immediately, if the lock can not be granted without waiting. If true call will act exactly as fetch() interface with no waitForLock parameter.

Returns:boolean

Returns true if fetch was successful, false if the record pointed at no longer represents a valid record.

Exceptions
StandardException:
Standard exception policy.
See Also
RowUtil
getSpaceInfoback to summary
public SpaceInfo getSpaceInfo() throws StandardException

Get information about space used by the conglomerate.

insertback to summary
public int insert(DataValueDescriptor[] row) throws StandardException

Insert a row into the conglomerate.

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.

Returns:int

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:
Standard exception policy.
See Also
RowUtil
insertAndFetchLocationback to summary
public void insertAndFetchLocation(DataValueDescriptor[] row, RowLocation destRowLocation) throws StandardException

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.

destRowLocation:RowLocation

The rowlocation to read the inserted row location into.

Exceptions
StandardException:
Standard exception policy.
See Also
RowUtil
isKeyedback to summary
public boolean isKeyed()

Return whether this is a keyed conglomerate.

lockRowback to summary
public boolean lockRow(RowLocation loc, int lock_oper, boolean wait, int lock_duration) throws StandardException

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" of the exact row to lock.

lock_oper: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]

wait:boolean

Should the lock call wait to be granted?

lock_duration:int

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_oper, boolean wait, int lock_duration) throws StandardException

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 record to lock.

record_id:int

record id of record to lock.

lock_oper: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]

wait:boolean

Should the lock call wait to be granted?

lock_duration:int

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.
newRowLocationTemplateback to summary
public RowLocation newRowLocationTemplate() throws StandardException

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

Exceptions
StandardException:
Standard exception policy.
replaceback to summary
public boolean replace(RowLocation loc, DataValueDescriptor[] row, FormatableBitSet validColumns) throws StandardException

Replace the (partial) row at the given location.

Returns:boolean

true if update was successful, returns false if the update fails because the record pointed at no longer represents a valid record.

Exceptions
StandardException:
Standard exception policy.
See Also
RowUtil
unlockRowAfterReadback to summary
public void unlockRowAfterRead(RowLocation loc, boolean forUpdate, boolean row_qualified) throws StandardException

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 locked for read or update.

row_qualified:boolean

Row was qualified and returned to the user.

Exceptions
StandardException:
Standard exception policy.