| org.apache.derby.impl.store.access.btree.BTree org.apache.derby.impl.store.access.btree.index.B2I
B2I | public class B2I extends BTree (Code) | | Implements an instance of a B-Tree secondary index conglomerate.
A B2I object has two roles.
-
The B2I object is stored on disk, and holds the store specific
information needed to access/describe the conglomerate. This
includes information such as the format ids of the columns,
the conglomerate id of the base table, the location of
row location column.
-
Access to all the interfaces start by making a call off the
Conglomerate interface. So for instance to get a scan on the
conglomerate method
B2I.openScan openScan should be called.
|
Method Summary | |
public void | compressConglomerate(TransactionManager xact_manager, Transaction rawtran) | public void | create(TransactionManager xact_manager, int segmentId, long input_conglomid, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, 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.
This routine opens the newly created container, adds a single page, and
makes this page the root by inserting a LeafControlRow onto this page
at slot 0 and marking in that control row that the page is a root page.
The following properties are specific to the b-tree secondary index:
- "baseConglomerateId" (integer).
| public 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. | public void | drop(TransactionManager xact_manager) Drop this b-tree secondary index. | public int | estimateMemoryUsage() | 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) 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. | 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. | public StaticCompiledOpenConglomInfo | getStaticCompiledConglomInfo(TransactionController xact_manager, long conglomId) 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. | public int | getTypeFormatId() Return my format identifier. | public long | load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) Bulk Load a B-tree secondary index. | final public ConglomerateController | lockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level) Lock the base table. | 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) Open a b-tree 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 b-tree secondary index scan controller. | public StoreCostController | openStoreCost(TransactionManager xact_manager, Transaction rawtran) 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 - The TransactionController under which this operation takes place. Parameters: rawtran - raw transaction context in which scan is managed. | public void | purgeConglomerate(TransactionManager xact_manager, Transaction rawtran) | public void | readExternal(ObjectInput in) | public void | readExternalFromArray(ArrayInputStream in) | public void | readExternal_v36(ObjectInput in) Restore the in-memory representation from the stream. | public void | writeExternal(ObjectOutput out) Store the stored representation of the column value in the stream. | public void | writeExternal_v36(ObjectOutput out) Store the stored representation of the column value in the stream. |
FORMAT_NUMBER | final public static int FORMAT_NUMBER(Code) | | |
PROPERTY_BASECONGLOMID | final public static String PROPERTY_BASECONGLOMID(Code) | | |
PROPERTY_ROWLOCCOLUMN | final public static String PROPERTY_ROWLOCCOLUMN(Code) | | |
baseConglomerateId | protected long baseConglomerateId(Code) | | The id of the conglomerate which contains the base table.
Row locations inserted into this secondary index are assumed
to refer to that conglomerate. Used to obtain table/row locks on the
base table rows which the index rows point at.
|
rowLocationColumn | protected int rowLocationColumn(Code) | | The column id (zero-based integer index) of the column which holds the row
location to the base conglomerate.
The default value of RowLocationColumn is the last key column.
Used to obtain table/row locks on the base table rows with the index rows
point at.
Currently, RowLocationColumn must be the last key column.
|
create | public void create(TransactionManager xact_manager, int segmentId, long input_conglomid, DataValueDescriptor[] template, ColumnOrdering[] columnOrder, Properties properties, int temporaryFlag) throws StandardException(Code) | | Create an empty secondary index b-tree, using the generic b-tree to do the
generic part of the creation process.
This routine opens the newly created container, adds a single page, and
makes this page the root by inserting a LeafControlRow onto this page
at slot 0 and marking in that control row that the page is a root page.
The following properties are specific to the b-tree secondary index:
- "baseConglomerateId" (integer). The conglomerate id of the base
conglomerate is never actually accessed by the b-tree secondary
index implementation, it only serves as a namespace for row locks.
This property is required.
- "rowLocationColumn" (integer). The zero-based index into the row which
the b-tree secondary index will assume holds a @see RowLocation of
the base row in the base conglomerate. This value will be used
for acquiring locks. In this implementation RowLocationColumn must be
the last key column.
This property is required.
A secondary index i (a, b) on table t (a, b, c) would have rows
which looked like (a, b, row_location). baseConglomerateId is set to the
conglomerate id of t. rowLocationColumns is set to 2. allowsDuplicates
would be set to false, @see BTree#create. To create a unique
secondary index set uniquenessColumns to 2, this means that the btree
code will compare the key values but not the row id when determing
uniqueness. To create a nonunique secondary index set uniquenessColumns
to 3, this would mean that the uniqueness test would include the row
location and since all row locations will be unique all rows inserted
into the index will be differentiated (at least) by row location.
See Also: BTree.create exception: StandardException - Standard exception policy. |
estimateMemoryUsage | public int estimateMemoryUsage()(Code) | | |
fetchMaxOnBTree | 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(Code) | | 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 - The TransactionController under which this operation takes place. Parameters: conglomId - The identifier of the conglomerateto open the scan for. Parameters: open_mode - Specifiy flags to control opening of table. OPENMODE_FORUPDATE - if set open the table forupdate otherwise open table shared. Parameters: lock_level - One of (MODE_TABLE, MODE_RECORD, or MODE_NONE). Parameters: isolation_level - The isolation level to lock the conglomerate at.One of (ISOLATION_READ_COMMITTED or ISOLATION_SERIALIZABLE). Parameters: scanColumnList - A description of which columns to return from every fetch in the scan. template, and scanColumnList work togetherto describe the row to be returned by the scan - see RowUtil for description of how these three parameters work together to describe a "row". Parameters: fetchRow - The row to retrieve the maximum value into. boolean indicating if a row was found and retrieved or not. exception: StandardException - Standard exception policy. |
getStaticCompiledConglomInfo | public StaticCompiledOpenConglomInfo getStaticCompiledConglomInfo(TransactionController xact_manager, long conglomId) throws StandardException(Code) | | 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.
The static compiled information. Parameters: conglomId - The identifier of the conglomerate to open. exception: StandardException - Standard exception policy. |
lockTable | final public ConglomerateController lockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level) throws StandardException(Code) | | Lock the base table.
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.
Parameters: xact_manager - Transaction to associate the lock with. exception: StandardException - Standard exception policy. |
openScan | 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(Code) | | Open a b-tree secondary index scan controller.
See Also: Conglomerate.openScan See Also: BTree.openScan exception: StandardException - Standard exception policy. |
openStoreCost | public StoreCostController openStoreCost(TransactionManager xact_manager, Transaction rawtran) throws StandardException(Code) | | 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 - The TransactionController under which this operation takes place. Parameters: rawtran - raw transaction context in which scan is managed. The open StoreCostController. exception: StandardException - Standard exception policy. See Also: StoreCostController |
writeExternal | public void writeExternal(ObjectOutput out) throws IOException(Code) | | Store the stored representation of the column value in the stream.
It might be easier to simply store the properties - which would certainly
make upgrading easier.
|
writeExternal_v36 | public void writeExternal_v36(ObjectOutput out) throws IOException(Code) | | Store the stored representation of the column value in the stream.
It might be easier to simply store the properties - which would certainly
make upgrading easier.
|
Methods inherited from org.apache.derby.impl.store.access.btree.BTree | public void addColumn(TransactionManager xact_manager, int column_id, Storable template_column) throws StandardException(Code)(Java Doc) public void create(Transaction rawtran, int segmentId, long input_containerid, DataValueDescriptor[] template, Properties properties, int conglom_format_id, int tmpFlag) throws StandardException(Code)(Java Doc) final public DataValueDescriptor[] createTemplate() throws StandardException(Code)(Java Doc) abstract public void drop(TransactionManager xact_manager) throws StandardException(Code)(Java Doc) abstract protected BTreeLockingPolicy getBtreeLockingPolicy(Transaction rawtran, int lock_level, int mode, int isolation_level, ConglomerateController base_cc, OpenBTree open_btree) throws StandardException(Code)(Java Doc) public long getContainerid()(Code)(Java Doc) public DynamicCompiledOpenConglomInfo getDynamicCompiledConglomInfo(long conglomId) throws StandardException(Code)(Java Doc) final public ContainerKey getId()(Code)(Java Doc) public boolean isNull()(Code)(Java Doc) public boolean isTemporary()(Code)(Java Doc) final public boolean isUnique()(Code)(Java Doc) abstract public long load(TransactionManager xact_manager, boolean createConglom, RowLocationRetRowSource rowSource) throws StandardException(Code)(Java Doc) abstract public ConglomerateController lockTable(TransactionManager xact_manager, int open_mode, int lock_level, int isolation_level) throws StandardException(Code)(Java Doc) abstract 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(Code)(Java Doc) public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException(Code)(Java Doc) public void readExternalFromArray(ArrayInputStream in) throws IOException, ClassNotFoundException(Code)(Java Doc) public void restoreToNull()(Code)(Java Doc) public String toString()(Code)(Java Doc) public void writeExternal(ObjectOutput out) throws IOException(Code)(Java Doc)
|
|
|