Package edu.brown.hstore.txns

Examples of edu.brown.hstore.txns.AbstractTransaction


       
        { this.setDaemon(true); }
       
        public void run() {
            try {
                AbstractTransaction ts = queue.take();
                System.err.println("AWOKEN: " + ts);
                result.set(ts);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            } finally {
View Full Code Here


                LOG.debug(String.format("Received %s from HStoreSite %s",
                          request.getClass().getSimpleName(),
                          HStoreThreadManager.formatSiteName(request.getSenderSite())));
           
            Long txnId = request.getTransactionId();
            AbstractTransaction ts = hstore_site.getTransaction(txnId);
            String debug;
            Status status;
            if (ts != null) {
                debug = ts.debug();
                status = Status.OK;
            } else {
                debug = "";
                LOG.info("Found the abort!!!");
                status = Status.ABORT_UNEXPECTED;
View Full Code Here

      LOG.info(String.format("Received %s from HStoreSite %s at HStoreSite %s",
                    request.getClass().getSimpleName(),
                    HStoreThreadManager.formatSiteName(request.getSenderSite()),
                    HStoreThreadManager.formatSiteName(local_site_id)));
     
      AbstractTransaction ts = hstore_site.getTransaction(request.getTransactionId());
      System.out.println(hstore_site.getInflightTxns().size());
      System.out.println(request.getTransactionId());
      assert(ts!=null);
      ts.setUnevictCallback(done);
     
     
      ts.setNewTransactionId(request.getNewTransactionId());
      int partition = request.getPartitionId();
      Table catalog_tbl = hstore_site.getCatalogContext().getTableById(request.getTableId());
      short[] block_ids = new short[request.getBlockIdsList().size()];
      for(int i = 0; i < request.getBlockIdsList().size(); i++) block_ids[i] = (short) request.getBlockIds(i);
View Full Code Here

            this.getStatement(procs[0], "updateStock"),
            null,
        };
        TransactionTrace traces[] = this.getTransactionTraces(procs, true);
       
        AbstractTransaction txns[] = new AbstractTransaction[procs.length];
        @SuppressWarnings("unchecked")
        List<CountedStatement> queries[] = (List<CountedStatement>[])(new ArrayList<?>[procs.length]);
        for (int i = 0; i < procs.length; i++) {
            txns[i] = this.createTransaction(traces[i]);
            queries[i] = this.createQueryEstimate(traces[i], startStmts[i]);
View Full Code Here

            this.getProcedure(ostatByCustomerId.class),
            this.getProcedure(neworder.class),
        };
        TransactionTrace traces[] = this.getTransactionTraces(procs, true);
       
        AbstractTransaction txns[] = new AbstractTransaction[procs.length];
        @SuppressWarnings("unchecked")
        List<CountedStatement> queries[] = (List<CountedStatement>[])(new ArrayList<?>[procs.length]);
        for (int i = 0; i < procs.length; i++) {
            txns[i] = this.createTransaction(traces[i]);
            queries[i] = this.createQueryEstimate(traces[i]);
View Full Code Here

                break;
            }
        } // FOR
        assert(w_id >= 0);
       
        AbstractTransaction txns[] = new AbstractTransaction[procs.length];
        @SuppressWarnings("unchecked")
        List<CountedStatement> queries[] = (List<CountedStatement>[])(new ArrayList<?>[procs.length]);
        for (int i = 0; i < procs.length; i++) {
            txns[i] = this.createTransaction(traces[i]);
            queries[i] = this.createQueryEstimate(traces[i]);
View Full Code Here

   
    /**
     * Reject any and all transactions that are in our queues!
     */
    public void clearQueues(int partition) {
        AbstractTransaction ts = null;
        // Long txnId = null;
       
       
        if (debug.val) LOG.debug("Clearing out lock queue for partition " + partition);
        // LOCK QUEUES
View Full Code Here

        if (trace.val)
            LOG.trace(String.format("Checking lock queue for partition %d [queueSize=%d]",
                      partition, this.lockQueues[partition].size()));
       
        // Poll the queue and get the next value.
        AbstractTransaction nextTxn = null;
        this.lockQueueBarriers[partition].lockInterruptibly();
        try {
            nextTxn = this.lockQueues[partition].poll();
        } finally {
            this.lockQueueBarriers[partition].unlock();
        } // SYNCH
       
        if (nextTxn == null) {
            if (hstore_conf.site.queue_profiling) profilers[partition].lock_time.stopIfStarted();
            return (nextTxn);
        }

        PartitionCountingCallback<AbstractTransaction> callback = nextTxn.getInitCallback();
        assert(callback.isInitialized()) :
            String.format("Uninitialized %s callback for %s [hashCode=%d]",
                          callback.getClass().getSimpleName(), nextTxn, callback.hashCode());
       
        // HACK
        if (nextTxn.isAborted()) {
            if (debug.val)
                LOG.warn(String.format("The next txn for partition %d is %s but it is marked as aborted.",
                          partition, nextTxn));
            callback.decrementCounter(partition);
            nextTxn = null;
        }
        // If this callback has already been aborted, then there is nothing we need to
        // do. Somebody else will make sure that this txn is removed from the queue
        else if (callback.isAborted()) {
            if (debug.val)
                LOG.warn(String.format("The next txn for partition %d is %s but its %s is " +
                          "marked as aborted. [queueSize=%d]",
                          partition, nextTxn, callback.getClass().getSimpleName(),
                          this.lockQueues[partition].size()));
            callback.decrementCounter(partition);
            nextTxn = null;
        }
        // We have something we can use
        else {
            if (trace.val)
                LOG.trace(String.format("Good news! Partition %d is ready to execute %s! " +
                          "Invoking %s.run()",
                          partition, nextTxn, callback.getClass().getSimpleName()));
            this.lockQueueLastTxns[partition] = nextTxn.getTransactionId();
        }
       
       
        if (nextTxn != null) {
            // Send the init request for the specified partition
            if (debug.val)
                LOG.debug(String.format("%s - Invoking %s.run() for partition %d",
                          nextTxn, nextTxn.getInitCallback().getClass().getSimpleName(), partition));
            try {
                nextTxn.getInitCallback().run(partition);
            } catch (NullPointerException ex) {
                // HACK: Ignore...
                if (debug.val)
                    LOG.warn(String.format("Unexpected error when invoking %s for %s at partition %d",
                             nextTxn.getInitCallback().getClass().getSimpleName(),
                             nextTxn, partition), ex);
            } catch (Throwable ex) {
                String msg = String.format("Failed to invoke %s for %s at partition %d",
                                           nextTxn.getInitCallback().getClass().getSimpleName(),
                                           nextTxn, partition);
                throw new ServerFaultException(msg, ex, nextTxn.getTransactionId());
            }
           
            // Mark the txn being released to the given partition
            nextTxn.markReleased(partition);
       
            if (trace.val && nextTxn != null)
                LOG.trace(String.format("Finished processing lock queue for partition %d [next=%s]",
                          partition, nextTxn));
        }
View Full Code Here

                         HStoreConstants.THREAD_NAME_QUEUE_INIT));
            hstore_site.getThreadManager().registerProcessingThread();
           
            if (debug.val)
                LOG.info(String.format("Starting %s thread", this.getClass().getSimpleName()));
            AbstractTransaction nextTxn = null;
            while (stop == false) {
                try {
                    nextTxn = initQueue.take();
                } catch (InterruptedException ex) {
                    // IGNORE
View Full Code Here

        return (cachedDebugContext);
    }
   
    public String debug() {
        long timestamp = System.currentTimeMillis();
        AbstractTransaction peek = super.peek();
       
        @SuppressWarnings("unchecked")
        Map<String, Object> m[] = new Map[3];
        int i = -1;
       
View Full Code Here

TOP

Related Classes of edu.brown.hstore.txns.AbstractTransaction

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.