Package org.voltdb.catalog

Examples of org.voltdb.catalog.Cluster


            "   </users>" +
            "</deployment>";

        final File tmpSecOff = VoltProjectBuilder.writeStringToTempFile(secOff);
        CatalogUtil.compileDeployment(catalog, tmpSecOff.getPath(), true, false);
        Cluster cluster =  catalog.getClusters().get("cluster");
        Database db = cluster.getDatabases().get("database");
        assertTrue(cluster.getSecurityenabled());
        assertEquals("hash", db.getSecurityprovider());

        setUp();
        final File tmpSecOn = VoltProjectBuilder.writeStringToTempFile(secOn);
        CatalogUtil.compileDeployment(catalog, tmpSecOn.getPath(), true, false);
        cluster =  catalog.getClusters().get("cluster");
        db = cluster.getDatabases().get("database");
        assertTrue(cluster.getSecurityenabled());
        assertEquals("kerberos", db.getSecurityprovider());
    }
View Full Code Here


        }
    }

    public void testCompileDeploymentAgainstEmptyCatalog() {
        Catalog catalog = new Catalog();
        Cluster cluster = catalog.getClusters().add("cluster");
        cluster.getDatabases().add("database");

        String deploymentContent =
            "<?xml version=\"1.0\"?>\n" +
            "<deployment>\n" +
            "    <cluster hostcount='1' sitesperhost='1' kfactor='0' />\n" +
View Full Code Here

            "</deployment>";

        final File tmpNoElement = VoltProjectBuilder.writeStringToTempFile(noElement);
        long crc = CatalogUtil.compileDeployment(catalog, tmpNoElement.getPath(), true, false);
        assertTrue("Deployment file failed to parse", crc != -1);
        Cluster cluster = catalog.getClusters().get("cluster");
        assertTrue(cluster.getNetworkpartition());
        assertEquals("partition_detection", cluster.getFaultsnapshots().get("CLUSTER_PARTITION").getPrefix());

        setUp();
        final File tmpEnabledDefault = VoltProjectBuilder.writeStringToTempFile(ppdEnabledDefaultPrefix);
        crc = CatalogUtil.compileDeployment(catalog, tmpEnabledDefault.getPath(), true, false);
        assertTrue("Deployment file failed to parse", crc != -1);
        cluster = catalog.getClusters().get("cluster");
        assertTrue(cluster.getNetworkpartition());
        assertEquals("partition_detection", cluster.getFaultsnapshots().get("CLUSTER_PARTITION").getPrefix());

        setUp();
        final File tmpEnabledPrefix = VoltProjectBuilder.writeStringToTempFile(ppdEnabledWithPrefix);
        crc = CatalogUtil.compileDeployment(catalog, tmpEnabledPrefix.getPath(), true, false);
        assertTrue("Deployment file failed to parse", crc != -1);
        cluster = catalog.getClusters().get("cluster");
        assertTrue(cluster.getNetworkpartition());
        assertEquals("testPrefix", cluster.getFaultsnapshots().get("CLUSTER_PARTITION").getPrefix());

        setUp();
        final File tmpDisabled = VoltProjectBuilder.writeStringToTempFile(ppdDisabledNoPrefix);
        crc = CatalogUtil.compileDeployment(catalog, tmpDisabled.getPath(), true, false);
        assertTrue("Deployment file failed to parse", crc != -1);
        cluster = catalog.getClusters().get("cluster");
        assertFalse(cluster.getNetworkpartition());
    }
View Full Code Here

            "   <cluster hostcount='3' kfactor='1' sitesperhost='2' schema='ddl'/>" +
            "</deployment>";

        final File tmpDefSchema = VoltProjectBuilder.writeStringToTempFile(defSchema);
        CatalogUtil.compileDeployment(catalog, tmpDefSchema.getPath(), true, false);
        Cluster cluster =  catalog.getClusters().get("cluster");
        assertFalse(cluster.getUseddlschema());

        setUp();
        final File tmpCatalogSchema = VoltProjectBuilder.writeStringToTempFile(catalogSchema);
        CatalogUtil.compileDeployment(catalog, tmpCatalogSchema.getPath(), true, false);
        cluster =  catalog.getClusters().get("cluster");
        assertFalse(cluster.getUseddlschema());

        setUp();
        final File tmpAdhocSchema = VoltProjectBuilder.writeStringToTempFile(adhocSchema);
        CatalogUtil.compileDeployment(catalog, tmpAdhocSchema.getPath(), true, false);
        cluster =  catalog.getClusters().get("cluster");
        assertTrue(cluster.getUseddlschema());
    }
View Full Code Here

            partitioning = StatementPartitioning.forceSP();
        } else {
            partitioning = StatementPartitioning.forceMP();
        }
        String procName = catalogStmt.getParent().getTypeName();
        Cluster catalogCluster = catalog.getClusters().get("cluster");
        QueryPlanner planner = new QueryPlanner(sql, stmtLabel, procName, catalogCluster, db,
                partitioning, hsql, estimates, false, StatementCompiler.DEFAULT_MAX_JOIN_TABLES,
                costModel, null, joinOrder, detMode);

        CompiledPlan plan = null;
View Full Code Here

                }
            }

            // create a dummy catalog to load deployment info into
            Catalog catalog = new Catalog();
            Cluster cluster = catalog.getClusters().add("cluster");
            Database db = cluster.getDatabases().add("database");

            // create groups as needed for users
            if (m_deployment.getUsers() != null) {
                for (UsersType.User user : m_deployment.getUsers().getUser()) {
                    Set<String> roles = CatalogUtil.mergeUserRoles(user);
View Full Code Here

                new VoltTable.ColumnInfo("I_PRICE", VoltType.FLOAT),
                new VoltTable.ColumnInfo("I_DATA", VoltType.STRING)
                );
        TPCCProjectBuilder builder = new TPCCProjectBuilder();
        m_catalog = builder.createTPCCSchemaCatalog();
        Cluster cluster = m_catalog.getClusters().get("cluster");
        WAREHOUSE_TABLEID = m_catalog.getClusters().get("cluster").getDatabases().
                get("database").getTables().get("WAREHOUSE").getRelativeIndex();
        ITEM_TABLEID = m_catalog.getClusters().get("cluster").getDatabases().
                get("database").getTables().get("ITEM").getRelativeIndex();
        CatalogMap<Procedure> procedures = cluster.getDatabases().get("database").getProcedures();
        m_testProc = procedures.getIgnoreCase("FragmentUpdateTestProcedure");
        m_ee = new ExecutionEngineJNI(
                CLUSTER_ID,
                NODE_ID,
                0,
View Full Code Here

                return false;
            }
            return true;
        }

        Cluster cluster = catalog.getClusters().get("cluster");
        Database database = cluster.getDatabases().get("database");
        Set<String> validGroups = new HashSet<String>();
        for (Group group : database.getGroups()) {
            validGroups.add(group.getTypeName());
        }
View Full Code Here

        ClusterConfig config = new ClusterConfig(hostCount, sitesPerHost, kFactor);

        if (!config.validate()) {
            hostLog.error(config.getErrorMsg());
        } else {
            Cluster catCluster = catalog.getClusters().get("cluster");
            // copy the deployment info that is currently not recorded anywhere else
            Deployment catDeploy = catCluster.getDeployment().get("deployment");
            catDeploy.setHostcount(hostCount);
            catDeploy.setSitesperhost(sitesPerHost);
            catDeploy.setKfactor(kFactor);
            // copy partition detection configuration from xml to catalog
            String defaultPPDPrefix = "partition_detection";
            if (deployment.getPartitionDetection() != null) {
                if (deployment.getPartitionDetection().isEnabled()) {
                    catCluster.setNetworkpartition(true);
                    CatalogMap<SnapshotSchedule> faultsnapshots = catCluster.getFaultsnapshots();
                    SnapshotSchedule sched = faultsnapshots.add("CLUSTER_PARTITION");
                    if (deployment.getPartitionDetection().getSnapshot() != null) {
                        sched.setPrefix(deployment.getPartitionDetection().getSnapshot().getPrefix());
                    }
                    else {
                        sched.setPrefix(defaultPPDPrefix);
                    }
                }
                else {
                    catCluster.setNetworkpartition(false);
                }
            }
            else {
                // Default partition detection on
                catCluster.setNetworkpartition(true);
                CatalogMap<SnapshotSchedule> faultsnapshots = catCluster.getFaultsnapshots();
                SnapshotSchedule sched = faultsnapshots.add("CLUSTER_PARTITION");
                sched.setPrefix(defaultPPDPrefix);
            }

            // copy admin mode configuration from xml to catalog
            if (deployment.getAdminMode() != null)
            {
                catCluster.setAdminport(deployment.getAdminMode().getPort());
                catCluster.setAdminstartup(deployment.getAdminMode().isAdminstartup());
            }
            else
            {
                // encode the default values
                catCluster.setAdminport(VoltDB.DEFAULT_ADMIN_PORT);
                catCluster.setAdminstartup(false);
            }

            setSystemSettings(deployment, catDeploy);

            if (deployment.getHeartbeat() != null)
            {
                catCluster.setHeartbeattimeout(deployment.getHeartbeat().getTimeout());
            }
            else
            {
                // default to 10 seconds
                catCluster.setHeartbeattimeout(10);
            }

            // copy schema modification behavior from xml to catalog
            if (cluster.getSchema() != null) {
                catCluster.setUseddlschema(cluster.getSchema() == SchemaType.DDL);
            }
            else {
                // Don't think we can get here, deployment schema guarantees a default value
                hostLog.warn("Schema modification setting not found. " +
                        "Forcing default behavior of UpdateCatalog to modify database schema.");
                catCluster.setUseddlschema(false);
            }
        }
    }
View Full Code Here

     * Set the security setting in the catalog from the deployment file
     * @param catalog the catalog to be updated
     * @param security security element of the deployment xml
     */
    private static void setSecurityEnabled( Catalog catalog, SecurityType security) {
        Cluster cluster = catalog.getClusters().get("cluster");
        Database database = cluster.getDatabases().get("database");

        boolean enabled = false;
        if (security != null) {
            enabled = security.isEnabled();
        }
        cluster.setSecurityenabled(enabled);

        SecurityProviderString provider = SecurityProviderString.HASH;
        if (enabled && security != null) {
            if (security.getProvider() != null) {
                provider = security.getProvider();
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Cluster

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.