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

public Interface Conglomerate

extends Storable, DataValueDescriptor
Known Direct Implementers
org.apache.derby.impl.store.access.conglomerate.GenericConglomerate, org.apache.derby.impl.store.access.heap.Heap
Imports
org.apache.derby.shared.common.error.StandardException, org.apache.derby.iapi.store.access.ConglomerateController, .DynamicCompiledOpenConglomInfo, .Qualifier, .RowLocationRetRowSource, .StoreCostController, .StaticCompiledOpenConglomInfo, .TransactionController, org.apache.derby.iapi.store.raw.ContainerKey, .LockingPolicy, .Transaction, org.apache.derby.iapi.types.DataValueDescriptor, org.apache.derby.iapi.services.io.Storable, .FormatableBitSet

A conglomerate is an abstract storage structure (they correspond to access methods). The Conglomerate interface corresponds to a single instance of a conglomerate. In other words, for each conglomerate in the system, there will be one object implementing Conglomerate.

The Conglomerate interface is implemented by each access method. The implementation must maintain enough information to properly open the conglomerate and scans, and to drop the conglomerate. This information typically will include the id of the container or containers in which the conglomerate is stored, and my also include property information.

Conglomerates are created by a conglomerate factory. The access manager stores them in a directory (which is why they implement Storable).

Field Summary

Inherited from org.apache.derby.iapi.types.DataValueDescriptor:
UNKNOWN_LOGICAL_LENGTH

Method Summary

Modifier and TypeMethod and Description
public void
addColumn(TransactionManager
The TransactionController under which this operation takes place.
xact_manager
,
int
The column number to add this column at.
column_id
,
Storable
An instance of the column to be added to table.
template_column
,
int
Collation id of the added column.
collation_id
)

Add a column to the conglomerate.

public void
public ScanManager

Returns:

The GroupFetchScanController to be used to fetch the rows.
defragmentConglomerate
(TransactionManager xact_manager, Transaction rawtran, boolean
see openScan()
hold
,
int
see openScan()
open_mode
,
int
see openScan()
lock_level
,
LockingPolicy locking_policy, int
see openScan()
isolation_level
)

Online compress table.

public void
drop(TransactionManager xact_manager)

Drop this conglomerate.

public boolean

Returns:

boolean indicating if a row was found and retrieved or not.
fetchMaxOnBTree
(TransactionManager
The TransactionController under which this operation takes place.
xact_manager
,
Transaction
The raw store xact to associate all ops with.
rawtran
,
long
The identifier of the conglomerate to open the scan for.
conglomId
,
int
Specifiy flags to control opening of table. OPENMODE_FORUPDATE - if set open the table for update otherwise open table shared.
open_mode
,
int
One of (MODE_TABLE, MODE_RECORD, or MODE_NONE).
lock_level
,
LockingPolicy
The LockingPolicy to use to open the conglomerate.
locking_policy
,
int
The isolation level to lock the conglomerate at. One of (ISOLATION_READ_COMMITTED, ISOLATION_REPEATABLE_READ, or ISOLATION_SERIALIZABLE).
isolation_level
,
FormatableBitSet
A description of which columns to return from every fetch in the scan. fetchRow and scanColumnList work together to describe the row to be returned by the scan - see RowUtil for description of how these three parameters work together to describe a "row".
scanColumnList
,
DataValueDescriptor[]
The row to retrieve the maximum value into.
fetchRow
)

Retrieve the maximum value row in an ordered conglomerate.

public long

Returns:

The containerid.
getContainerid
()

Get the containerid of conglomerate.

public DynamicCompiledOpenConglomInfo

Returns:

The dynamic information.
getDynamicCompiledConglomInfo
()

Return dynamic information about the conglomerate to be dynamically reused in repeated execution of a statement.

public ContainerKey

Returns:

The ContainerKey.
getId
()

Get the id of the container of the conglomerate.

public StaticCompiledOpenConglomInfo

Returns:

The static compiled information.
getStaticCompiledConglomInfo
(TransactionController
The TransactionController under which this operation takes place.
tc
,
long
The identifier of the conglomerate to open.
conglomId
)

Return static information about the conglomerate to be included in a a compiled plan.

public boolean

Returns:

whether conglomerate is temporary or not.
isTemporary
()

Is this conglomerate temporary?

public long

Returns:

The number of rows loaded.
load
(TransactionManager
The TransactionController under which this operation takes place.
xact_manager
,
boolean
If true, the conglomerate is being created in the same operation as the openAndLoadConglomerate. The enables further optimization as recovery does not require page allocation to be logged.
createConglom
,
RowLocationRetRowSource
Where the rows come from.
rowSource
)

Bulk load into the conglomerate.

public ConglomerateController

Returns:

The open ConglomerateController.
open
(TransactionManager
The access xact to associate all ops on cc with.
xact_manager
,
Transaction
The raw store xact to associate all ops on cc with.
rawtran
,
boolean hold, int
A bit mask of TransactionController.MODE_* bits, indicating info about the open.
open_mode
,
int
Either TransactionController.MODE_TABLE or TransactionController.MODE_RECORD, as passed into the openConglomerate() call.
lock_level
,
LockingPolicy
The LockingPolicy to use to open the conglomerate.
locking_policy
,
StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info)

Open a conglomerate controller.

public ScanManager
openScan(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info)

Open a scan controller.

public StoreCostController

Returns:

The open StoreCostController.
openStoreCost
(TransactionManager
The TransactionController under which this operation takes place.
xact_manager
,
Transaction
raw transaction context in which scan is managed.
rawtran
)

Return an open StoreCostController for the conglomerate.

public void
Inherited from org.apache.derby.iapi.services.io.Storable:
isNullrestoreToNull
Inherited from org.apache.derby.iapi.types.DataValueDescriptor:
checkHostVariablecloneHoldercloneValuecoalescecomparecomparecomparecompareequalsestimateMemoryUsagegetBooleangetBytegetBytesgetDategetDoublegetFloatgetIntgetLengthgetLonggetNewNullgetObjectgetShortgetStreamgetStringgetTimegetTimestampgetTraceStringgetTypeNamegreaterOrEqualsgreaterThanhasStreaminisNotNullisNullOplessOrEqualslessThannormalizenotEqualsreadExternalFromArrayrecyclesetBigDecimalsetIntosetIntosetObjectForCastsetToNullsetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValuesetValueFromResultSettypePrecedencetypeToBigDecimal

Method Detail

addColumnback to summary
public void addColumn(TransactionManager xact_manager, int column_id, Storable template_column, int collation_id) throws StandardException

Add a column to the conglomerate.

This routine update's the in-memory object version of the Conglomerate to have one more column of the type described by the input template column. Note that not all conglomerates may support this feature.

Parameters
xact_manager:TransactionManager

The TransactionController under which this operation takes place.

column_id:int

The column number to add this column at.

template_column:Storable

An instance of the column to be added to table.

collation_id:int

Collation id of the added column.

Exceptions
StandardException:
Standard exception policy.
compressConglomerateback to summary
public void compressConglomerate(TransactionManager xact_manager, Transaction rawtran) throws StandardException
defragmentConglomerateback to summary
public ScanManager defragmentConglomerate(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level) throws StandardException

Online compress table. Returns a ScanManager which can be used to move rows around in a table, creating a block of free pages at the end of the table. The process of executing the scan will move rows from the end of the table toward the beginning. The GroupFetchScanController will return the old row location, the new row location, and the actual data of any row moved. Note that this scan only returns moved rows, not an entire set of rows, the scan is designed specifically to be used by either explicit user call of the SYSCS_ONLINE_COMPRESS_TABLE() procedure, or internal background calls to compress the table. The old and new row locations are returned so that the caller can update any indexes necessary. This scan always returns all collumns of the row. All inputs work exactly as in openScan(). The return is a GroupFetchScanController, which only allows fetches of groups of rows from the conglomerate.

Note that all Conglomerates may not implement openCompressScan(), currently only the Heap conglomerate implements this scan.

Parameters
hold:boolean

see openScan()

open_mode:int

see openScan()

lock_level:int

see openScan()

isolation_level:int

see openScan()

Returns:ScanManager

The GroupFetchScanController to be used to fetch the rows.

Exceptions
StandardException:
Standard exception policy.
dropback to summary
public void drop(TransactionManager xact_manager) throws StandardException

Drop this conglomerate.

Exceptions
StandardException:
Standard exception policy.
fetchMaxOnBTreeback to summary
public boolean fetchMaxOnBTree(TransactionManager xact_manager, Transaction rawtran, long conglomId, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] fetchRow) throws StandardException

Retrieve the maximum value row in an ordered conglomerate.

Returns true and fetches the rightmost row of an ordered conglomerate into "fetchRow" if there is at least one row in the conglomerate. If there are no rows in the conglomerate it returns false.

Non-ordered conglomerates will not implement this interface, calls will generate a StandardException.

RESOLVE - this interface is temporary, long term equivalent (and more) functionality will be provided by the openBackwardScan() interface.

Parameters
xact_manager:TransactionManager

The TransactionController under which this operation takes place.

rawtran:Transaction

The raw store xact to associate all ops with.

conglomId:long

The identifier of the conglomerate to open the scan for.

open_mode:int

Specifiy flags to control opening of table. OPENMODE_FORUPDATE - if set open the table for update otherwise open table shared.

lock_level:int

One of (MODE_TABLE, MODE_RECORD, or MODE_NONE).

locking_policy:LockingPolicy

The LockingPolicy to use to open the conglomerate.

isolation_level:int

The isolation level to lock the conglomerate at. One of (ISOLATION_READ_COMMITTED, ISOLATION_REPEATABLE_READ, or ISOLATION_SERIALIZABLE).

scanColumnList:FormatableBitSet

A description of which columns to return from every fetch in the scan. fetchRow and scanColumnList work together to describe the row to be returned by the scan - see RowUtil for description of how these three parameters work together to describe a "row".

fetchRow:DataValueDescriptor[]

The row to retrieve the maximum value into.

Returns:boolean

boolean indicating if a row was found and retrieved or not.

Exceptions
StandardException:
Standard exception policy.
getContaineridback to summary
public long getContainerid()

Get the containerid of conglomerate.

Will have to change when a conglomerate could have more than one containerid.

Returns:long

The containerid.

getDynamicCompiledConglomInfoback to summary
public DynamicCompiledOpenConglomInfo getDynamicCompiledConglomInfo() throws StandardException

Return dynamic information about the conglomerate to be dynamically reused in repeated execution of a statement.

The dynamic info is a set of variables to be used in a given ScanController or ConglomerateController. It can only be used in one controller at a time. It is up to the caller to insure the correct thread access to this info. The type of info in this is a scratch template for btree traversal, other scratch variables for qualifier evaluation, ...

Returns:DynamicCompiledOpenConglomInfo

The dynamic information.

Exceptions
StandardException:
Standard exception policy.
getIdback to summary
public ContainerKey getId()

Get the id of the container of the conglomerate.

Will have to change when a conglomerate could have more than one container. The ContainerKey is a combination of the container id and segment id.

Returns:ContainerKey

The ContainerKey.

getStaticCompiledConglomInfoback to summary
public StaticCompiledOpenConglomInfo getStaticCompiledConglomInfo(TransactionController tc, long conglomId) throws StandardException

Return static information about the conglomerate to be included in a a compiled plan.

The static info would be valid until any ddl was executed on the conglomid, and would be up to the caller to throw away when that happened. This ties in with what language already does for other invalidation of static info. The type of info in this would be containerid and array of format id's from which templates can be created. The info in this object is read only and can be shared among as many threads as necessary.

Parameters
tc:TransactionController

The TransactionController under which this operation takes place.

conglomId:long

The identifier of the conglomerate to open.

Returns:StaticCompiledOpenConglomInfo

The static compiled information.

Exceptions
StandardException:
Standard exception policy.
isTemporaryback to summary
public boolean isTemporary()

Is this conglomerate temporary?

Returns:boolean

whether conglomerate is temporary or not.

loadback to summary
public long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException

Bulk load into the conglomerate.

Individual rows that are loaded into the conglomerate are not logged. After this operation, the underlying database must be backed up with a database backup rather than an transaction log backup (when we have them). This warning is put here for the benefit of future generation.

Parameters
xact_manager:TransactionManager

The TransactionController under which this operation takes place.

createConglom:boolean

If true, the conglomerate is being created in the same operation as the openAndLoadConglomerate. The enables further optimization as recovery does not require page allocation to be logged.

rowSource:RowLocationRetRowSource

Where the rows come from.

Returns:long

The number of rows loaded.

Exceptions
StandardException:
Standard exception policy. If conglomerage supports uniqueness checks and has been created to disallow duplicates, and one of the rows being loaded had key columns which were duplicate of a row already in the conglomerate, then raise SQLState.STORE_CONGLOMERATE_DUPLICATE_KEY_EXCEPTION.
openback to summary
public ConglomerateController open(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException

Open a conglomerate controller.

Parameters
xact_manager:TransactionManager

The access xact to associate all ops on cc with.

rawtran:Transaction

The raw store xact to associate all ops on cc with.

open_mode:int

A bit mask of TransactionController.MODE_* bits, indicating info about the open.

lock_level:int

Either TransactionController.MODE_TABLE or TransactionController.MODE_RECORD, as passed into the openConglomerate() call.

locking_policy:LockingPolicy

The LockingPolicy to use to open the conglomerate.

Returns:ConglomerateController

The open ConglomerateController.

Exceptions
StandardException:
Standard exception policy.
See Also
TransactionController
openScanback to summary
public ScanManager openScan(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level, FormatableBitSet scanColumnList, DataValueDescriptor[] startKeyValue, int startSearchOperator, Qualifier[][] qualifier, DataValueDescriptor[] stopKeyValue, int stopSearchOperator, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException

Open a scan controller.

Exceptions
StandardException:
Standard exception policy.
openStoreCostback to summary
public StoreCostController openStoreCost(TransactionManager xact_manager, Transaction rawtran) throws StandardException

Return an open StoreCostController for the conglomerate.

Return an open StoreCostController which can be used to ask about the estimated row counts and costs of ScanController and ConglomerateController operations, on the given conglomerate.

Parameters
xact_manager:TransactionManager

The TransactionController under which this operation takes place.

rawtran:Transaction

raw transaction context in which scan is managed.

Returns:StoreCostController

The open StoreCostController.

Exceptions
StandardException:
Standard exception policy.
See Also
StoreCostController
purgeConglomerateback to summary
public void purgeConglomerate(TransactionManager xact_manager, Transaction rawtran) throws StandardException