Package edu.brown.hstore.internal

Examples of edu.brown.hstore.internal.InternalMessage


            LOG.warn("Enabled Distributed Transaction Validation Checker");
        }
        // *********************************** DEBUG ***********************************

        // Things that we will need in the loop below
        InternalMessage nextWork = null;
        AbstractTransaction nextTxn = null;
        if (debug.val)
            LOG.debug("Starting PartitionExecutor run loop...");
        try {
            while (this.shutdown_state == ShutdownState.STARTED) {
                this.currentTxnId = null;
                nextTxn = null;
                nextWork = null;
               
                // This is the starting state of the PartitionExecutor.
                // At this point here we currently don't have a txn to execute nor
                // are we involved in a distributed txn running at another partition.
                // So we need to go our PartitionLockQueue and get back the next
                // txn that will have our lock.
                if (this.currentDtxn == null) {
                    this.tick();
                   
                    if (hstore_conf.site.exec_profiling) profiler.poll_time.start();
                    try {
                        nextTxn = this.queueManager.checkLockQueue(this.partitionId); // NON-BLOCKING
                    } finally {
                        if (hstore_conf.site.exec_profiling) profiler.poll_time.stopIfStarted();
                    }
                   
                    // If we get something back here, then it should become our current transaction.
                    if (nextTxn != null) {
                        // If it's a single-partition txn, then we can return the StartTxnMessage
                        // so that we can fire it off right away.
                        if (nextTxn.isPredictSinglePartition()) {
                            LocalTransaction localTxn = (LocalTransaction)nextTxn;
                            nextWork = localTxn.getStartTxnMessage();
                            if (hstore_conf.site.txn_profiling && localTxn.profiler != null)
                                localTxn.profiler.startQueueExec();
                        }
                        // If it's as distribued txn, then we'll want to just set it as our
                        // current dtxn at this partition and then keep checking the queue
                        // for more work.
                        else {
                            this.setCurrentDtxn(nextTxn);
                        }
                    }
                }
               
                // -------------------------------
                // Poll Work Queue
                // -------------------------------
               
                // Check if we have anything to do right now
                if (nextWork == null) {
                    if (hstore_conf.site.exec_profiling) profiler.idle_time.start();
                    try {
                        // If we're allowed to speculatively execute txns, then we don't want to have
                        // to wait to see if anything will show up in our work queue.
                        if (hstore_conf.site.specexec_enable && this.lockQueue.approximateIsEmpty() == false) {
                            nextWork = this.work_queue.poll();
                            /*if (nextWork != null) {
                                        System.out.println(String.format("Polled a work %s from partition %d",
                                                                          nextWork.getClass().getSimpleName(), this.work_queue.size()));
                            } else {
                                System.out.println("Null work!");
                            }*/
                        } else {
                            nextWork = this.work_queue.poll(WORK_QUEUE_POLL_TIME, WORK_QUEUE_POLL_TIMEUNIT);   
                            /*if (nextWork != null) {
                                        LOG.info(String.format("Polled a work %s from partition %d",
                                                                          nextWork.getClass().getSimpleName(), this.work_queue.size()));
                            } else {
                                LOG.info("Null work!");
                            }*/
                        }
                    } catch (InterruptedException ex) {
                        continue;
                    } finally {
                        if (hstore_conf.site.exec_profiling) profiler.idle_time.stopIfStarted();
                    }
                }
               
                // -------------------------------
                // Process Work
                // -------------------------------
                if (nextWork != null) {
                    if (trace.val) LOG.trace("Next Work: " + nextWork);
                    if (hstore_conf.site.exec_profiling) {
                        profiler.numMessages.put(nextWork.getClass().getSimpleName());
                        profiler.exec_time.start();
                        if (this.currentDtxn != null) profiler.sp2_time.stopIfStarted();
                    }
                    try {
                        // -------------------------------
View Full Code Here


        // -------------------------------
        // Poll Lock Queue
        // -------------------------------

        LocalTransaction specTxn = null;
        InternalMessage work = null;
       
        // Check whether there is something we can speculatively execute right now
        if (this.specExecIgnoreCurrent == false && this.lockQueue.approximateIsEmpty() == false) {
//            if (trace.val)
//                LOG.trace(String.format("Checking %s for something to do at partition %d while %s",
View Full Code Here

            LOG.warn("Halting transaction processing at partition " + this.partitionId);
       
        ExecutionMode origMode = this.currentExecMode;
        this.setExecutionMode(this.currentTxn, ExecutionMode.DISABLED_REJECT);
        List<InternalMessage> toKeep = new ArrayList<InternalMessage>();
        InternalMessage msg = null;
        while ((msg = this.work_queue.poll()) != null) {
            // -------------------------------
            // StartTxnMessage
            // -------------------------------
            if (msg instanceof StartTxnMessage) {
View Full Code Here

        this.workMsg = new WorkFragmentMessage(ts1, mockFragment);
    }
   
    private void checkOutputOrder(InternalMessage target, InternalMessage messages[]) {
        boolean ret;
        InternalMessage next = null;
       
        // First try them one by one
        for (InternalMessage m : messages) {
            this.queue.clear();
           
View Full Code Here

   
    /**
     * testWorkBeforeOthers
     */
    public void testWorkBeforeOthers() throws Exception {
        InternalMessage messages[] = { utilMsg, startMsg };
        this.checkOutputOrder(workMsg, messages);
    }
View Full Code Here

        assertTrue(ret);
        ret = this.queue.add(start1);
        assertTrue(ret);
       
        assertEquals(start1, this.queue.peek());
        InternalMessage next = this.queue.poll();
        assertEquals(start1, next);
       
        next = this.queue.poll();
        assertEquals(start0, next);
    }
View Full Code Here

TOP

Related Classes of edu.brown.hstore.internal.InternalMessage

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.