Search in sources :

Example 1 with MigrationStepExecutionException

use of org.sonar.server.platform.db.migration.step.MigrationStepExecutionException in project sonarqube by SonarSource.

the class DatabaseMigrationImpl method doDatabaseMigration.

private void doDatabaseMigration() {
    migrationState.setStatus(Status.RUNNING);
    migrationState.setStartedAt(new Date());
    migrationState.setError(null);
    Profiler profiler = Profiler.create(LOGGER);
    try {
        profiler.startInfo("Starting DB Migration and container restart");
        doUpgradeDb();
        doRestartContainer();
        migrationState.setStatus(Status.SUCCEEDED);
        profiler.stopInfo("DB Migration and container restart: success");
    } catch (MigrationStepExecutionException e) {
        profiler.stopError("DB migration failed");
        LOGGER.error("DB migration ended with an exception", e);
        saveStatus(e);
    } catch (Throwable t) {
        profiler.stopError("Container restart failed");
        LOGGER.error("Container restart failed", t);
        saveStatus(t);
    } finally {
        running.getAndSet(false);
    }
}
Also used : Profiler(org.sonar.core.util.logs.Profiler) MigrationStepExecutionException(org.sonar.server.platform.db.migration.step.MigrationStepExecutionException) Date(java.util.Date)

Aggregations

Date (java.util.Date)1 Profiler (org.sonar.core.util.logs.Profiler)1 MigrationStepExecutionException (org.sonar.server.platform.db.migration.step.MigrationStepExecutionException)1