Ejemplo n.º 1
0
  public String toString() {
    StringBuilder buffer = new StringBuilder();

    buffer.append("Hosts:     ").append(this.getHosts().size()).append("\n");
    buffer.append("Sites:     ").append(this.sites.size()).append("\n");
    buffer.append("Fragments: ").append(this.fragments.size()).append("\n");

    SortedSet<String> hosts = new TreeSet<String>();
    hosts.addAll(this.getHosts());

    for (String host_key : hosts) {
      buffer.append("\nHost ").append(CatalogKey.getNameFromKey(host_key)).append("\n");
      for (SiteEntry site : this.host_site_xref.get(host_key)) {
        buffer.append(SPACER).append("Site ").append(site.getId()).append("\n");
        for (FragmentEntry fragment : site.getFragments()) {
          buffer
              .append(SPACER)
              .append(SPACER)
              .append("Fragment ")
              .append(fragment)
              .append(" Size=")
              .append(fragment.getEstimatedSize())
              .append(" Heat=")
              .append(fragment.getEstimatedHeat())
              .append("\n");
        } // FOR
      } // FOR
      buffer.append("--------------------");
    } // FOR
    return (buffer.toString());
  }
Ejemplo n.º 2
0
  /**
   * Merge the source SiteEntry into the target SiteEntry
   *
   * @param source
   * @param target
   */
  public void merge(SiteEntry source, SiteEntry target) {
    // Copy over all the fragments
    for (FragmentEntry fragment : source.getFragments()) {
      this.assign(target, fragment);
    } // FOR

    // Remove all references to the source SiteEntry
    this.site_id_xref.remove(source.getId());
    this.host_site_xref.get(source.getHostKey()).remove(source);
  }
Ejemplo n.º 3
0
 public void apply(Database catalog_db, WorkloadStatistics stats, AbstractHasher hasher) {
   //
   // We need to estimate how big each partition is
   //
   MemoryEstimator estimator = new MemoryEstimator(stats, hasher);
   for (SiteEntry site : this.sites) {
     long site_size = 0l;
     for (FragmentEntry fragment : site.getFragments()) {
       Table catalog_tbl = fragment.getTable(catalog_db);
       Column partition_col = catalog_tbl.getPartitioncolumn();
       long size = estimator.estimate(catalog_tbl, partition_col, fragment.getHashKey());
       site_size += size;
       fragment.setEstimatedSize(size);
     } // FOR
     site.setEstimatedSize(site_size);
   } // FOR
 }
Ejemplo n.º 4
0
  public void initialize() {
    for (SiteEntry site : this.sites) {
      String host_key = site.getHostKey();
      if (!this.host_site_xref.containsKey(host_key)) {
        this.host_site_xref.put(host_key, new TreeSet<SiteEntry>());
      }
      this.host_site_xref.get(host_key).add(site);

      for (FragmentEntry fragment : site.getFragments()) {
        this.fragments.add(fragment);
        this.fragment_site_xref.put(fragment, site);

        String table_key = fragment.getTableKey();
        if (!this.table_fragment_xref.containsKey(table_key)) {
          this.table_fragment_xref.put(table_key, new HashSet<FragmentEntry>());
        }
        this.table_fragment_xref.get(table_key).add(fragment);
      } // FOR
    } // FOR
  }