Package org.voltdb

Examples of org.voltdb.CatalogContext


        IOFileFilter filter = new IOFileFilter("Project Jar", "jar");
        Pair<Catalog, String> ret = null;
        try {
            String path = showLoadDialog("Open Catalog File from Project Jar", ".", filter);
            if (path != null) {
                CatalogContext new_catalog = CatalogUtil.loadCatalogContextFromJar(new File(path));
                ret = new Pair<Catalog, String>(new_catalog.catalog, path);
            }
        } catch (Exception ex) {
            ex.printStackTrace();
            showErrorDialog("Failed to open catalog from jar", ex.getMessage());
View Full Code Here


                c.execute(serializedCatalog);
            } catch (Exception ex) {
                throw new RuntimeException("Failed to load " + projectBuilder.getProjectName() + " catalog [" + catalogJar + "]", ex);
            }
           
            CatalogContext cc = new CatalogContext(c, catalogJar);
            this.init(this.last_type, cc);
        }
       
        catalog = catalogContext.catalog;
        catalog_db = catalogContext.database;
View Full Code Here

        super.setUp();
        this.last_type = type;
        catalogContext = project_catalogs.get(type);
       
        if (catalogContext == null) {
            CatalogContext cc = null;
            AbstractProjectBuilder projectBuilder = getProjectBuilder(type);
           
            if (ENABLE_JAR_REUSE) {
                File jar_path = projectBuilder.getJarPath(true);
                if (needs_reset.contains(type)) {
                    jar_path.delete();
                    needs_reset.remove(type);
                }
                if (jar_path.exists()) {
                    LOG.debug("LOAD CACHE JAR: " + jar_path.getAbsolutePath());
                    cc = CatalogUtil.loadCatalogContextFromJar(jar_path);
                } else {
                    LOG.debug("MISSING JAR: " + jar_path.getAbsolutePath());
                }
            }
            if (cc == null) {
                File jarPath = projectBuilder.getJarPath(true);
                Catalog c = null;
                switch (type) {
                    case TPCE:
                        c = projectBuilder.createCatalog(fkeys, full_catalog);
                        break;
                    default:
                        c = projectBuilder.getFullCatalog(fkeys);
                        if (LOG.isDebugEnabled())
                            LOG.debug(type + " Catalog JAR: " + jarPath.getAbsolutePath());
                        break;
                } // SWITCH
                assert(c != null);
                cc = new CatalogContext(c, jarPath);
            }
            assert(cc != null) : "Unexpected null catalog for " + type;
            //if (type == ProjectType.TPCC) ParametersUtil.populateCatalog(CatalogUtil.getDatabase(catalog), ParametersUtil.getParameterMapping(type));
            this.init(type, cc);
        }
View Full Code Here

            for (Integer i = 0; i < num_partitions; i++) {
                cc.addPartition("localhost", 0, i);
                // System.err.println("[" + i + "] " + Arrays.toString(triplets.lastElement()));
            } // FOR
            Catalog c = FixCatalog.cloneCatalog(catalog, cc);
            this.init(this.last_type, new CatalogContext(c, catalogContext.jarPath));
           
        }
        Cluster cluster = CatalogUtil.getCluster(catalog_db);
        assertEquals(num_partitions, cluster.getNum_partitions());
        assertEquals(num_partitions, catalogContext.numberOfPartitions);
View Full Code Here

            catalogContext.numberOfPartitions != (num_hosts * num_sites * num_partitions)) {
           
            // HACK
            String hostFormat = (num_hosts == 1 ? "localhost" : "host%02d");
            Catalog c = FixCatalog.cloneCatalog(catalog, hostFormat, num_hosts, num_sites, num_partitions);
            CatalogContext cc = new CatalogContext(c, catalogContext.jarPath);
            this.init(this.last_type, cc);
        }
        Cluster cluster = catalogContext.cluster;
        assertEquals(num_hosts, catalogContext.numberOfHosts);
        assertEquals((num_hosts * num_sites), catalogContext.numberOfSites);
View Full Code Here

        super(hstore_site);
        this.init_callback = new RemoteInitQueueCallback(hstore_site);
        this.work_callback = new RemoteWorkCallback(hstore_site);
        this.finish_callback = new RemoteFinishCallback(hstore_site);
       
        CatalogContext catalogContext = hstore_site.getCatalogContext();
        this.rpc_transactionPrefetch = new ProtoRpcController[catalogContext.numberOfPartitions];
    }
View Full Code Here

    /**
     * Constructor
     * @param hstore_site
     */
    public DistributedState(HStoreSite hstore_site) {
        CatalogContext catalogContext = hstore_site.getCatalogContext();
        this.notified_prepare = new BitSet(catalogContext.numberOfPartitions);
        this.sent_parameters = new BitSet(catalogContext.numberOfSites);
       
        this.prepare_callback = new LocalPrepareCallback(hstore_site);
        this.finish_callback = new LocalFinishCallback(hstore_site);
View Full Code Here

     */
    @Test
    public void testGetProcedure() throws Exception {
        ProjectType type = ProjectType.TPCC;
        this.bt.setUp(type);
        CatalogContext catalogContext = this.bt.getCatalogContext();
        assertNotNull(type.toString(), catalogContext);
       
        Procedure proc0, proc1;
       
        // Regular Procedure
View Full Code Here

    public void testParameterMappings() throws Exception {
        // Check to make sure that we can get the ParameterMappingsSet
        // from the CatalogContexts for the different projects
        for (ProjectType type : types) {
            this.bt.setUp(type);
            CatalogContext catalogContext = this.bt.getCatalogContext();
            assertNotNull(type.toString(), catalogContext);
            assertEquals(type.name().toLowerCase(), catalogContext.database.getProject());
            assertNotNull(type.toString(), catalogContext.paramMappings);
        } // FOR
    }
View Full Code Here

    /**
     * testInitialize
     */
    public void testInitialize() throws Exception {
        Client client = this.getClient();
        CatalogContext catalogContext = this.getCatalogContext();
        SEATSLoader loader = this.initializeSEATSDatabase(catalogContext, client);
        SEATSProfile profile = loader.getProfile();
        assertNotNull(profile);
       
        Set<String> allTables = new HashSet<String>();
        CollectionUtil.addAll(allTables, SEATSConstants.TABLES_SCALING);
        CollectionUtil.addAll(allTables, SEATSConstants.TABLES_DATAFILES);
       
        Map<String, Long> expected = new HashMap<String, Long>();
        expected.put(SEATSConstants.TABLENAME_FLIGHT, profile.num_flights);
        expected.put(SEATSConstants.TABLENAME_CUSTOMER, profile.num_customers);
        expected.put(SEATSConstants.TABLENAME_RESERVATION, profile.num_reservations);
       
        String procName = VoltSystemProcedure.procCallName(AdHoc.class);
        for (String tableName : allTables) {
            String query = "SELECT COUNT(*) FROM " + tableName;
            ClientResponse cresponse = client.callProcedure(procName, query);
            assertEquals(Status.OK, cresponse.getStatus());
            VoltTable results[] = cresponse.getResults();
            assertEquals(1, results.length);
            long count = results[0].asScalarLong();
           
            if (expected.containsKey(tableName)) {
                assertEquals(tableName, expected.get(tableName).longValue(), count);
            }
            else {
                assertTrue(tableName + " -> " + count, count > 0);
            }
        } // FOR
       
        // Make sure that our FLIGHT rows are correct
        String query = "SELECT * FROM " + SEATSConstants.TABLENAME_FLIGHT;
        ClientResponse cresponse = RegressionSuiteUtil.sql(client, query);
        VoltTable results[] = cresponse.getResults();
        assertEquals(profile.num_flights, results[0].getRowCount());
        Table tbl = catalogContext.getTableByName(SEATSConstants.TABLENAME_FLIGHT);
        assertEquals(tbl.getColumns().size(), results[0].getColumnCount());
        List<Column> notNullCols = new ArrayList<Column>();
        for (Column col : tbl.getColumns()) {
            if (col.getNullable() == false) notNullCols.add(col);
        }
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.