Package org.voltdb

Examples of org.voltdb.CatalogContext


    /**
     * testTupleAccessCountIndex
     */
    public void testTupleAccessCountIndex() throws Exception {
        CatalogContext catalogContext = this.getCatalogContext();
        Client client = this.getClient();
        RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client);
       
        ClientResponse cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.TABLE);
        assertNotNull(cresponse);
View Full Code Here


   
    /**
     * testTupleAccessCountNoIndex
     */
    public void testTupleAccessCountNoIndex() throws Exception {
        CatalogContext catalogContext = this.getCatalogContext();
        Client client = this.getClient();
        RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client);
       
        ClientResponse cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.TABLE);
        assertNotNull(cresponse);
View Full Code Here

   
    /**
     * testRemoteQueryProfiling
     */
    public void testRemoteQueryProfiling() throws Exception {
        CatalogContext catalogContext = this.getCatalogContext();
       
        // Skip this test if there is only one partition
        if (catalogContext.numberOfPartitions == 1) return;
       
        Client client = this.getClient();
View Full Code Here

    /**
     * testIndexStats
     */
    public void testIndexStats() throws Exception {
        CatalogContext catalogContext = this.getCatalogContext();
        Client client = this.getClient();
        RegressionSuiteUtil.initializeTPCCDatabase(catalogContext, client);

        ClientResponse cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.INDEX);
        assertNotNull(cresponse);
        assertEquals(Status.OK, cresponse.getStatus());

        // Loop through each table and make sure that each index reports back at least
        // some amount of data.
        VoltTable result = cresponse.getResults()[0];
        for (Table tbl : catalogContext.getDataTables()) {
            if (tbl.getIndexes().isEmpty()) continue;

            for (Index idx : tbl.getIndexes()) {
                result.resetRowPosition();
                while (result.advanceRow()) {
View Full Code Here

    /**
     * testMultiColumnPartitioning
     */
    public void testMultiColumnPartitioning() throws Exception {
        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
        PartitionEstimator p_estimator = new PartitionEstimator(clone_catalogContext);

        Procedure catalog_proc = this.getProcedure(clone_db, GetNewDestination.class);
        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 0),   // S_ID
View Full Code Here

    /**
     * testMultiColumnPartitioningIncomplete
     */
    public void testMultiColumnPartitioningIncomplete() throws Exception {
        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
        PartitionEstimator p_estimator = new PartitionEstimator(clone_catalogContext);

        Procedure catalog_proc = this.getProcedure(clone_db, GetAccessData.class);
        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 0),   // S_ID
View Full Code Here

     */
    public void testMultiProcParameter() throws Exception {
        //  Try to partition TPC-C's neworder on W_ID and D_ID parameters
        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        Procedure catalog_proc = this.getProcedure(clone_db, neworder.class);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
        PartitionEstimator p_estimator = new PartitionEstimator(clone_catalogContext);

        ProcParameter catalog_params[] = new ProcParameter[] {
            this.getProcParameter(clone_db, catalog_proc, 0),   // W_ID
            this.getProcParameter(clone_db, catalog_proc, 1),   // D_ID
View Full Code Here

     */
    public void testMultiColumn() throws Exception {
        // Try to use multi-column partitioning on DISTRICT and see whether we can
        // actually get the right answer for neworder.getDistrict
        Database clone_db = CatalogCloner.cloneDatabase(catalogContext.database);
        CatalogContext clone_catalogContext = new CatalogContext(clone_db.getCatalog());
        Table catalog_tbl = this.getTable(clone_db, TPCCConstants.TABLENAME_DISTRICT);
        String table_key = CatalogKey.createKey(catalog_tbl);
       
        Column catalog_col0 = this.getColumn(clone_db, catalog_tbl, "D_ID");
        Column catalog_col1 = this.getColumn(clone_db, catalog_tbl, "D_W_ID");
View Full Code Here

     */
    @Test
    public void testReplicatedSelect() throws Exception {
        Catalog new_catalog = new Catalog();
        new_catalog.execute(catalogContext.catalog.serialize());
        CatalogContext new_catalogContext = new CatalogContext(new_catalog);
        final Table new_table = new_catalogContext.database.getTables().get(TPCCConstants.TABLENAME_WAREHOUSE);
        assertNotNull(new_table);
        new_table.setIsreplicated(true);
        new_table.setPartitioncolumn(new Column() {
            @SuppressWarnings("unchecked")
View Full Code Here

     */
    @Test
    public void testInvalidateCache() throws Exception {
        Catalog new_catalog = new Catalog();
        new_catalog.execute(catalogContext.catalog.serialize());
        CatalogContext new_catalogContext = new CatalogContext(new_catalog);
       
        final Table new_table = new_catalogContext.database.getTables().get(TPCCConstants.TABLENAME_WAREHOUSE);
        assertNotNull(new_table);
        new_table.setPartitioncolumn(new Column() {
            @SuppressWarnings("unchecked")
            @Override
            public <T extends CatalogType> T getParent() {
                return ((T)new_table);
            }
        });
       
        PartitionEstimator p_estimator = new PartitionEstimator(catalogContext, hasher);
        Procedure catalog_proc = this.getProcedure(neworder.class);
        Statement catalog_stmt = catalog_proc.getStatements().get("getWarehouseTaxRate");
        assertNotNull(catalog_stmt);
       
        // First calculate the partitions for the query using the original catalog
        // We should get back exactly one partition id (base_partition)
        Object params[] = new Object[] { new Long(BASE_PARTITION) };
        for (int i = 0; i < 10000; i++) {
            String debug = String.format("Attempt #%05d", i);
            this.partitions.clear();
            p_estimator.getAllPartitions(this.partitions, catalog_stmt, params, BASE_PARTITION);
            assertEquals(debug + " -> " + this.partitions.toString(), 1, this.partitions.size());
            assertEquals(debug, BASE_PARTITION, CollectionUtil.first(this.partitions).intValue());
            assertFalse(debug, this.partitions.contains(HStoreConstants.NULL_PARTITION_ID));
        } // FOR
       
        // Then reset the catalog in p_estimator and run the estimation again
        // The new catalog has a different partition column for WAREHOUSE, so we should get
        // back all the partitions
        p_estimator.initCatalog(new_catalogContext);
        catalog_proc = new_catalogContext.database.getProcedures().get(catalog_proc.getName());
        catalog_stmt = catalog_proc.getStatements().get("getWarehouseTaxRate");
       
        partitions.clear();
        p_estimator.getAllPartitions(partitions, catalog_stmt, params, BASE_PARTITION);
        PartitionSet all_partitions = new_catalogContext.getAllPartitionIds();
        assertNotNull(partitions);
        assertEquals(all_partitions.size(), partitions.size());
        assertFalse(partitions.contains(HStoreConstants.NULL_PARTITION_ID));
    }
View Full Code Here

TOP

Related Classes of org.voltdb.CatalogContext

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.