Migrating Spark and Scala to higher versions
Before switching jobs to Spark 3.0.2, tour engineers made the necessary preparations to make the deployment as efficient as possible.
- Our engineers planned and performed a large refactoring and offloading project from one of the legacy platform components. They replaced it with a basic version of the medallion architecture approach; this was important because the component was no longer supported in the new versions of the tools.
- They also refactored and upgraded the code to depend only on libraries available for both Spark/Scala versions.
- As part of the rolling upgrade, our engineers backed up all the data related to the given module. In case of any unexpected events during the migration, the data could be easily recovered.
- They also introduced a cross-compilation to allow new Spark version usage, which required a different Scala version than previously used.
- Before deploying production, our engineers deployed workflows to test and validate them on a staging environment.
Once all the prerequisites were met, our engineers could deploy the new version of the platform. They executed the migration in a way that simplifies future migrations and potential upgrades for the client.
Migration and deployment
Our engineers divided the migration of the existing jobs into smaller modules, which allowed for a shorter feedback loop. It also gave our engineers greater control over the process and made it more transparent for both users and developers working daily on the platform.
Additionally, the team provided proof that the new version was producing accurate results, ensuring no regression would take place during the migration. They achieved it through a combination of local testing and parallel production runs, with comparative analysis of results as needed.
Deployment was carried out in modules, one by one. Our engineers started with simpler jobs to see if the new version of the application operated properly without the risk of the most vital jobs crashing.
The migration of the platform itself was a matter of "flipping the switch" on the CI/CD pipeline and deploying. In the case of more critical jobs, our engineers conducted additional tests post-deployment or ran old and new versions simultaneously to ensure that both of them produced the same results.