Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore invalid configurations when migrating legacy mirrors and crede…
…ntials (#1007) Motivation: If an exception is raised while performing a mirror migration job, it tries to roll back the migration. https://github.com/line/centraldogma/blob/5912bf7dd52bda8c414ba1e25c9a1155f981b42d/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/MirroringMigrationService.java#L135-L139 However, the rollback also could fail if there is no migration on a project. `entries` may be empty which results in raising `RedundantChangeException`. https://github.com/line/centraldogma/blob/5912bf7dd52bda8c414ba1e25c9a1155f981b42d/server/src/main/java/com/linecorp/centraldogma/server/internal/mirror/MirroringMigrationService.java#L266-L267 Initially, I thought it was better to stop the whole migration job immediately to make the migration status atomic if an exception was raised. However, that was a bad choice. If it fails, it remains in `REPLICATION_ONLY` mode, which is difficult to fix manually. Modification: - Always recover the server status to `WRITABLE` even when a mirror migration job completes exceptionally. - Warn invalid mirror and credential configurations and continue to migrate the remaining projects. - Try to roll back if the new migration directory is not empty. Result: - The server status is correctly reset to `WRITABLE` when a mirror migration job fails.
- Loading branch information