Search in sources :

Example 1 with DatabaseSizes

use of org.voltdb.utils.CatalogSizing.DatabaseSizes in project voltdb by VoltDB.

the class ReportMaker method report.

/**
     * Generate the HTML catalog report from a newly compiled VoltDB catalog
     */
public static String report(Catalog catalog, long minHeap, boolean isPro, int hostCount, int sitesPerHost, int kfactor, ArrayList<Feedback> warnings, String autoGenDDL) throws IOException {
    // asynchronously get platform properties
    new Thread() {

        @Override
        public void run() {
            PlatformProperties.getPlatformProperties();
        }
    }.start();
    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, minHeap, warnings);
    contents = contents.replace("##STATS##", statsData);
    // generateProceduresTable needs to happen before generateSchemaTable
    // because some metadata used in the later is generated in the former
    String procData = generateProceduresTable(db.getTables(), db.getProcedures());
    contents = contents.replace("##PROCS##", procData);
    String schemaData = generateSchemaTable(db);
    contents = contents.replace("##SCHEMA##", schemaData);
    DatabaseSizes sizes = CatalogSizing.getCatalogSizes(db, DrRoleType.XDCR.value().equals(cluster.getDrrole()));
    String sizeData = generateSizeTable(sizes);
    contents = contents.replace("##SIZES##", sizeData);
    String clusterConfig = generateClusterConfiguration(isPro, hostCount, sitesPerHost, kfactor);
    contents = contents.replace("##CLUSTERCONFIG##", clusterConfig);
    String sizeSummary = generateSizeSummary(sizes);
    contents = contents.replace("##SIZESUMMARY##", sizeSummary);
    String heapSummary = generateRecommendedServerSettings(sizes);
    contents = contents.replace("##RECOMMENDEDSERVERSETTINGS##", heapSummary);
    String platformData = PlatformProperties.getPlatformProperties().toHTML();
    contents = contents.replace("##PLATFORM##", platformData);
    contents = contents.replace("##VERSION##", VoltDB.instance().getVersionString());
    contents = contents.replace("##DDL##", escapeHtml4(autoGenDDL));
    DateFormat df = new SimpleDateFormat("d MMM yyyy HH:mm:ss z");
    contents = contents.replace("##TIMESTAMP##", df.format(m_timestamp));
    String msg = Encoder.hexEncode(VoltDB.instance().getVersionString() + "," + System.currentTimeMillis());
    contents = contents.replace("get.py?a=KEY&", String.format("get.py?a=%s&", msg));
    return contents;
}
Also used : DatabaseSizes(org.voltdb.utils.CatalogSizing.DatabaseSizes) SimpleDateFormat(java.text.SimpleDateFormat) DateFormat(java.text.DateFormat) Database(org.voltdb.catalog.Database) Cluster(org.voltdb.catalog.Cluster) SimpleDateFormat(java.text.SimpleDateFormat) URL(java.net.URL)

Aggregations

URL (java.net.URL)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Cluster (org.voltdb.catalog.Cluster)1 Database (org.voltdb.catalog.Database)1 DatabaseSizes (org.voltdb.utils.CatalogSizing.DatabaseSizes)1