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

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


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


    String  db_name,
    long    segmentid,
    long    containerid,
    long    pagenumber)
  {
    Transaction xact = null;
    try
    {
      Object module = getModuleFromDbName(db_name);

      RawStoreFactory store_module = (RawStoreFactory)
        Monitor.findServiceModule(module, RawStoreFactory.MODULE);

      xact = store_module.startInternalTransaction(ContextService.getFactory().getCurrentContextManager());

      ContainerKey id = new ContainerKey(segmentid, containerid);
      ContainerHandle container =
        xact.openContainer(id,
                   ContainerHandle.MODE_READONLY);
      Page page = container.getPage(pagenumber);

      if (page != null)
      {
        System.out.println(page.toString());
        page.unlatch();
      }
      else
      {
        System.out.println("page " + pagenumber + " not found");
      }
      xact.abort();
      xact.close();
      xact = null;
    }
    catch (StandardException se)
    {
      se.printStackTrace();
    }
    finally
    {
      if (xact != null)
      {
        try
        {
          xact.abort();
          xact.close();
        }
        catch (StandardException se)
        {
        }
      }
View Full Code Here

    {
      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

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

     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.