|
||||||||||
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
org.apache.derby.impl.store.access.btree.index.B2I
Implements an instance of a B-Tree secondary index conglomerate. A B2I object has two roles.
openScan
should be called.
Field Summary | |
private static int |
BASE_MEMORY_USAGE
|
protected long |
baseConglomerateId
The id of the conglomerate which contains the base table. |
static int |
FORMAT_NUMBER
|
static java.lang.String |
PROPERTY_BASECONGLOMID
|
static java.lang.String |
PROPERTY_ROWLOCCOLUMN
|
protected int |
rowLocationColumn
The column id (zero-based integer index) of the column which holds the row location to the base conglomerate. |
Fields inherited from class org.apache.derby.impl.store.access.btree.BTree |
ascDescInfo, conglom_format_id, id, nKeyFields, PROPERTY_ALLOWDUPLICATES, PROPERTY_MAX_ROWS_PER_PAGE_PARAMETER, PROPERTY_NKEYFIELDS, PROPERTY_NUNIQUECOLUMNS, PROPERTY_PARENTLINKS, 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 | |
B2I()
|
Method Summary | |
void |
compressConglomerate(TransactionManager xact_manager,
Transaction rawtran)
|
void |
create(TransactionManager xact_manager,
int segmentId,
long input_conglomid,
DataValueDescriptor[] template,
ColumnOrdering[] columnOrder,
java.util.Properties properties,
int temporaryFlag)
Create an empty secondary index b-tree, using the generic b-tree to do the generic part of the creation process. |
ScanManager |
defragmentConglomerate(TransactionManager xact_manager,
Transaction rawtran,
boolean hold,
int open_mode,
int lock_level,
LockingPolicy locking_policy,
int isolation_level)
Open a b-tree compress scan. |
void |
drop(TransactionManager xact_manager)
Drop this b-tree secondary index. |
int |
estimateMemoryUsage()
Estimate the memory usage in bytes of the data value and the overhead of the class. |
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)
Retrieve the maximum value row in an ordered conglomerate. |
protected 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. |
StaticCompiledOpenConglomInfo |
getStaticCompiledConglomInfo(TransactionController xact_manager,
long conglomId)
Return static information about the conglomerate to be included in a a compiled plan. |
int |
getTypeFormatId()
Return my format identifier. |
long |
load(TransactionManager xact_manager,
boolean createConglom,
RowLocationRetRowSource rowSource)
Bulk Load a B-tree secondary index. |
private void |
localReadExternal(java.io.ObjectInput in)
Restore the in-memory representation from the stream. |
ConglomerateController |
lockTable(TransactionManager xact_manager,
int open_mode,
int lock_level,
int isolation_level)
Lock the base table. |
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. |
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 b-tree secondary index scan controller. |
StoreCostController |
openStoreCost(TransactionManager xact_manager,
Transaction rawtran)
Return an open StoreCostController for the conglomerate. |
void |
purgeConglomerate(TransactionManager xact_manager,
Transaction rawtran)
|
void |
readExternal_v36(java.io.ObjectInput in)
Restore the in-memory representation from the stream. |
void |
readExternal(java.io.ObjectInput in)
Restore the in-memory representation from the stream. |
void |
readExternalFromArray(ArrayInputStream in)
Read the DataValueDescriptor from the stream. |
private void |
traverseRight()
Private methods of B2I, arranged alphabetically. |
void |
writeExternal_v36(java.io.ObjectOutput out)
Store the stored representation of the column value in the stream. |
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.btree.BTree |
addColumn, create, createTemplate, getContainerid, getDynamicCompiledConglomInfo, getId, isNull, isTemporary, isUnique, restoreToNull, toString |
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.types.DataValueDescriptor |
checkHostVariable, coalesce, compare, equals, 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 java.lang.String PROPERTY_BASECONGLOMID
public static final java.lang.String PROPERTY_ROWLOCCOLUMN
public static final int FORMAT_NUMBER
protected long baseConglomerateId
protected int rowLocationColumn
private static final int BASE_MEMORY_USAGE
Constructor Detail |
public B2I()
Method Detail |
public int estimateMemoryUsage()
DataValueDescriptor
protected BTreeLockingPolicy getBtreeLockingPolicy(Transaction rawtran, int lock_level, int mode, int isolation_level, ConglomerateController base_cc, OpenBTree open_btree) throws StandardException
getBtreeLockingPolicy
in class BTree
StandardException
- Standard exception policy.public final 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.
lockTable
in class BTree
xact_manager
- Transaction to associate the lock with.
StandardException
- Standard exception policy.private void traverseRight()
public void create(TransactionManager xact_manager, int segmentId, long input_conglomid, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, java.util.Properties properties, int temporaryFlag) throws StandardException
StandardException
- Standard exception policy.BTree.create(org.apache.derby.iapi.store.raw.Transaction, int, long, org.apache.derby.iapi.types.DataValueDescriptor[], java.util.Properties, int, int)
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
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.
xact_manager
- The TransactionController under which this
operation takes place.conglomId
- The identifier of the conglomerate
to open the scan for.open_mode
- Specifiy flags to control opening of table.
OPENMODE_FORUPDATE - if set open the table for
update otherwise open table shared.lock_level
- One of (MODE_TABLE, MODE_RECORD, or MODE_NONE).isolation_level
- The isolation level to lock the conglomerate at.
One of (ISOLATION_READ_COMMITTED or ISOLATION_SERIALIZABLE).scanColumnList
- A description of which columns to return from
every fetch in the scan. template,
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
- The row to retrieve the maximum value into.rawtran
- The raw store xact to associate all ops with.locking_policy
- The LockingPolicy to use to open the conglomerate.
StandardException
- Standard exception policy.public long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException
load
in interface Conglomerate
load
in class BTree
StandardException
- Standard Cloudscape Error policy.
raise SQLState.STORE_CONGLOMERATE_DUPLICATE_KEY_EXCEPTION if a duplicate
key is detected in the load.Conglomerate.load(org.apache.derby.iapi.store.access.conglomerate.TransactionManager, boolean, org.apache.derby.iapi.store.access.RowLocationRetRowSource)
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
in interface Conglomerate
open
in class BTree
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 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
StandardException
- Standard exception policy.Conglomerate.openScan(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, int, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.types.DataValueDescriptor[], int, org.apache.derby.iapi.store.access.Qualifier[][], org.apache.derby.iapi.types.DataValueDescriptor[], int, org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo, org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo)
,
Conglomerate.openScan(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, int, org.apache.derby.iapi.services.io.FormatableBitSet, org.apache.derby.iapi.types.DataValueDescriptor[], int, org.apache.derby.iapi.store.access.Qualifier[][], org.apache.derby.iapi.types.DataValueDescriptor[], int, org.apache.derby.iapi.store.access.StaticCompiledOpenConglomInfo, org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo)
public ScanManager defragmentConglomerate(TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level) throws StandardException
B2I does not support a compress scan.
hold
- see openScan()open_mode
- see openScan()lock_level
- see openScan()isolation_level
- see openScan()
StandardException
- Standard exception policy.Conglomerate.defragmentConglomerate(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, int)
public void purgeConglomerate(TransactionManager xact_manager, Transaction rawtran) throws StandardException
StandardException
public void compressConglomerate(TransactionManager xact_manager, Transaction rawtran) throws StandardException
StandardException
public StoreCostController openStoreCost(TransactionManager xact_manager, Transaction rawtran) throws StandardException
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.
xact_manager
- The TransactionController under which this
operation takes place.rawtran
- raw transaction context in which scan is managed.
StandardException
- Standard exception policy.StoreCostController
public void drop(TransactionManager xact_manager) throws StandardException
drop
in interface Conglomerate
drop
in class BTree
StandardException
- Standard exception policy.Conglomerate.drop(org.apache.derby.iapi.store.access.conglomerate.TransactionManager)
,
BTree.drop(org.apache.derby.iapi.store.access.conglomerate.TransactionManager)
public StaticCompiledOpenConglomInfo getStaticCompiledConglomInfo(TransactionController xact_manager, long conglomId) throws StandardException
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.
conglomId
- The identifier of the conglomerate to open.xact_manager
- The TransactionController under which this operation
takes place.
StandardException
- Standard exception policy.public int getTypeFormatId()
TypedFormat.getTypeFormatId()
public void writeExternal_v36(java.io.ObjectOutput out) throws java.io.IOException
java.io.IOException
public void readExternal_v36(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
Externalizable.readExternal(java.io.ObjectInput)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
in interface java.io.Externalizable
writeExternal
in class BTree
java.io.IOException
- thrown by writeObject()private final void localReadExternal(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
Externalizable.readExternal(java.io.ObjectInput)
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
BTree
readExternal
in interface java.io.Externalizable
readExternal
in class BTree
java.io.IOException
- thrown by readObject()
java.lang.ClassNotFoundException
- Thrown if the stored representation is
serialized and a class named in the stream could not be found.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().
readExternalFromArray
in interface DataValueDescriptor
readExternalFromArray
in class BTree
java.io.IOException
java.lang.ClassNotFoundException
|
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 |