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);
}
Aggregations