Search in sources :

Example 6 with OpenConglomerate

use of org.apache.derby.impl.store.access.conglomerate.OpenConglomerate in project derby by apache.

the class Heap method open.

/**
 * Open a heap controller.
 * <p>
 *
 * @see Conglomerate#open
 *
 * @exception  StandardException  Standard exception policy.
 */
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 {
    OpenConglomerate open_conglom = new OpenHeap();
    if (open_conglom.init((ContainerHandle) null, this, this.format_ids, this.collation_ids, xact_manager, rawtran, hold, open_mode, lock_level, locking_policy, dynamic_info) == null) {
        throw StandardException.newException(SQLState.HEAP_CONTAINER_NOT_FOUND, Long.toString(id.getContainerId()));
    }
    HeapController heapcontroller = new HeapController();
    heapcontroller.init(open_conglom);
    return (heapcontroller);
}
Also used : OpenConglomerate(org.apache.derby.impl.store.access.conglomerate.OpenConglomerate) ContainerHandle(org.apache.derby.iapi.store.raw.ContainerHandle)

Example 7 with OpenConglomerate

use of org.apache.derby.impl.store.access.conglomerate.OpenConglomerate in project derby by apache.

the class Heap method openByContainerKey.

/**
 * Open a heap controller given ContainerKey.
 * <p>
 * Static routine to open a container given input of the ContainerKey.
 * Routine will lock the container first, and then get the Heap from
 * the conglomerate cache.  This insures that interaction with the
 * conglomerate cache is safe with respect to concurrent alter table's
 * which may or may not commit.
 *
 * Currently only package accessible and only used by HeapPostCommit.
 * Longer term would be better to change all of the open interfaces
 * to get lock before accessing conglomerate cache rather than have a
 * specific interface for HeapPostCommit.
 *
 * @see Conglomerate#open
 *
 * @exception  StandardException  Standard exception policy.
 */
static /* package */
ConglomerateController openByContainerKey(ContainerKey container_key, TransactionManager xact_manager, Transaction rawtran, boolean hold, int open_mode, int lock_level, LockingPolicy locking_policy, StaticCompiledOpenConglomInfo static_info, DynamicCompiledOpenConglomInfo dynamic_info) throws StandardException {
    if (container_key.getSegmentId() == ContainerHandle.TEMPORARY_SEGMENT) {
        open_mode |= ContainerHandle.MODE_TEMP_IS_KEPT;
    }
    // TODO (mikem) - check about open_mode and temp containers.
    ContainerHandle open_container = rawtran.openContainer(container_key, locking_policy, open_mode);
    Heap heap = (Heap) xact_manager.findExistingConglomerateFromKey(container_key);
    OpenConglomerate open_conglom = new OpenHeap();
    if (open_conglom.init((ContainerHandle) open_container, heap, heap.format_ids, heap.collation_ids, xact_manager, rawtran, hold, open_mode, lock_level, locking_policy, dynamic_info) == null) {
        throw StandardException.newException(SQLState.HEAP_CONTAINER_NOT_FOUND, Long.toString(container_key.getContainerId()));
    }
    HeapController heapcontroller = new HeapController();
    heapcontroller.init(open_conglom);
    return (heapcontroller);
}
Also used : ContainerHandle(org.apache.derby.iapi.store.raw.ContainerHandle) OpenConglomerate(org.apache.derby.impl.store.access.conglomerate.OpenConglomerate)

Aggregations

ContainerHandle (org.apache.derby.iapi.store.raw.ContainerHandle)7 OpenConglomerate (org.apache.derby.impl.store.access.conglomerate.OpenConglomerate)7 Page (org.apache.derby.iapi.store.raw.Page)2 FormatableBitSet (org.apache.derby.iapi.services.io.FormatableBitSet)1 DynamicCompiledOpenConglomInfo (org.apache.derby.iapi.store.access.DynamicCompiledOpenConglomInfo)1 TransactionManager (org.apache.derby.iapi.store.access.conglomerate.TransactionManager)1 RecordHandle (org.apache.derby.iapi.store.raw.RecordHandle)1 DataValueDescriptor (org.apache.derby.iapi.types.DataValueDescriptor)1