📄 b2i.java
字号:
xact_manager, // current transaction rawtran, // current raw store transaction hold, // holdability open_mode, lock_level, locking_policy, true, this, new B2IUndo(), (B2IStaticCompiledInfo) static_info, dynamic_info); // Return it to the caller. return b2ic; } /** Open a b-tree secondary index scan controller. @see Conglomerate#openScan @see BTree#openScan @exception StandardException Standard exception policy. **/ 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 { // Create a new b-tree secondary index scan. B2IForwardScan b2is = new B2IForwardScan(); // Initialize it. b2is.init(xact_manager, rawtran, hold, open_mode, lock_level, locking_policy, isolation_level, true /* get locks on base table as part of open */, scanColumnList, startKeyValue, startSearchOperator, qualifier, stopKeyValue, stopSearchOperator, this, new B2IUndo(), (B2IStaticCompiledInfo) static_info, dynamic_info); // Return it to the caller. return b2is; } /** * Open a b-tree compress scan. * <p> * B2I does not support a compress scan. * <p> * @see Conglomerate#defragmentConglomerate * * @exception StandardException Standard exception policy. **/ public ScanManager defragmentConglomerate( TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, int isolation_level) throws StandardException { throw StandardException.newException( SQLState.BTREE_UNIMPLEMENTED_FEATURE); } public void purgeConglomerate( TransactionManager xact_manager, Transaction rawtran) throws StandardException { // currently on work to do in btree's for purge rows, purging // happens best when split is about to happen. return; } public void compressConglomerate( TransactionManager xact_manager, Transaction rawtran) throws StandardException { B2IController b2ic = new B2IController(); try { int open_mode = TransactionController.OPENMODE_FORUPDATE; // Do the actual open of the container in the super class. b2ic.init( xact_manager, // current transaction xact_manager.getRawStoreXact(), // current raw store xact false, // Not holdable open_mode, TransactionController.MODE_TABLE, xact_manager.getRawStoreXact().newLockingPolicy( LockingPolicy.MODE_CONTAINER, TransactionController.ISOLATION_SERIALIZABLE, true), true, this, new B2IUndo(), (B2IStaticCompiledInfo) null, (DynamicCompiledOpenConglomInfo) null); b2ic.getContainer().compressContainer(); } finally { b2ic.close(); } return; } /** * Return an open StoreCostController for the conglomerate. * <p> * 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. * <p> * @param xact_manager The TransactionController under which this * operation takes place. * @param rawtran raw transaction context in which scan is managed. * * @return The open StoreCostController. * * @exception StandardException Standard exception policy. * * @see StoreCostController **/ public StoreCostController openStoreCost( TransactionManager xact_manager, Transaction rawtran) throws StandardException { B2ICostController b2icost = new B2ICostController(); b2icost.init(xact_manager, this, rawtran); return(b2icost); } /** Drop this b-tree secondary index. @see Conglomerate#drop @see BTree#drop @exception StandardException Standard exception policy. **/ public void drop(TransactionManager xact_manager) throws StandardException { // HACK to get around problem where index is dropped after the base // table. ConglomerateController base_cc = null; /* Get X table lock to make sure no thread is accessing index */ base_cc = lockTable( xact_manager, TransactionController.OPENMODE_FORUPDATE, TransactionController.MODE_TABLE, TransactionController.ISOLATION_REPEATABLE_READ); xact_manager.getRawStoreXact().dropContainer(id); if (base_cc != null) base_cc.close(); } /** * Return static information about the conglomerate to be included in a * a compiled plan. * <p> * 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. * <p> * * @return The static compiled information. * * @param conglomId The identifier of the conglomerate to open. * * @exception StandardException Standard exception policy. **/ public StaticCompiledOpenConglomInfo getStaticCompiledConglomInfo( TransactionController xact_manager, long conglomId) throws StandardException { return(new B2IStaticCompiledInfo(xact_manager, this)); } /* ** Methods of Storable (via Conglomerate via BTree). ** This class is responsible for re/storing its ** own state and calling its superclass to store its'. */ /* * Storable interface, implies Externalizable, TypedFormat */ /** Return my format identifier. @see org.apache.derby.iapi.services.io.TypedFormat#getTypeFormatId */ public int getTypeFormatId() { return StoredFormatIds.ACCESS_B2I_V3_ID; } /** 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.*/ public void writeExternal_v36(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeLong(baseConglomerateId); out.writeInt(rowLocationColumn); } /** Restore the in-memory representation from the stream. @exception ClassNotFoundException Thrown if the stored representation is serialized and a class named in the stream could not be found. @see java.io.Externalizable#readExternal */ public void readExternal_v36(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); // XXX (nat) need to improve error handling baseConglomerateId = in.readLong(); rowLocationColumn = in.readInt(); //set the default (Ascending) sort order ascDescInfo = new boolean[nKeyFields]; for (int i=0 ; i < ascDescInfo.length; i++) ascDescInfo[i] = true; } /** 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. */ public void writeExternal(ObjectOutput out) throws IOException { super.writeExternal(out); out.writeLong(baseConglomerateId); out.writeInt(rowLocationColumn); // if the conglomerate type is not not the version2 // sorting information is stored from version V3(release 3.7) if (conglom_format_id != StoredFormatIds.ACCESS_B2I_V2_ID) { //write the coulmsn sort information as bits FormatableBitSet ascDescBits = new FormatableBitSet(ascDescInfo.length); for (int i = 0; i < ascDescInfo.length; i++) { if (ascDescInfo[i]) ascDescBits.set(i); } ascDescBits.writeExternal(out); } } /** Restore the in-memory representation from the stream. @exception ClassNotFoundException Thrown if the stored representation is serialized and a class named in the stream could not be found. @see java.io.Externalizable#readExternal */ private final void localReadExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); // XXX (nat) need to improve error handling baseConglomerateId = in.readLong(); rowLocationColumn = in.readInt(); // if the conglomerate type is not the version2 // sorting info is avaialable from version v3(release 3.7) if (conglom_format_id != StoredFormatIds.ACCESS_B2I_V2_ID) { // read the column sort order info FormatableBitSet ascDescBits = new FormatableBitSet(); ascDescBits.readExternal(in); ascDescInfo = new boolean[ascDescBits.getLength()]; for(int i =0 ; i < ascDescBits.getLength(); i++) ascDescInfo[i] = ascDescBits.isSet(i); } else { //set the default (Ascending) sort order ascDescInfo = new boolean[nKeyFields]; for (int i=0 ; i < ascDescInfo.length; i++) ascDescInfo[i] = true; } } public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { localReadExternal(in); } public void readExternalFromArray(ArrayInputStream in) throws IOException, ClassNotFoundException { localReadExternal(in); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -