Package com.sleepycat.je.txn

Examples of com.sleepycat.je.txn.Txn$AutoTransaction


     * Used to get the Transaction object given an XA Xid.
     */
    public Transaction getXATransaction(Xid xid)
  throws DatabaseException {

  Txn ret = environmentImpl.getTxnManager().getTxnFromXid(xid);
  if (ret == null) {
      return null;
  }
  /* Do we guarantee object identity for Transaction objects? */
  return new Transaction(this, ret);
View Full Code Here


                    abortKnownDeleted =
                        ((entryBuffer.get() & ABORT_KNOWN_DELETED_MASK) != 0) ?
                        true : false;

                    /* Locker */
                    txn = new Txn();
                    txn.readFromLog(entryBuffer, entryTypeVersion);
                }
            } else {

                /*
 
View Full Code Here

        long prepareId = reader.getTxnPrepareId();
        Long prepareIdL = new Long(prepareId);
        if (!committedTxnIds.contains(prepareIdL) &&
      !abortedTxnIds.contains(prepareIdL)) {
      TransactionConfig txnConf = new TransactionConfig();
      Txn preparedTxn = new Txn(env, txnConf, prepareId);
      preparedTxn.setLockTimeout(0);
      preparedTxns.put(prepareIdL, preparedTxn);
      env.getTxnManager().registerXATxn
          (reader.getTxnPrepareXid(), preparedTxn, true);
      Tracer.trace(Level.INFO, env,
             "Found unfinished prepare record: id: " +
View Full Code Here

                     * non-transactional LN, redo it.
                     */
        boolean processThisLN = false;
        boolean lnIsCommitted = false;
        boolean lnIsPrepared = false;
        Txn preparedTxn = null;
        if (txnId == null) {
      processThisLN = true;
        } else {
      lnIsCommitted = committedTxnIds.contains(txnId);
      if (!lnIsCommitted) {
          preparedTxn = (Txn) preparedTxns.get(txnId);
          lnIsPrepared = preparedTxn != null;
      }
      if (lnIsCommitted || lnIsPrepared) {
          processThisLN = true;
      }
        }
        if (processThisLN) {

                        /* Invoke the evictor to reduce memory consumption. */
                        env.invokeEvictor();

                        LN ln = reader.getLN();
                        DatabaseId dbId = reader.getDatabaseId();
                        DatabaseImpl db = dbMapTree.getDb(dbId);
                        long logLsn = reader.getLastLsn();
                        long treeLsn = DbLsn.NULL_LSN;

                        /* Database may be null if it's been deleted. */
                        if (db != null) {
                            ln.postFetchInit(db, logLsn);

          if (preparedTxn != null) {
        preparedTxn.addLogInfo(logLsn);

        /*
         * We're reconstructing a prepared, but not
         * finished, transaction.  We know that there
         * was a write lock on this LN since it exists
         * in the log under this txnId.
         */
        preparedTxn.lock
                                    (ln.getNodeId(), LockType.WRITE,
                                     false /*noWait*/, db);
        preparedTxn.setPrepared(true);
          }

                            treeLsn = redo(db,
                                           location,
                                           ln,
View Full Code Here

             * back or one done on the behalf of a null txn.
             */
            LogEntryType entryType;
            long logAbortLsn;
            boolean logAbortKnownDeleted;
            Txn logTxn;
            if (locker.isTransactional()) {
                entryType = LogEntryType.LOG_DEL_DUPLN_TRANSACTIONAL;
    WriteLockInfo info = locker.getWriteLockInfo(getNodeId());
    logAbortLsn = info.getAbortLsn();
    logAbortKnownDeleted = info.getAbortKnownDeleted();
View Full Code Here

        throws DatabaseException {

        LogEntryType entryType;
        long logAbortLsn;
  boolean logAbortKnownDeleted;
        Txn logTxn;
        if (locker != null && locker.isTransactional()) {
            entryType = getTransactionalLogType();
      WriteLockInfo info = locker.getWriteLockInfo(getNodeId());
      logAbortLsn = info.getAbortLsn();
      logAbortKnownDeleted = info.getAbortKnownDeleted();
View Full Code Here

            abortKnownDeleted =
                ((entryBuffer.get() & ABORT_KNOWN_DELETED_MASK) != 0) ?
                true : false;

            /* Locker. */
            txn = new Txn();
            txn.readFromLog(entryBuffer, logVersion);
        }

        if (unpacked) {
            if (!readFullItem) {
View Full Code Here

         */
        tracker.truncateFromHead(deleteEnd, deleteFileNum);

        TransactionConfig config = new TransactionConfig();
        config.setDurability(Durability.COMMIT_NO_SYNC);
        Txn txn = Txn.createLocalTxn(envImpl, config);
        boolean success = false;
        try {
            synchronized (flushSynchronizer) {
                pruneDatabaseHead(deleteEnd, deleteFileNum, txn);
                flushToDatabase(txn);
            }
            txn.commit();
            success = true;
        } finally {
            if (!success) {
                txn.abort();
            }
        }
    }
View Full Code Here

        tracker.truncateFromTail(deleteStart, lastLsn);

        TransactionConfig config = new TransactionConfig();
        config.setDurability(Durability.COMMIT_NO_SYNC);
        Txn txn = Txn.createLocalTxn(envImpl, config);
        boolean success = false;
        try {
            pruneDatabaseTail(deleteStart, lastLsn, txn);
            flushToDatabase(txn);
            txn.commit();
            success = true;
        } finally {
            if (!success) {
                txn.abort();
            }
        }
    }
View Full Code Here

         * The mappings in the recovery tracker should overwrite those in the
         * VLSN index.
         */
        TransactionConfig config = new TransactionConfig();
        config.setDurability(Durability.COMMIT_NO_SYNC);
        Txn txn = Txn.createLocalTxn(envImpl, config);
        boolean success = false;
        VLSN lastOnDiskVLSN;
        try {
            lastOnDiskVLSN = pruneDatabaseTail(recoveryFirst, DbLsn.NULL_LSN,
                                               txn);
            tracker.merge(lastOnDiskVLSN, recoveryTracker);
            flushToDatabase(txn);
            txn.commit();
            success = true;
        } finally {
            if (!success) {
                txn.abort();
            }
        }
    }
View Full Code Here

TOP

Related Classes of com.sleepycat.je.txn.Txn$AutoTransaction

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.