Package edu.brown.workload

Examples of edu.brown.workload.TransactionTrace


        int count = 0;
        while (it.hasNext()) {
            AbstractTraceElement<? extends CatalogType> element = it.next();
            if (element instanceof TransactionTrace) {
                // Make sure that this txn's base partition is what we expect it to be
                TransactionTrace txn = (TransactionTrace)element;
                partitions.clear();
                p_estimator.getAllPartitions(partitions, txn);
                assertNotNull(partitions);
                assertEquals(1, partitions.size());
                count++;
View Full Code Here


        int count = 0;
        while (it.hasNext()) {
            AbstractTraceElement<? extends CatalogType> element = it.next();
            if (element instanceof TransactionTrace) {
                // Make sure that this txn's base partition is what we expect it to be
                TransactionTrace txn = (TransactionTrace)element;
                partitions.clear();
                p_estimator.getAllPartitions(partitions, txn);
                assertNotNull(partitions);
                assertNotSame(1, partitions.size());
                count++;
View Full Code Here

        int count = 0;
        while (it.hasNext()) {
            AbstractTraceElement<? extends CatalogType> element = it.next();
            if (element instanceof TransactionTrace) {
                // Make sure that all of the array parameters have the same size
                TransactionTrace txn = (TransactionTrace)element;
                assertEquals(TARGET_PROCEDURE, txn.getCatalogItemName());
                for (ProcParameter param : this.array_params) {
                    int param_idx = param.getIndex();
                    assert(param_idx < txn.getParamCount());
                    Object txn_param = txn.getParam(param_idx);
                    assert(ClassUtil.isArray(txn_param)) : "Param Idx #" + param_idx + "\n" + txn.debug(catalog_db);
                    assertEquals(ARRAY_SIZE, ((Object[])txn_param).length);
                } // FOR
                count++;
            }
        } // WHILE
View Full Code Here

        int count = 0;
        while (it.hasNext()) {
            AbstractTraceElement<? extends CatalogType> element = it.next();
            if (element instanceof TransactionTrace) {
                // Make sure that all of the array parameters have the same size
                TransactionTrace txn = (TransactionTrace)element;
                assertEquals(TARGET_PROCEDURE, txn.getCatalogItemName());
                for (ProcParameter param : this.array_params) {
                    int param_idx = param.getIndex();
                    assert(param_idx < txn.getParamCount());
                    Object txn_param = txn.getParam(param_idx);
                    assert(ClassUtil.isArray(txn_param)) : "Param Idx #" + param_idx + "\n" + txn.debug(catalog_db);
                    assert(((Object[])txn_param).length < ARRAY_SIZE);
                } // FOR
                count++;
            }
        } // WHILE
View Full Code Here

        int num_txns = 20;
        int num_intervals = 5;
       
        // Make a workload that has the same transaction in it multiple times
        Workload new_workload = new Workload(catalog);
        TransactionTrace multip_txn = CollectionUtil.first(multip_workload);
        Procedure catalog_proc = multip_txn.getCatalogItem(catalog_db);
        for (int i = 0; i < num_txns; i++) {
            TransactionTrace clone = (TransactionTrace)multip_txn.clone();
            clone.setTransactionId(i);
            clone.setTimestamps(new Long((i/5)*1000), new Long((i/5)*1000 + 100));
//            System.err.println(clone.debug(catalog_db) + "\n");
            new_workload.addTransaction(catalog_proc, clone);
        } // FOR
        assertEquals(num_txns, new_workload.getTransactionCount());
        TimeIntervalCostModel<SingleSitedCostModel> orig_costModel = new TimeIntervalCostModel<SingleSitedCostModel>(catalogContext, SingleSitedCostModel.class, num_intervals);
        double cost0 = orig_costModel.estimateWorkloadCost(catalogContext, new_workload);
       
        // Now change make a new workload that has the same multi-partition transaction
        // but this time it only has one but with a transaction weight
        // We should get back the exact same cost
//        System.err.println("+++++++++++++++++++++++++++++++++++++++++++++");
        new_workload = new Workload(catalog);
        for (int i = 0; i < num_txns/5; i++) {
            TransactionTrace clone = (TransactionTrace)multip_txn.clone();
            clone.setTransactionId(i);
            clone.setTimestamps(new Long((i*5)*1000), new Long((i*5)*1000 + 100));
            clone.setWeight(5);
//            System.err.println(clone.debug(catalog_db) + "\n");
            new_workload.addTransaction(catalog_proc, clone);
        } // FOR
       
        TimeIntervalCostModel<SingleSitedCostModel> new_costModel = new TimeIntervalCostModel<SingleSitedCostModel>(catalogContext, SingleSitedCostModel.class, num_intervals);
View Full Code Here

        for (int i = 0, cnt = data.numInstances(); i < cnt; i++) {
            Instance inst = data.instance(i);
            assertNotNull(inst);
            long txn_id = FeatureUtil.getTransactionId(inst);

            TransactionTrace txn_trace = workload.getTransaction(txn_id);
            assertNotNull(txn_trace);
            Integer base_partition = p_estimator.getBasePartition(txn_trace);
            assertNotNull(base_partition);
            assertEquals(base_partition.intValue(), (int)inst.value(base_partition_idx));
View Full Code Here

            }
           
            @Override
            protected FilterResult filter(AbstractTraceElement<? extends CatalogType> element) {
                if (element instanceof TransactionTrace) {
                    TransactionTrace xact = (TransactionTrace)element;
                    try {
                        int partition = p_estimator.getBasePartition(xact);
                        if (partition == HStoreConstants.NULL_PARTITION_ID) System.err.println(xact.debug(catalog_db));
                        assert(partition != HStoreConstants.NULL_PARTITION_ID);
                       
                        if (txn_for_partition.get(partition)) {
                            return (FilterResult.SKIP);   
                        }
View Full Code Here

            }
           
            @Override
            protected FilterResult filter(AbstractTraceElement<? extends CatalogType> element) {
                if (element instanceof TransactionTrace) {
                    TransactionTrace xact = (TransactionTrace)element;
                    try {
                        int partition = p_estimator.getBasePartition(xact);
                        if (partition == HStoreConstants.NULL_PARTITION_ID) System.err.println(xact.debug(catalog_db));
                        assert(partition != HStoreConstants.NULL_PARTITION_ID);
                       
                        double next = rand.nextDouble();
                        double prob = probs.get(partition);
                        boolean skip = (next > prob);
View Full Code Here

            String value = inst.stringValue(txn_id_idx);
//            System.err.println("VALUE:    " + value);
            Long txn_id = Long.valueOf(value);
            assertNotNull(txn_id);
           
            TransactionTrace txn_trace = workload.getTransaction(txn_id);
            TransactionTrace expected = txns.get(i);
//            System.err.println("EXPECTED: " + expected.getTransactionId());
//            System.err.println("FOUND:    " + txn_id);
           
            assertNotNull(String.format("[%05d] Failed to txn #%d", i, txn_id), txn_trace);
            assertEquals(expected.getTransactionId(), txn_trace.getTransactionId());
        } // FOR
    }
View Full Code Here

            } // FOR
            this.params[i] = arr;
        } // FOR
       
        this.catalog_proc = this.getProcedure(TARGET_PROCEDURE);
        this.txn_trace = new TransactionTrace(1234, this.catalog_proc, this.params);
        this.fset = new FeatureSet();
       
    }
View Full Code Here

TOP

Related Classes of edu.brown.workload.TransactionTrace

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.