Exemplo n.º 1
0
  /** Save the profile information into the database */
  protected final void saveProfile(BenchmarkComponent baseClient) {

    // CONFIG_PROFILE
    Table catalog_tbl =
        catalogContext.database.getTables().get(SEATSConstants.TABLENAME_CONFIG_PROFILE);
    VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
    assert (vt != null);
    vt.addRow(
        this.scale_factor, // CFP_SCALE_FACTOR
        this.airport_max_customer_id.toJSONString(), // CFP_AIPORT_MAX_CUSTOMER
        this.flight_start_date, // CFP_FLIGHT_START
        this.flight_upcoming_date, // CFP_FLIGHT_UPCOMING
        this.flight_past_days, // CFP_FLIGHT_PAST_DAYS
        this.flight_future_days, // CFP_FLIGHT_FUTURE_DAYS
        this.num_flights, // CFP_NUM_FLIGHTS
        this.num_customers, // CFP_NUM_CUSTOMERS
        this.num_reservations, // CFP_NUM_RESERVATIONS
        JSONUtil.toJSONString(this.code_id_xref) // CFP_CODE_ID_XREF
        );
    if (debug.val)
      LOG.debug(String.format("Saving profile information into %s\n%s", catalog_tbl, this));
    baseClient.loadVoltTable(catalog_tbl.getName(), vt);

    // CONFIG_HISTOGRAMS
    catalog_tbl =
        catalogContext.database.getTables().get(SEATSConstants.TABLENAME_CONFIG_HISTOGRAMS);
    vt = CatalogUtil.getVoltTable(catalog_tbl);
    assert (vt != null);

    for (Entry<String, Histogram<String>> e : this.airport_histograms.entrySet()) {
      vt.addRow(
          e.getKey(), // CFH_NAME
          e.getValue().toJSONString(), // CFH_DATA
          1 // CFH_IS_AIRPORT
          );
    } // FOR
    if (debug.val) LOG.debug("Saving airport histogram information into " + catalog_tbl);
    baseClient.loadVoltTable(catalog_tbl.getName(), vt);

    for (Entry<String, Histogram<String>> e : this.histograms.entrySet()) {
      vt.addRow(
          e.getKey(), // CFH_NAME
          e.getValue().toJSONString(), // CFH_DATA
          0 // CFH_IS_AIRPORT
          );
    } // FOR
    if (debug.val) LOG.debug("Saving benchmark histogram information into " + catalog_tbl);
    baseClient.loadVoltTable(catalog_tbl.getName(), vt);

    return;
  }
Exemplo n.º 2
0
 private final void loadConfigProfile(VoltTable vt) {
   boolean adv = vt.advanceRow();
   assert (adv)
       : "No data in "
           + SEATSConstants.TABLENAME_CONFIG_PROFILE
           + ". "
           + "Did you forget to load the database first?";
   int col = 0;
   this.scale_factor = vt.getDouble(col++);
   JSONUtil.fromJSONString(this.airport_max_customer_id, vt.getString(col++));
   this.flight_start_date = vt.getTimestampAsTimestamp(col++);
   this.flight_upcoming_date = vt.getTimestampAsTimestamp(col++);
   this.flight_past_days = vt.getLong(col++);
   this.flight_future_days = vt.getLong(col++);
   this.num_flights = vt.getLong(col++);
   this.num_customers = vt.getLong(col++);
   this.num_reservations = vt.getLong(col++);
   if (debug.val)
     LOG.debug(String.format("Loaded %s data", SEATSConstants.TABLENAME_CONFIG_PROFILE));
 }
Exemplo n.º 3
0
  private final void loadConfigHistograms(VoltTable vt) {
    while (vt.advanceRow()) {
      int col = 0;
      String name = vt.getString(col++);
      ObjectHistogram<String> h =
          JSONUtil.fromJSONString(new ObjectHistogram<String>(), vt.getString(col++));
      boolean is_airline = (vt.getLong(col++) == 1);

      if (is_airline) {
        this.airport_histograms.put(name, h);
        if (trace.val)
          LOG.trace(
              String.format("Loaded %d records for %s airport histogram", h.getValueCount(), name));
      } else {
        this.histograms.put(name, h);
        if (trace.val)
          LOG.trace(String.format("Loaded %d records for %s histogram", h.getValueCount(), name));
      }
    } // WHILE
    if (debug.val)
      LOG.debug(String.format("Loaded %s data", SEATSConstants.TABLENAME_CONFIG_HISTOGRAMS));
  }