|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.derby.iapi.types.DataType
org.apache.derby.impl.store.access.conglomerate.GenericConglomerate
org.apache.derby.impl.store.access.btree.BTree
A b-tree object corresponds to an instance of a b-tree conglomerate. It contains the static information about a conglomerate which is built at create conglomerate time.
This generic implementation is expected to be extended by the concreate implementations.
The fields are set when the conglomerate is created and never changed thereafter. When alter table is supported then it will change under the control of a table level lock.
They have package scope because they're read by the scans and controllers.
A table of all conglomerates in the system is maintained by the accessmanager. A cache of conglomerates is maintained in the accessmanager, and references to the read only objects are handed out. A copy of the Conglomerate object is kept in the control row of the root page, so that during logical undo this information can be read without needing to access the possibly corrupt table maintained by the access manager.
Field Summary | |
(package private) boolean |
allowDuplicates
Whether the index allows duplicates or not. |
protected boolean[] |
ascDescInfo
|
protected int |
conglom_format_id
Format id of the conglomerate. |
(package private) int[] |
format_ids
The array of format id's, one for each column in the template. |
protected ContainerKey |
id
The id of the container in which this b-tree is stored. |
(package private) boolean |
maintainParentLinks
Whether the parent should maintain links from child pages to their parent. |
(package private) static int |
maxRowsPerPage
Maximum rows per page to place on a btree leaf or nonleaf page. |
protected int |
nKeyFields
The number of key fields. |
(package private) int |
nUniqueColumns
The number of uniqueness columns. |
static java.lang.String |
PROPERTY_ALLOWDUPLICATES
|
static java.lang.String |
PROPERTY_MAX_ROWS_PER_PAGE_PARAMETER
Property name for the maximum number of rows to place in a btree page (leaf or branch). |
static java.lang.String |
PROPERTY_NKEYFIELDS
|
static java.lang.String |
PROPERTY_NUNIQUECOLUMNS
|
static java.lang.String |
PROPERTY_PARENTLINKS
|
static long |
ROOTPAGEID
The page number of the root page is always at the fixed page number: ROOTPAGEID. |
Fields inherited from interface org.apache.derby.iapi.types.Orderable |
ORDER_OP_EQUALS, ORDER_OP_GREATEROREQUALS, ORDER_OP_GREATERTHAN, ORDER_OP_LESSOREQUALS, ORDER_OP_LESSTHAN |
Constructor Summary | |
BTree()
|
Method Summary | |
void |
addColumn(TransactionManager xact_manager,
int column_id,
Storable template_column)
Add a column to the conglomerate. |
void |
create(Transaction rawtran,
int segmentId,
long input_containerid,
DataValueDescriptor[] template,
java.util.Properties properties,
int conglom_format_id,
int tmpFlag)
Do the generic part of creating a b-tree conglomerate. |
(package private) DataValueDescriptor[] |
createBranchTemplate(DataValueDescriptor page_ptr)
Create a branch row template for this conglomerate. |
DataValueDescriptor[] |
createTemplate()
Create a template for this conglomerate. |
abstract void |
drop(TransactionManager xact_manager)
Drop this btree. |
protected abstract BTreeLockingPolicy |
getBtreeLockingPolicy(Transaction rawtran,
int lock_level,
int mode,
int isolation_level,
ConglomerateController base_cc,
OpenBTree open_btree)
Create a new btree locking policy from scratch. |
long |
getContainerid()
Get the containerid of conglomerate. |
DynamicCompiledOpenConglomInfo |
getDynamicCompiledConglomInfo(long conglomId)
Return dynamic information about the conglomerate to be dynamically reused in repeated execution of a statement. |
ContainerKey |
getId()
Get the id of the container of the conglomerate. |
boolean |
isNull()
Return whether the value is null or not. |
boolean |
isTemporary()
Is this conglomerate temporary? |
boolean |
isUnique()
Is this a "unique" index? |
abstract long |
load(TransactionManager xact_manager,
boolean createConglom,
RowLocationRetRowSource rowSource)
Load a b-tree. |
abstract ConglomerateController |
lockTable(TransactionManager xact_manager,
int open_mode,
int lock_level,
int isolation_level)
Lock the base table. |
abstract ConglomerateController |
open(TransactionManager xact_manager,
Transaction rawtran,
boolean hold,
int open_mode,
int lock_level,
LockingPolicy locking_policy,
StaticCompiledOpenConglomInfo static_info,
DynamicCompiledOpenConglomInfo dynamic_info)
Open a b-tree controller. |
void |
readExternal(java.io.ObjectInput in)
Restore the in-memory representation from the stream. |
void |
readExternalFromArray(ArrayInputStream in)
Read the DataValueDescriptor from the stream. |
void |
restoreToNull()
Restore the in-memory representation to the null value. |
java.lang.String |
toString()
Public toString() Method: |
void |
writeExternal(java.io.ObjectOutput out)
Store the stored representation of the column value in the stream. |
Methods inherited from class org.apache.derby.impl.store.access.conglomerate.GenericConglomerate |
compare, getClone, getLength, getNewNull, getObject, getString, getTypeName, setFrom, setValue, setValueFromResultSet |
Methods inherited from class org.apache.derby.iapi.types.DataType |
checkHostVariable, cloneObject, coalesce, compare, dataTypeConversion, equals, equals, flip, genericSetObject, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getNationalString, getShort, getStream, getTime, getTimestamp, greaterOrEquals, greaterThan, in, invalidFormat, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, outOfRange, setBigDecimal, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, throwLangSetMismatch, typePrecedence, typeToBigDecimal |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.apache.derby.iapi.store.access.conglomerate.Conglomerate |
compressConglomerate, defragmentConglomerate, fetchMaxOnBTree, getStaticCompiledConglomInfo, openScan, openStoreCost, purgeConglomerate |
Methods inherited from interface org.apache.derby.iapi.services.io.TypedFormat |
getTypeFormatId |
Methods inherited from interface org.apache.derby.iapi.types.DataValueDescriptor |
checkHostVariable, coalesce, compare, equals, estimateMemoryUsage, getBoolean, getByte, getBytes, getDate, getDouble, getFloat, getInt, getLong, getShort, getStream, getTime, getTimestamp, greaterOrEquals, greaterThan, in, isNotNull, isNullOp, lessOrEquals, lessThan, normalize, notEquals, setBigDecimal, setInto, setInto, setObjectForCast, setToNull, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, typePrecedence, typeToBigDecimal |
Field Detail |
public static final long ROOTPAGEID
public static final java.lang.String PROPERTY_MAX_ROWS_PER_PAGE_PARAMETER
public static final java.lang.String PROPERTY_ALLOWDUPLICATES
public static final java.lang.String PROPERTY_NKEYFIELDS
public static final java.lang.String PROPERTY_NUNIQUECOLUMNS
public static final java.lang.String PROPERTY_PARENTLINKS
protected ContainerKey id
protected int nKeyFields
int nUniqueColumns
boolean allowDuplicates
boolean maintainParentLinks
static int maxRowsPerPage
protected int conglom_format_id
int[] format_ids
protected boolean[] ascDescInfo
Constructor Detail |
public BTree()
Method Detail |
protected abstract BTreeLockingPolicy getBtreeLockingPolicy(Transaction rawtran, int lock_level, int mode, int isolation_level, ConglomerateController base_cc, OpenBTree open_btree) throws StandardException
StandardException
- Standard exception policy.public abstract ConglomerateController lockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level) throws StandardException
Assumes that segment of the base container is the same as the segment of the btree segment.
RESOLVE - we really want to get the lock without opening the container. raw store will be providing this.
xact_manager
- Transaction to associate the lock with.
StandardException
- Standard exception policy.final DataValueDescriptor[] createBranchTemplate(DataValueDescriptor page_ptr) throws StandardException
Reads the format id's of each of the columns and manufactures object of the given type for each. It then uses these "empty" objects to create a template row. The object passed in is then added to the last column of the row.
StandardException
- Standard exception policy.public final DataValueDescriptor[] createTemplate() throws StandardException
Reads the format id's of each of the columns and manufactures object of the given type for each. It then uses these "empty" objects to create a template row.
This method is public so that B2IUndo() can call it.
StandardException
- Standard exception policy.public final boolean isUnique()
public void addColumn(TransactionManager xact_manager, int column_id, Storable template_column) throws StandardException
Currently B2I does not support this operation. input template column.
xact_manager
- Transaction to associate the lock with.column_id
- The column number to add this column at.template_column
- An instance of the column to be added to table.
StandardException
- Standard exception policy.public final ContainerKey getId()
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.
public void create(Transaction rawtran, int segmentId, long input_containerid, DataValueDescriptor[] template, java.util.Properties properties, int conglom_format_id, int tmpFlag) throws StandardException
This method processes all properties which are generic to all BTree's. It creates the container for the btree.
The following properties are generic to a b-tree conglomerate. :
StandardException
- Thrown by underlying raw store, or thrown by
this routine on an invalid containerid.public abstract void drop(TransactionManager xact_manager) throws StandardException
StandardException
- Standard exception policy.Conglomerate.drop(org.apache.derby.iapi.store.access.conglomerate.TransactionManager)
public abstract long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException
xact_manager
- The TransactionController under which this operation
takes place.createConglom
- 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
- Where the rows come from.
StandardException
- Standard exception policy.Conglomerate.load(org.apache.derby.iapi.store.access.conglomerate.TransactionManager, boolean, org.apache.derby.iapi.store.access.RowLocationRetRowSource)
public long getContainerid()
Conglomerate
Will have to change when a conglomerate could have more than one containerid.
public DynamicCompiledOpenConglomInfo getDynamicCompiledConglomInfo(long conglomId) throws StandardException
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, ...
conglomId
- The identifier of the conglomerate to open.
StandardException
- Standard exception policy.public boolean isTemporary()
public abstract 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
xact_manager
- The access xact to associate all ops on cc with.rawtran
- The raw store xact to associate all ops on cc with.open_mode
- A bit mask of TransactionController.MODE_* bits,
indicating info about the open.lock_level
- Either TransactionController.MODE_TABLE or
TransactionController.MODE_RECORD, as passed into
the openConglomerate() call.locking_policy
- The LockingPolicy to use to open the conglomerate.
StandardException
- Standard exception policy.Conglomerate.open(org.apache.derby.iapi.store.access.conglomerate.TransactionManager, org.apache.derby.iapi.store.raw.Transaction, boolean, int, int, org.apache.derby.iapi.store.raw.LockingPolicy, org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo, org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo)
public boolean isNull()
Storable.isNull()
public void restoreToNull()
Storable.restoreToNull()
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
- Thrown if the stored representation is
serialized and a class named in the stream could not be found.
java.io.IOException
- thrown by readObject()Externalizable.readExternal(java.io.ObjectInput)
public void readExternalFromArray(ArrayInputStream in) throws java.io.IOException, java.lang.ClassNotFoundException
DataValueDescriptor
Initialize the data value by reading it's values from the ArrayInputStream. This interface is provided as a way to achieve possible performance enhancement when reading an array can be optimized over reading from a generic stream from readExternal().
in
- The array stream positioned at the beginning of the
byte stream to read from.
java.lang.ClassNotFoundException
- If a necessary class can not be
found while reading the object from
the stream.
java.io.IOException
- Usual error is if you try to read
past limit on the stream.public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
java.io.IOException
- thrown by writeObject()public java.lang.String toString()
|
Built on Mon 2007-06-04 09:58:47+0400, from revision ??? | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |