Ejemplo n.º 1
0
  public long getQueuedExportBytes(int partitionId, String signature) {
    // assert(m_dataSourcesByPartition.containsKey(partitionId));
    // assert(m_dataSourcesByPartition.get(partitionId).containsKey(delegateId));
    HashMap<String, ExportDataSource> sources = m_dataSourcesByPartition.get(partitionId);

    if (sources == null) {
      /*
       * This is fine. If the table is dropped it won't have an entry in the generation created
       * after the table was dropped.
       */
      //            exportLog.error("Could not find export data sources for generation " +
      // m_timestamp + " partition "
      //                    + partitionId);
      return 0;
    }

    ExportDataSource source = sources.get(signature);
    if (source == null) {
      /*
       * This is fine. If the table is dropped it won't have an entry in the generation created
       * after the table was dropped.
       */
      // exportLog.error("Could not find export data source for generation " + m_timestamp + "
      // partition " + partitionId +
      //        " signature " + signature);
      return 0;
    }
    return source.sizeInBytes();
  }
Ejemplo n.º 2
0
 /*
  * Create a datasource based on an ad file
  */
 private void addDataSource(File adFile, Set<Integer> partitions) throws IOException {
   m_numSources++;
   ExportDataSource source = new ExportDataSource(m_onSourceDrained, adFile);
   partitions.add(source.getPartitionId());
   m_timestamp = source.getGeneration();
   exportLog.info(
       "Creating ExportDataSource for "
           + adFile
           + " table "
           + source.getTableName()
           + " signature "
           + source.getSignature()
           + " partition id "
           + source.getPartitionId()
           + " bytes "
           + source.sizeInBytes());
   HashMap<String, ExportDataSource> dataSourcesForPartition =
       m_dataSourcesByPartition.get(source.getPartitionId());
   if (dataSourcesForPartition == null) {
     dataSourcesForPartition = new HashMap<String, ExportDataSource>();
     m_dataSourcesByPartition.put(source.getPartitionId(), dataSourcesForPartition);
   }
   dataSourcesForPartition.put(source.getSignature(), source);
 }