Package org.apache.derby.iapi.store.raw

Examples of org.apache.derby.iapi.store.raw.Transaction


    Properties              properties,
  int                     temporaryFlag)
    throws StandardException
  {
        String      property_value = null;
        Transaction rawtran        = xact_manager.getRawStoreXact();

        if (properties == null)
        {
            throw(StandardException.newException(
                    SQLState.BTREE_PROPERTY_NOT_FOUND, PROPERTY_BASECONGLOMID));
        }

        // Get baseConglomerateId //
        property_value = properties.getProperty(PROPERTY_BASECONGLOMID);
        if (property_value == null)
        {
            throw(StandardException.newException(
                    SQLState.BTREE_PROPERTY_NOT_FOUND, PROPERTY_BASECONGLOMID));
        }

        if (SanityManager.DEBUG)
        {
      if (property_value == null)
              SanityManager.THROWASSERT(
                  PROPERTY_BASECONGLOMID +
          "property not passed to B2I.create()");
        }

        baseConglomerateId = Long.parseLong(property_value);

        // Get rowLocationColumn //
        property_value = properties.getProperty(PROPERTY_ROWLOCCOLUMN);

        if (SanityManager.DEBUG)
        {
      if (property_value == null)
              SanityManager.THROWASSERT(
                  PROPERTY_ROWLOCCOLUMN +
          "property not passed to B2I.create()");
        }

        if (property_value == null)
        {
            throw(StandardException.newException(
                    SQLState.BTREE_PROPERTY_NOT_FOUND, PROPERTY_BASECONGLOMID));
        }

        rowLocationColumn = Integer.parseInt(property_value);

        // Currently the row location column must be the last column (makes)
        // comparing the columns in the index easier.
        if (SanityManager.DEBUG)
        {
            SanityManager.ASSERT(rowLocationColumn == template.length - 1,
                "rowLocationColumn is not the last column in the index");
            SanityManager.ASSERT(
                template[rowLocationColumn] instanceof
                    RowLocation);

            // There must be at least one key column
      if (rowLocationColumn < 1)
              SanityManager.THROWASSERT(
          "rowLocationColumn (" + rowLocationColumn +
          ") expected to be >= 1");
        }


    /* covert the sorting order information into a boolean array map.
     * If the sorting order for the columns is not provided, we
     * assign the default as Ascending Order.
     * array length is equla to template length , because column order
     * length changes wther it is unique is non unique. store assumes
     * template length arrays. So , we make  template length array and make
     * the last column as ascending instead of having lot of execeptions code.
     */
   
    ascDescInfo = new boolean[template.length];
    for (int i=0 ; i < ascDescInfo.length; i++)
    {
      if (columnOrder != null && i < columnOrder.length)
        ascDescInfo[i] = columnOrder[i].getIsAscending();
      else
        ascDescInfo[i] = true// default values - ascending order
    }

    // Do the generic part of creating the b-tree.
    super.create(rawtran, segmentId, input_conglomid, template, properties, getTypeFormatId(), temporaryFlag);

        // open the base conglomerate - to get the lock
        ConglomerateController base_cc =
            xact_manager.openConglomerate(
                baseConglomerateId,
                false,
                TransactionController.OPENMODE_FOR_LOCK_ONLY,
                TransactionController.MODE_TABLE,
                TransactionController.ISOLATION_SERIALIZABLE);
       
        OpenBTree open_btree = new OpenBTree();

        BTreeLockingPolicy b2i_locking_policy =
            new B2ITableLocking3(
                rawtran,
                TransactionController.MODE_TABLE,
                rawtran.newLockingPolicy(
                    LockingPolicy.MODE_CONTAINER,
                    TransactionController.ISOLATION_SERIALIZABLE, true), base_cc, open_btree);


        // The following call will "open" the new btree.  Create is
View Full Code Here


    {
        // need to open the container and update the row containing the
        // serialized format of the heap. 
        ContainerHandle container = null;
        Page            page      = null;
        Transaction     rawtran   = xact_manager.getRawStoreXact();

        try
        {
            container =
                rawtran.openContainer(
                    id,
                    rawtran.newLockingPolicy(
                        LockingPolicy.MODE_CONTAINER,
                        TransactionController.ISOLATION_SERIALIZABLE, true),
                    ContainerHandle.MODE_FORUPDATE |
                        (isTemporary() ? ContainerHandle.MODE_TEMP_IS_KEPT : 0));
View Full Code Here

    {
        // need to open the container and update the row containing the
        // serialized format of the heap. 
        ContainerHandle container = null;
        Page            page      = null;
        Transaction     rawtran   = xact_manager.getRawStoreXact();

        try
        {
            container =
                rawtran.openContainer(
                    id,
                    rawtran.newLockingPolicy(
                        LockingPolicy.MODE_CONTAINER,
                        TransactionController.ISOLATION_SERIALIZABLE, true),
                    ContainerHandle.MODE_FORUPDATE |
                        (isTemporary() ? ContainerHandle.MODE_TEMP_IS_KEPT : 0));
View Full Code Here

        // Create a transaction, make a context for it, and push the context.
        // Note this puts the raw store transaction context
        // above the access context, which is required for
        // error handling assumptions to be correct.
       
        Transaction rawtran =
            accessmanager.getRawStore().startInternalTransaction(cm);
        RAMTransaction rt   = new RAMTransaction(accessmanager, rawtran, null);
        RAMTransactionContext rtc   =
      new RAMTransactionContext(
                cm, AccessFactoryGlobals.RAMXACT_INTERNAL_CONTEXT_ID,
                rt, true /*abortAll */);

        rawtran.setDefaultLockingPolicy(
                accessmanager.getDefaultLockingPolicy());

        return(rt);
    }
View Full Code Here

        // Note that the compatibility space for the nested transaction
        // is "this", thus the new transaction shares the compatibility space
        // of the current transaction.
       

        Transaction child_rawtran =
            ((readOnly) ?
                accessmanager.getRawStore().startNestedReadOnlyUserTransaction(
                    this.getLockObject(), cm,
                    AccessFactoryGlobals.NESTED_READONLY_USER_TRANS) :
                accessmanager.getRawStore().startNestedUpdateUserTransaction(
                    cm, AccessFactoryGlobals.NESTED_UPDATE_USER_TRANS));

        RAMTransaction rt   =
            new RAMTransaction(accessmanager, child_rawtran, this);

        RAMTransactionContext rtc   =
      new RAMTransactionContext(
                cm,
                AccessFactoryGlobals.RAMXACT_CHILD_CONTEXT_ID,
                rt, true /*abortAll */);

        child_rawtran.setDefaultLockingPolicy(
                accessmanager.getDefaultLockingPolicy());

        /*
        System.out.println("returning nested xact: " + rt +
                "child_rawtran = " + child_rawtran);
View Full Code Here

    while (e.hasMoreElements())
    {
      // get the container id
      long id = ((Long) e.nextElement()).longValue();

      Transaction rawTran = tran.getRawStoreXact()// get raw transaction
      int segmentId = StreamContainerHandle.TEMPORARY_SEGMENT;
      openScans[scanindex++] =
                rawTran.openStreamContainer(segmentId, id, hold);
    }

    // Load the initial rows.
    for (scanindex = 0; scanindex < openScans.length; scanindex++)
      mergeARow(scanindex);
View Full Code Here

    ContextManager  cm,
    Xid             xid,
    boolean         onePhase)
    throws StandardException
    {
        Transaction rawtran =
            rsf.findUserTransaction(cm, AccessFactoryGlobals.USER_TRANS_NAME);

        // This may happen if somehow the transaction was committed between
        // the find() call and now.
        if (rawtran == null)
        {
            throw StandardException.newException(
                    SQLState.STORE_XA_PROTOCOL_VIOLATION);
        }

        if (SanityManager.DEBUG)
        {
            SanityManager.ASSERT(rawtran != null);

            SanityManager.ASSERT(
                (new GlobalXactId(
                    xid.getFormatId(),
                    xid.getGlobalTransactionId(),
                    xid.getBranchQualifier())).equals(rawtran.getGlobalId()));
        }

        rawtran.xa_commit(onePhase);
    }
View Full Code Here

    public void forget(
    ContextManager  cm,
    Xid             xid)
    throws StandardException
    {
        Transaction rawtran =
            rsf.findUserTransaction(cm, AccessFactoryGlobals.USER_TRANS_NAME);

        if (SanityManager.DEBUG)
        {
            SanityManager.ASSERT(
                new GlobalXactId(
                    xid.getFormatId(),
                    xid.getGlobalTransactionId(),
                    xid.getBranchQualifier()).equals(rawtran.getGlobalId()));
        }

        // forget should only be called on heuristically completed xacts, which
        // should not exist in our system.
        throw StandardException.newException(
View Full Code Here

    public void rollback(
    ContextManager  cm,
    Xid             xid)
        throws StandardException
    {
        Transaction rawtran =
            rsf.findUserTransaction(cm, AccessFactoryGlobals.USER_TRANS_NAME);

        // This may happen if somehow the transaction was committed between
        // the find() call and now.
        if (rawtran == null)
        {
            throw StandardException.newException(
                    SQLState.STORE_XA_PROTOCOL_VIOLATION);
        }

        if (SanityManager.DEBUG)
        {

            SanityManager.ASSERT(
                new GlobalXactId(
                    xid.getFormatId(),
                    xid.getGlobalTransactionId(),
                    xid.getBranchQualifier()).equals(rawtran.getGlobalId()));
        }

        rawtran.xa_rollback();
    }
View Full Code Here

      throw StandardException.newException(SQLState.FILE_READ_ONLY);

     
    ContextManager cm = ContextService.getFactory().getCurrentContextManager();

    Transaction tran =
            factory.getRawStoreFactory().findUserTransaction(
                cm, AccessFactoryGlobals.USER_TRANS_NAME);

    tran.logAndDo(privRemoveFileOperation(name, currentGenerationId, purgeOnCommit));

    if (purgeOnCommit) {

      Serviceable s = privRemoveFile(getAsFile(name, currentGenerationId));

      tran.addPostCommitWork(s);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.store.raw.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.