Search in sources :

Example 6 with Conglomerate

use of org.apache.derby.iapi.store.access.conglomerate.Conglomerate in project derby by apache.

the class RAMTransaction method debugOpened.

/**
 * Return a string with debug information about opened congloms/scans/sorts.
 * <p>
 * Return a string with debugging information about current opened
 * congloms/scans/sorts which have not been close()'d.
 * Calls to this routine are only valid under code which is conditional
 * on SanityManager.DEBUG.
 * <p>
 *
 * @return String with debugging information.
 *
 * @exception  StandardException  Standard exception policy.
 */
public String debugOpened() throws StandardException {
    String str = null;
    if (SanityManager.DEBUG) {
        str = "";
        for (Iterator<ScanManager> it = scanControllers.iterator(); it.hasNext(); ) {
            ScanController sc = it.next();
            str += "open scan controller: " + sc + "\n";
        }
        for (Iterator<ConglomerateController> it = conglomerateControllers.iterator(); it.hasNext(); ) {
            ConglomerateController cc = (ConglomerateController) it.next();
            str += "open conglomerate controller: " + cc + "\n";
        }
        if (sortControllers != null) {
            for (Iterator<SortController> it = sortControllers.iterator(); it.hasNext(); ) {
                SortController sc = it.next();
                str += "open sort controller: " + sc + "\n";
            }
        }
        if (sorts != null) {
            for (int i = 0; i < sorts.size(); i++) {
                Sort sort = sorts.get(i);
                if (sort != null) {
                    str += "sorts created by createSort() in current xact:" + sort + "\n";
                }
            }
        }
        if (tempCongloms != null) {
            for (Iterator<Long> it = tempCongloms.keySet().iterator(); it.hasNext(); ) {
                Long conglomId = it.next();
                Conglomerate c = tempCongloms.get(conglomId);
                str += "temp conglomerate id = " + conglomId + ": " + c;
            }
        }
    }
    return (str);
}
Also used : GroupFetchScanController(org.apache.derby.iapi.store.access.GroupFetchScanController) ScanController(org.apache.derby.iapi.store.access.ScanController) ConglomerateController(org.apache.derby.iapi.store.access.ConglomerateController) ScanManager(org.apache.derby.iapi.store.access.conglomerate.ScanManager) Conglomerate(org.apache.derby.iapi.store.access.conglomerate.Conglomerate) Sort(org.apache.derby.iapi.store.access.conglomerate.Sort) SortController(org.apache.derby.iapi.store.access.SortController)

Example 7 with Conglomerate

use of org.apache.derby.iapi.store.access.conglomerate.Conglomerate in project derby by apache.

the class RAMTransaction method openStoreCost.

/**
 * Return an open StoreCostController for the given conglomid.
 * <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>
 *
 * @return The open StoreCostController.
 *
 * @param conglomId The identifier of the conglomerate to open.
 *
 * @exception  StandardException  Standard exception policy.
 *
 * @see StoreCostController
 */
public StoreCostController openStoreCost(long conglomId) throws StandardException {
    // Find the conglomerate.
    Conglomerate conglom = findExistingConglomerate(conglomId);
    // Get a scan controller.
    StoreCostController scc = conglom.openStoreCost(this, rawtran);
    return (scc);
}
Also used : StoreCostController(org.apache.derby.iapi.store.access.StoreCostController) Conglomerate(org.apache.derby.iapi.store.access.conglomerate.Conglomerate)

Example 8 with Conglomerate

use of org.apache.derby.iapi.store.access.conglomerate.Conglomerate in project derby by apache.

the class RAMTransaction method addColumnToConglomerate.

/**
 ************************************************************************
 * Public Methods of TransactionController interface:
 **************************************************************************
 */
/**
 *    Add a column to a conglomerate.  The conglomerate must not be open in
 *	the current transaction.  This also means that there must not be any
 *    active scans on it.
 *
 *    The column can only be added at the spot just after the current set of
 *    columns.
 *
 *    The template_column must be nullable.
 *
 *    After this call has been made, all fetches of this column from rows that
 *    existed in the table prior to this call will return "null".
 *
 *	@param conglomId        The identifier of the conglomerate to drop.
 *	@param column_id        The column number to add this column at.
 *	@param template_column  An instance of the column to be added to table.
 *	@param collation_id     collation id of the added column.
 *
 *	@exception StandardException Only some types of conglomerates can support
 *        adding a column, for instance "heap" conglomerates support adding a
 *        column while "btree" conglomerates do not.  If the column can not be
 *        added an exception will be thrown.
 */
public void addColumnToConglomerate(long conglomId, int column_id, Storable template_column, int collation_id) throws StandardException {
    boolean is_temporary = (conglomId < 0);
    Conglomerate conglom = findConglomerate(conglomId);
    if (conglom == null) {
        throw StandardException.newException(SQLState.AM_NO_SUCH_CONGLOMERATE_DROP, conglomId);
    }
    // Get exclusive lock on the table being altered.
    ConglomerateController cc = conglom.open(this, rawtran, false, OPENMODE_FORUPDATE, MODE_TABLE, accessmanager.table_level_policy[TransactionController.ISOLATION_SERIALIZABLE], (StaticCompiledOpenConglomInfo) null, (DynamicCompiledOpenConglomInfo) null);
    conglom.addColumn(this, column_id, template_column, collation_id);
    // live in the conglomerate cache.
    if (!is_temporary) {
        alterTableCallMade = true;
    }
    cc.close();
    return;
}
Also used : Conglomerate(org.apache.derby.iapi.store.access.conglomerate.Conglomerate) ConglomerateController(org.apache.derby.iapi.store.access.ConglomerateController)

Example 9 with Conglomerate

use of org.apache.derby.iapi.store.access.conglomerate.Conglomerate in project derby by apache.

the class RAMTransaction method dropConglomerate.

public void dropConglomerate(long conglomId) throws StandardException {
    Conglomerate conglom = findExistingConglomerate(conglomId);
    conglom.drop(this);
    if (conglomId < 0) {
        if (tempCongloms != null)
            tempCongloms.remove(conglomId);
    } else {
        accessmanager.conglomCacheRemoveEntry(conglomId);
    }
}
Also used : Conglomerate(org.apache.derby.iapi.store.access.conglomerate.Conglomerate)

Example 10 with Conglomerate

use of org.apache.derby.iapi.store.access.conglomerate.Conglomerate in project derby by apache.

the class RAMAccessManager method conglomCacheFind.

/**
 * Find a conglomerate by conglomid in the cache.
 * <p>
 * Look for a conglomerate given a conglomid.  If in cache return it,
 * otherwise fault in an entry by asking the owning factory to produce
 * an entry.
 * <p>
 *
 * @return The conglomerate object identified by "conglomid".
 *
 * @param conglomid The conglomerate id of the conglomerate to look up.
 *
 * @exception  StandardException  Standard exception policy.
 */
/* package */
Conglomerate conglomCacheFind(long conglomid) throws StandardException {
    Conglomerate conglom = null;
    Long conglomid_obj = conglomid;
    CacheableConglomerate cache_entry = (CacheableConglomerate) conglom_cache.find(conglomid_obj);
    if (cache_entry != null) {
        conglom = cache_entry.getConglom();
        conglom_cache.release(cache_entry);
    }
    return (conglom);
}
Also used : Conglomerate(org.apache.derby.iapi.store.access.conglomerate.Conglomerate)

Aggregations

Conglomerate (org.apache.derby.iapi.store.access.conglomerate.Conglomerate)11 ScanManager (org.apache.derby.iapi.store.access.conglomerate.ScanManager)3 ConglomerateController (org.apache.derby.iapi.store.access.ConglomerateController)2 BTreeLockingPolicy (org.apache.derby.impl.store.access.btree.BTreeLockingPolicy)2 HashMap (java.util.HashMap)1 GroupFetchScanController (org.apache.derby.iapi.store.access.GroupFetchScanController)1 ScanController (org.apache.derby.iapi.store.access.ScanController)1 SortController (org.apache.derby.iapi.store.access.SortController)1 StoreCostController (org.apache.derby.iapi.store.access.StoreCostController)1 ConglomerateFactory (org.apache.derby.iapi.store.access.conglomerate.ConglomerateFactory)1 MethodFactory (org.apache.derby.iapi.store.access.conglomerate.MethodFactory)1 Sort (org.apache.derby.iapi.store.access.conglomerate.Sort)1 ContainerHandle (org.apache.derby.iapi.store.raw.ContainerHandle)1 LockingPolicy (org.apache.derby.iapi.store.raw.LockingPolicy)1 ControlRow (org.apache.derby.impl.store.access.btree.ControlRow)1