Package edu.brown.workload

Examples of edu.brown.workload.TransactionTrace


     */
    public void testWeightedQueryInvalidateCache() throws Throwable {
        // Make a new workload that only has a single weighted copy of our multi-partition transaction
        Workload new_workload = new Workload(catalogContext.catalog);
        int weight = 6;
        TransactionTrace multip_txn = this.getMultiPartitionTransaction();
        Procedure catalog_proc = multip_txn.getCatalogItem(catalogContext.database);
        TransactionTrace clone = (TransactionTrace)multip_txn.clone();
        clone.setTransactionId(1000);
        for (QueryTrace qt : clone.getQueries()) {
            qt.setWeight(weight);
        }
        new_workload.addTransaction(catalog_proc, clone);
        assertEquals(1, new_workload.getTransactionCount());
        assertEquals(multip_txn.getQueryCount(), new_workload.getQueryCount());
View Full Code Here


    /**
     * testHistograms
     */
    public void testHistograms() throws Exception {
        // Grab a txn with a JOIN
        TransactionTrace xact_trace = null;
        for (TransactionTrace xact : workload.getTransactions()) {
            assertNotNull(xact);
            if (xact.getCatalogItemName().equals(TARGET_PROCEDURES[2])) {
                xact_trace = xact;
                break;
            }
        } // FOR
        assertNotNull(xact_trace);

        // Change the catalog so that the data from the tables are in different partitions
        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        assertNotNull(clone_db);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
        Table catalog_tbl = clone_db.getTables().get(TM1Constants.TABLENAME_CALL_FORWARDING);
        assertNotNull(catalog_tbl);
        Column catalog_col = catalog_tbl.getColumns().get("START_TIME");
        assertNotNull(catalog_col);
        catalog_tbl.setPartitioncolumn(catalog_col);
       
        // Throw the TransactionTrace at the costmodel and make sure that there is a TransactionCacheEntry
        SingleSitedCostModel cost_model = new SingleSitedCostModel(clone_catalogContext);
        cost_model.estimateTransactionCost(clone_catalogContext, xact_trace);
        cost_model.setCachingEnabled(true);
        TransactionCacheEntry entry = cost_model.getTransactionCacheEntry(xact_trace);
        assertNotNull(entry);
//        System.err.println(entry.toString());

        // --------------------------
        // Query Counters
        // --------------------------
        assertEquals(xact_trace.getQueries().size(), entry.getTotalQueryCount());
        assertEquals(xact_trace.getQueries().size(), entry.getExaminedQueryCount());
        assertEquals(0, entry.getSingleSiteQueryCount());
        assertEquals(1, entry.getMultiSiteQueryCount());
       
        // ---------------------------------------------
        // Partitions Touched by Txns
View Full Code Here

   
    /**
     * testEstimateCost
     */
    public void testEstimateCost() throws Exception {
        TransactionTrace xact_trace = null;
        for (TransactionTrace xact : workload.getTransactions()) {
            assertNotNull(xact);
            if (xact.getCatalogItemName().equals(TARGET_PROCEDURES[0])) {
                xact_trace = xact;
                break;
            }
        } // FOR
        assertNotNull(xact_trace);
       
        // System.err.println(xact_trace.debug(catalogContext.database));
        SingleSitedCostModel cost_model = new SingleSitedCostModel(catalogContext);
        cost_model.estimateTransactionCost(catalogContext, xact_trace);
        TransactionCacheEntry entry = cost_model.getTransactionCacheEntry(xact_trace);
        assertNotNull(entry);
       
        assertEquals(xact_trace.getQueries().size(), entry.getTotalQueryCount());
        assertEquals(xact_trace.getQueries().size(), entry.getExaminedQueryCount());
        assertEquals(1, entry.getSingleSiteQueryCount());
        assertEquals(1, entry.getMultiSiteQueryCount());
       
        // Check Partition Access Histogram
        Histogram<Integer> hist_access = cost_model.getQueryPartitionAccessHistogram();
View Full Code Here

        // This will cause the Txn entry to be thrown out completely because all the
        // queries have been invalidated
        cost_model.invalidateCache(this.getTable(TM1Constants.TABLENAME_SUBSCRIBER));
        cost_model.invalidateCache(this.getTable(TM1Constants.TABLENAME_CALL_FORWARDING));
       
        TransactionTrace xact_trace = xacts.get(0);
        assertNotNull(xact_trace);
        TransactionCacheEntry entry = cost_model.getTransactionCacheEntry(xact_trace);
        assertNull(entry);
       
        // Make sure that we updated the Execution Histogram
View Full Code Here

        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        assertNotNull(clone_db);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
       
        Procedure catalog_proc = this.getProcedure(clone_db, GetAccessData.class);
        TransactionTrace target_txn = null;
        for (TransactionTrace txn : workload.getTransactions()) {
            if (txn.getCatalogItemName().equals(catalog_proc.getName())) {
                target_txn = txn;
                break;
            }
View Full Code Here

     */
    public void testMultiColumnPartitioning() throws Exception {
        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
        Procedure catalog_proc = this.getProcedure(clone_db, GetAccessData.class);
        TransactionTrace target_txn = null;
        for (TransactionTrace txn : workload.getTransactions()) {
            if (txn.getCatalogItemName().equals(catalog_proc.getName())) {
                target_txn = txn;
                break;
            }
        } // FOR
        assertNotNull(target_txn);
        System.err.println(target_txn.debug(catalogContext.database));
       
        // Now change partitioning
        MultiProcParameter catalog_param = MultiProcParameter.get(catalog_proc.getParameters().get(0), catalog_proc.getParameters().get(1));
        assertNotNull(catalog_param);
        catalog_proc.setPartitionparameter(catalog_param.getIndex());
View Full Code Here

                @Override
                public String debugImpl() { return null; }
                @Override
                protected void resetImpl() { }
            }, workload);
            TransactionTrace txn0 = CollectionUtil.first(workload.getTransactions());
            assertNotNull(txn0);
            TransactionTrace txn1 = CollectionUtil.first(clone.getTransactions());
            assertNotNull(txn1);
            assert(txn0.getTransactionId() != txn1.getTransactionId());
           
            // assertEquals(WORKLOAD_XACT_LIMIT, workload.getTransactionCount());

            // for (TransactionTrace xact : workload.getTransactions()) {
            // System.err.println(xact + ": " + p_estimator.getAllPartitions(xact));
View Full Code Here

        Iterator<TransactionTrace> it = workload.iterator(filter);
        assertNotNull(it);

        int count = 0;
        while (it.hasNext()) {
            TransactionTrace element = it.next();
            String name = element.getCatalogItemName();
            assert(results.containsKey(name)) : "Unexpected " + name;
            results.put(name, results.get(name) + 1);
            count++;
        } // WHILE
        assert(count > 0);
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;
                int base_partition = p_estimator.getBasePartition(txn.getCatalogItem(catalog_db), txn.getParams(), true);
                assert(base_partition != HStoreConstants.NULL_PARTITION_ID);
                assertEquals(BASE_PARTITION, base_partition);
                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());
                Object val = txn.getParam(PARAM_IDX);
                assertNotNull(val);
                assertEquals(txn.toString(), PARAM_VALUE, val);
                count++;
            }
        } // WHILE
        assert(count > 0);
    }
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.