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

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


    {
      Enumeration e = mergeRuns.elements();

      try
      {
        Transaction rawTran = tran.getRawStoreXact();
        long segmentId = StreamContainerHandle.TEMPORARY_SEGMENT;

        while (e.hasMoreElements())
        {
          long containerId = ((Long) e.nextElement()).longValue();
          rawTran.dropStreamContainer(segmentId, containerId);
        }
      }
      catch (StandardException se)
      {
        // Ignore problems with dropping, worst case
View Full Code Here


            }

      // Create and open another temporary stream conglomerate
      // which will become
      // a merge run made up with the merged runs from the subset.
      Transaction rawTran = tran.getRawStoreXact();
      int segmentId = StreamContainerHandle.TEMPORARY_SEGMENT;
      long id = rawTran.addAndLoadStreamContainer(segmentId,
        properties, msRowSource);

      mergeRuns.addElement(new Long(id));

      // Drop the conglomerates in the merge subset
      e = subset.elements();
      while (e.hasMoreElements())
      {
        Long containerId = (Long) e.nextElement();
        rawTran.dropStreamContainer(segmentId, containerId.longValue());
      }
    }
  }
View Full Code Here

    // TransactionManager.
    SortBufferRowSource rowSource =
      new SortBufferRowSource(sortBuffer, (TransactionManager)null, sortObserver, true, sortBufferMax);

    // Create a temporary stream conglomerate...
    Transaction rawTran = tran.getRawStoreXact()// get raw transaction
    int segmentId = StreamContainerHandle.TEMPORARY_SEGMENT;
    long id = rawTran.addAndLoadStreamContainer(segmentId,
      properties, rowSource);

    // Don't close the sortBuffer, we just emptied it, the caller may reuse
    // that sortBuffer for the next run.
    rowSource = null;
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 nested transaction inherits the compatibility space
        // from "this", thus the new transaction shares the compatibility space
        // of the current transaction.
       

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

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

        return(rt);
    }
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);
        hasCollatedTypes = hasCollatedColumns(collation_ids);

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

     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 nested transaction inherits the compatibility space
        // from "this", thus the new transaction shares the compatibility space
        // of the current transaction.
       

        Transaction child_rawtran =
            ((readOnly) ?
                accessmanager.getRawStore().startNestedReadOnlyUserTransaction(
                    getLockSpace(), 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

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.