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

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


        {
            // No transaction context.  Create or find a raw store 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 = rawstore.findUserTransaction(cm, transName);
            RAMTransaction rt      = new RAMTransaction(this, rawtran, null);

            rtc =
                new RAMTransactionContext(
                    cm,
                    AccessFactoryGlobals.RAMXACT_CONTEXT_ID,
                    rt, false /* abortAll */);

      TransactionController tc = rtc.getTransaction();

      if (xactProperties != null)
            {
        rawtran.setup(tc);
        tc.commit();
      }

            rawtran.setDefaultLockingPolicy(system_default_locking_policy);

      tc.commit();

      return tc;
        }
View Full Code Here


        {
            // No transaction context.  Create or find a raw store 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 =
                rawstore.startGlobalTransaction(
                    cm, format_id, global_id, branch_id);

            xa_tc                    = new RAMTransaction(this, rawtran, null);

            rtc =
                new RAMTransactionContext(
                    cm,
                    AccessFactoryGlobals.RAMXACT_CONTEXT_ID,
                    xa_tc, false /* abortAll */);

            // RESOLVE - an XA transaction can only commit once so, if we
            // acquire readlocks.

      if (xactProperties != null)
            {
        rawtran.setup(xa_tc);

                // HACK - special support has been added to the commitNoSync
                // of a global xact, to allow committing of read only xact,
                // which will allow subsequent activity on the xact keeping
                // the same global transaction id.
                xa_tc.commitNoSync(
                    TransactionController.RELEASE_LOCKS |
                    TransactionController.READONLY_TRANSACTION_INITIALIZATION);
      }

            rawtran.setDefaultLockingPolicy(system_default_locking_policy);

            // HACK - special support has been added to the commitNoSync
            // of a global xact, to allow committing of read only xact,
            // which will allow subsequent activity on the xact keeping
            // the same global transaction id.
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

    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");
        }


    /* convert 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 equal to template length, because column order
     * length changes whether it is unique or 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
    }

        // get collation ids from input collation ids, store it in the
        // conglom state.
        collation_ids =
            ConglomerateUtil.createCollationIds(template.length, collationIds);

    // 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);


View Full Code Here

     throws StandardException
  {
    if (work == null)
      return Serviceable.DONE;

    Transaction tran =
            rawStoreFactory.findUserTransaction(
                contextMgr, AccessFactoryGlobals.SYS_TRANS_NAME);

    if (SanityManager.DEBUG)
    {
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

     throws StandardException
  {
    if (work == null)
      return Serviceable.DONE;

    Transaction tran =
            rawStoreFactory.findUserTransaction(
                contextMgr, AccessFactoryGlobals.SYS_TRANS_NAME);

    if (SanityManager.DEBUG)
    {
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.