Package org.voltdb.catalog

Examples of org.voltdb.catalog.Cluster


     * @param paths A reference to the <paths> element of the deployment.xml file.
     * @param printLog Whether or not to print paths info.
     */
    private static void setPathsInfo(Catalog catalog, PathsType paths, boolean crashOnFailedValidation) {
        File voltDbRoot;
        final Cluster cluster = catalog.getClusters().get("cluster");
        // Handles default voltdbroot (and completely missing "paths" element).
        voltDbRoot = getVoltDbRoot(paths);

        validateDirectory("volt root", voltDbRoot, crashOnFailedValidation);

        PathEntry path_entry = null;
        if (paths != null)
        {
            path_entry = paths.getSnapshots();
        }
        File snapshotPath =
            getFeaturePath(paths, path_entry, voltDbRoot,
                           "snapshot", "snapshots");
        validateDirectory("snapshot path", snapshotPath, crashOnFailedValidation);

        path_entry = null;
        if (paths != null)
        {
            path_entry = paths.getExportoverflow();
        }
        File exportOverflowPath =
            getFeaturePath(paths, path_entry, voltDbRoot, "export overflow",
                           "export_overflow");
        validateDirectory("export overflow", exportOverflowPath, crashOnFailedValidation);

        // only use these directories in the enterprise version
        File commandLogPath = null;
        File commandLogSnapshotPath = null;

        path_entry = null;
        if (paths != null)
        {
            path_entry = paths.getCommandlog();
        }
        if (VoltDB.instance().getConfig().m_isEnterprise) {
            commandLogPath =
                    getFeaturePath(paths, path_entry, voltDbRoot, "command log", "command_log");
            validateDirectory("command log", commandLogPath, crashOnFailedValidation);
        }
        else {
            // dumb defaults if you ask for logging in community version
            commandLogPath = new VoltFile(voltDbRoot, "command_log");
        }

        path_entry = null;
        if (paths != null)
        {
            path_entry = paths.getCommandlogsnapshot();
        }
        if (VoltDB.instance().getConfig().m_isEnterprise) {
            commandLogSnapshotPath =
                getFeaturePath(paths, path_entry, voltDbRoot, "command log snapshot", "command_log_snapshot");
            validateDirectory("command log snapshot", commandLogSnapshotPath, crashOnFailedValidation);
        }
        else {
            // dumb defaults if you ask for logging in community version
            commandLogSnapshotPath = new VoltFile(voltDbRoot, "command_log_snapshot");;
        }

        //Set the volt root in the catalog
        catalog.getClusters().get("cluster").setVoltroot(voltDbRoot.getPath());

        //Set the auto-snapshot schedule path if there are auto-snapshots
        SnapshotSchedule schedule = cluster.getDatabases().
            get("database").getSnapshotschedule().get("default");
        if (schedule != null) {
            schedule.setPath(snapshotPath.getPath());
        }

        //Update the path in the schedule for ppd
        schedule = cluster.getFaultsnapshots().get("CLUSTER_PARTITION");
        if (schedule != null) {
            schedule.setPath(snapshotPath.getPath());
        }

        //Also set the export overflow directory
        cluster.setExportoverflow(exportOverflowPath.getPath());

        //Set the command log paths, also creates the command log entry in the catalog
        final org.voltdb.catalog.CommandLog commandLogConfig = cluster.getLogconfig().add("log");
        commandLogConfig.setInternalsnapshotpath(commandLogSnapshotPath.getPath());
        commandLogConfig.setLogpath(commandLogPath.getPath());
    }
View Full Code Here


    private static void setHTTPDInfo(Catalog catalog, HttpdType httpd) {
        // defaults
        int httpdPort = -1;
        boolean jsonEnabled = false;

        Cluster cluster = catalog.getClusters().get("cluster");

        // if the httpd info is available, use it
        if (httpd != null && httpd.isEnabled()) {
           httpdPort = httpd.getPort();
           HttpdType.Jsonapi jsonapi = httpd.getJsonapi();
           if (jsonapi != null)
               jsonEnabled = jsonapi.isEnabled();
        }

        // set the catalog info
        cluster.setHttpdportno(httpdPort);
        cluster.setJsonapi(jsonEnabled);
    }
View Full Code Here

        m_hostId = 0;
        m_messenger = null;
    }

    private static Connector getConnector(CatalogContext catalogContext) {
        final Cluster cluster = catalogContext.catalog.getClusters().get("cluster");
        final Database db = cluster.getDatabases().get("database");
        final Connector conn= db.getConnectors().get("0");
        return conn;
    }
View Full Code Here

            List<Integer> partitions)
    throws ExportManager.SetupException
    {
        m_hostId = myHostId;
        m_messenger = messenger;
        final Cluster cluster = catalogContext.catalog.getClusters().get("cluster");
        final Connector conn = getConnector(catalogContext);

        if (conn == null) {
            exportLog.info("System is not using any export functionality.");
            return;
        }

        if (conn.getEnabled() == false) {
            exportLog.info("Export is disabled by user configuration.");
            return;
        }

        updateProcessorConfig(conn);

        exportLog.info(String.format("Export is enabled and can overflow to %s.", cluster.getExportoverflow()));

        m_loaderClass = conn.getLoaderclass();
    }
View Full Code Here

        m_processorConfig = newConfig;
    }

    public synchronized void updateCatalog(CatalogContext catalogContext, List<Integer> partitions)
    {
        final Cluster cluster = catalogContext.catalog.getClusters().get("cluster");
        final Database db = cluster.getDatabases().get("database");
        final Connector conn= db.getConnectors().get("0");
        if (conn == null || !conn.getEnabled()) {
            m_loaderClass = null;
            return;
        }
View Full Code Here


        URL url = Resources.getResource(ReportMaker.class, "template.html");
        String contents = Resources.toString(url, Charsets.UTF_8);

        Cluster cluster = catalog.getClusters().get("cluster");
        assert(cluster != null);
        Database db = cluster.getDatabases().get("database");
        assert(db != null);

        String statsData = getStatsHTML(db, warnings);
        contents = contents.replace("##STATS##", statsData);
View Full Code Here

            boolean returnUniqueViolations,
            boolean shouldDRStream,
            boolean undo)
    throws VoltAbortException
    {
        Cluster cluster = m_context.cluster;
        if (cluster == null) {
            throw new VoltAbortException("cluster '" + clusterName + "' does not exist");
        }
        Database db = cluster.getDatabases().get(databaseName);
        if (db == null) {
            throw new VoltAbortException("database '" + databaseName + "' does not exist in cluster " + clusterName);
        }
        Table table = db.getTables().getIgnoreCase(tableName);
        if (table == null) {
View Full Code Here

    @Override
    public byte[] loadTable(long txnId, long spHandle, String clusterName, String databaseName,
            String tableName, VoltTable data,
            boolean returnUniqueViolations, boolean shouldDRStream, boolean undo) throws VoltAbortException
    {
        Cluster cluster = m_context.cluster;
        if (cluster == null) {
            throw new VoltAbortException("cluster '" + clusterName + "' does not exist");
        }
        Database db = cluster.getDatabases().get(databaseName);
        if (db == null) {
            throw new VoltAbortException("database '" + databaseName + "' does not exist in cluster " + clusterName);
        }
        Table table = db.getTables().getIgnoreCase(tableName);
        if (table == null) {
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.