Examples of Estimate


Examples of edu.brown.hstore.estimators.Estimate

            assertEquals(txn_id, state.getTransactionId().longValue());
//            System.err.printf("W_ID=%d / S_W_ID=%s\n", w_id, remote_w_id);
           
            // Make sure that it identifies that we are a distributed transaction and
            // that we expect to touch both the W_ID partition and the REMOTE_W_ID partition
            Estimate est = state.getInitialEstimate();
            assertNotNull(est);
            PartitionSet partitions = est.getTouchedPartitions(thresholds);
            assertEquals(2, partitions.size());
            for (int expected : new int[]{ w_id, remote_w_id }) {
                expected = hasher.hash(expected);
                assertTrue(Integer.toString(expected) + "->" + partitions, partitions.contains(expected));
            } // FOR
View Full Code Here

Examples of edu.brown.hstore.estimators.Estimate

        EstimatorState estState = ts.getEstimatorState();
        assertNotNull(estState);
        assertEquals(MarkovEstimatorState.class, estState.getClass());
        assertTrue(estState.isInitialized());
       
        Estimate est = estState.getInitialEstimate();
        assertNotNull(est);
        assertEquals(MarkovEstimate.class, est.getClass());
       
       
    }
View Full Code Here

Examples of edu.brown.hstore.estimators.Estimate

                }
                // We have a EstimatorState handle, so let's see what it says...
                else {
                    if (trace.val)
                        LOG.trace("\n" + StringBoxUtil.box(t_state.toString()));
                    Estimate t_estimate = t_state.getInitialEstimate();
                   
                    // Bah! We didn't get back a Estimation for some reason...
                    if (t_estimate == null) {
                        if (debug.val)
                            LOG.debug(String.format("%s - No %s handle was return. Using default estimate.",
                                      TransactionUtil.formatTxnName(catalog_proc, txn_id),
                                      Estimate.class.getSimpleName()));
                    }
                    // Invalid Estimation. Stick with defaults
                    else if (t_estimate.isValid() == false) {
                        if (debug.val)
                            LOG.debug(String.format("%s - %s is marked as invalid. Using default estimate.\n%s",
                                      TransactionUtil.formatTxnName(catalog_proc, txn_id),
                                      t_estimate.getClass().getSimpleName(), t_estimate));
                    }   
                    // Use Estimation to determine things
                    else {
                        if (debug.val) {
                            LOG.debug(String.format("%s - Using %s to determine if txn is single-partitioned",
                                      TransactionUtil.formatTxnName(catalog_proc, txn_id),
                                      t_estimate.getClass().getSimpleName()));
                            LOG.trace(String.format("%s %s:\n%s",
                                      TransactionUtil.formatTxnName(catalog_proc, txn_id),
                                      t_estimate.getClass().getSimpleName(), t_estimate));
                        }
                        predict_partitions = t_estimate.getTouchedPartitions(this.thresholds);
                        predict_readOnly = t_estimate.isReadOnlyAllPartitions(this.thresholds);
                        predict_abortable = (predict_partitions.size() == 1 ||
                                             predict_readOnly == false ||
                                             t_estimate.isAbortable(this.thresholds));
                       
                        // Check whether the TransactionEstimator *really* thinks that we should
                        // give it updates about this txn. If the flag is false, then we'll
                        // check whether the updates are enabled in the HStoreConf parameters
                        if (t_state.shouldAllowUpdates() == false) {
View Full Code Here

Examples of edu.brown.hstore.estimators.Estimate

       
        // Get the current TransactionEstimate for the DTXN and the
        // initial TransactionEstimate for the single-partition txn
        // We need to make sure that both estimates have the list of
        // queries that the transaction is going to execute
        Estimate dtxnEst = dtxnState.getLastEstimate();
        if (dtxnEst == null) {
            if (debug.val)
                LOG.warn(String.format("Unexpected null %s in the %s for %s",
                         Estimate.class.getSimpleName(), dtxnState.getClass().getSimpleName(), dtxn));
            return (true);
        }
        else if (dtxnEst.hasQueryEstimate(partitionId) == false) {
            if (debug.val)
                LOG.warn(String.format("No query list estimate is available for dtxn %s", dtxn));
            return (true);
        }
        Estimate tsEst = tsState.getInitialEstimate();
        assert(tsEst != null);
        if (tsEst.hasQueryEstimate(partitionId) == false) {
            if (debug.val)
                LOG.warn(String.format("No query list estimate is available for candidate %s", candidate));
            return (true);
        }
       
        // If both txns are read-only, then we can let our homeboy go
//        boolean readonly0 = dtxnEst.isReadOnlyPartition(this.thresholds, partitionId);
//        boolean readonly1 = tsEst.isReadOnlyPartition(this.thresholds, partitionId);
//        if (readonly0 && readonly1) {
//            if (debug.val)
//                LOG.debug(String.format("%s<->%s are both are read-only. No conflict!", dtxn, ts));
//            return (false);
//        }
       
        List<CountedStatement> queries0 = dtxnEst.getQueryEstimate(partitionId);
        List<CountedStatement> queries1 = tsEst.getQueryEstimate(partitionId);
       
        return (this.canExecute(dtxn, queries0, candidate, queries1) == false);
    }
View Full Code Here

Examples of edu.brown.hstore.estimators.Estimate

                undoToken = this.getNextUndoToken();
            }
            // If we originally executed this transaction with undo buffers and we have a MarkovEstimate,
            // then we can go back and check whether we want to disable undo logging for the rest of the transaction
            else if (ts.getEstimatorState() != null && singlePartition && ts.isSpeculative() == false) {
                Estimate est = ts.getEstimatorState().getLastEstimate();
                assert(est != null) : "Got back null MarkovEstimate for " + ts;
                if (hstore_conf.site.exec_no_undo_logging == false ||
                    est.isValid() == false ||
                    est.isAbortable(this.thresholds) ||
                    est.isReadOnlyPartition(this.thresholds, this.partitionId) == false) {
                    undoToken = lastUndoToken;
                } else if (debug.val) {
                    LOG.warn(String.format("Bold! Disabling undo buffers for inflight %s\n%s", ts, est));
                }
            }
View Full Code Here

Examples of edu.brown.hstore.estimators.Estimate

        // sure that we don't touch any partition other than our local one. If we do, then we need abort
        // it and restart it as multi-partitioned
        boolean need_restart = false;
        boolean predict_singlepartition = ts.isPredictSinglePartition();
        PartitionSet done_partitions = ts.getDonePartitions();
        Estimate t_estimate = ts.getLastEstimate();
       
        // Now we can go back through and start running all of the WorkFragments that were not blocked
        // waiting for an input dependency. Note that we pack all the fragments into a single
        // CoordinatorFragment rather than sending each WorkFragment in its own message
        for (WorkFragment.Builder fragmentBuilder : fragmentBuilders) {
            assert(this.depTracker.isBlocked(ts, fragmentBuilder) == false);
            final int target_partition = fragmentBuilder.getPartitionId();
            final int target_site = catalogContext.getSiteIdForPartitionId(target_partition);
            final PartitionSet doneNotifications = (notify != null ? notify.getNotifications(target_site) : null);
           
            // Make sure that this isn't a single-partition txn trying to access a remote partition
            if (predict_singlepartition && target_partition != this.partitionId) {
                if (debug.val)
                    LOG.debug(String.format("%s - Txn on partition %d is suppose to be " +
                              "single-partitioned, but it wants to execute a fragment on partition %d",
                              ts, this.partitionId, target_partition));
                need_restart = true;
                break;
            }
            // Make sure that this txn isn't trying to access a partition that we said we were
            // done with earlier
            else if (done_partitions.contains(target_partition)) {
                if (debug.val)
                    LOG.warn(String.format("%s on partition %d was marked as done on partition %d " +
                             "but now it wants to go back for more!",
                             ts, this.partitionId, target_partition));
                need_restart = true;
                break;
            }
            // Make sure we at least have something to do!
            else if (fragmentBuilder.getFragmentIdCount() == 0) {
                LOG.warn(String.format("%s - Trying to send a WorkFragment request with 0 fragments", ts));
                continue;
            }
           
            // Add in the specexec query estimate at this partition if needed
            if (hstore_conf.site.specexec_enable && t_estimate != null && t_estimate.hasQueryEstimate(target_partition)) {
                List<CountedStatement> queryEst = t_estimate.getQueryEstimate(target_partition);
                // if (debug.val)
                if (target_partition == 0)
                    if (debug.val)
                        LOG.debug(String.format("%s - Sending remote query estimate to partition %d " +
                                  "containing %d queries\n%s",
View Full Code Here

Examples of edu.brown.hstore.estimators.Estimate

        long undoToken = this.calculateNextUndoToken(ts, is_localReadOnly);
        ts.initFirstRound(undoToken, batchSize);
        final boolean predict_singlePartition = ts.isPredictSinglePartition();
       
        // Calculate whether we are finished with partitions now
        final Estimate lastEstimate = ts.getLastEstimate();
        DonePartitionsNotification notify = null;
        if (hstore_conf.site.exec_early_prepare && ts.isSysProc() == false && ts.allowEarlyPrepare()) {
            notify = this.computeDonePartitions(ts, lastEstimate, tmp_fragmentsPerPartition, finalTask);
            if (notify != null && notify.hasSitesToNotify())
                this.notifyDonePartitions(ts, notify);
View Full Code Here

Examples of gr.ntua.irmos.stubs.MapService_instance.Estimate

      // Access value
      System.out.println("Current value: "
          + map.getValueRP(new GetValueRP()));
     
      Estimate input=new Estimate();
      input.setAscid(args[1]);
      //change dynamically to whatever input in the following format [input1;input2;...;inputn]
      input.setHlinput("[1;1;1;1]");
      String result=map.estimate(input);
      System.out.println("Current result: "+result);


    } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.