Search in sources :

Example 1 with DataMigrationException

use of co.cask.cdap.metrics.store.upgrade.DataMigrationException in project cdap by caskdata.

the class DefaultMetricDatasetFactory method migrateData.

/**
   * Migrates metrics data from version 2.7 and older to 2.8
   * @param conf CConfiguration
   * @param hConf Configuration
   * @param datasetFramework framework to add types and datasets to
   * @param keepOldData - boolean flag to specify if we have to keep old metrics data
   * @throws DataMigrationException
   */
public static void migrateData(CConfiguration conf, Configuration hConf, DatasetFramework datasetFramework, boolean keepOldData, HBaseTableUtil tableUtil) throws DataMigrationException {
    DefaultMetricDatasetFactory factory = new DefaultMetricDatasetFactory(conf, datasetFramework);
    MetricsDataMigrator migrator = new MetricsDataMigrator(conf, hConf, datasetFramework, factory);
    // delete existing destination tables
    migrator.cleanupDestinationTables();
    try {
        setupDatasets(factory);
    } catch (Exception e) {
        String msg = "Exception creating destination tables";
        LOG.error(msg, e);
        throw new DataMigrationException(msg);
    }
    migrator.migrateMetricsTables(tableUtil, keepOldData);
}
Also used : DataMigrationException(co.cask.cdap.metrics.store.upgrade.DataMigrationException) MetricsDataMigrator(co.cask.cdap.metrics.store.upgrade.MetricsDataMigrator) DatasetManagementException(co.cask.cdap.api.dataset.DatasetManagementException) DataMigrationException(co.cask.cdap.metrics.store.upgrade.DataMigrationException) IOException(java.io.IOException)

Aggregations

DatasetManagementException (co.cask.cdap.api.dataset.DatasetManagementException)1 DataMigrationException (co.cask.cdap.metrics.store.upgrade.DataMigrationException)1 MetricsDataMigrator (co.cask.cdap.metrics.store.upgrade.MetricsDataMigrator)1 IOException (java.io.IOException)1