Search code examples
azure-service-fabric

Service Fabric: removed actors and now upgrade fails


I'm trying to upgrade a Service Fabric application with a mix of stateful and stateless actors. I did some refactoring and so removed some actors I didn't need any more. Now, when I try to upgrade the application, I get the following error:

Services must be explicitly deleted before removing their Service Types.

After thinking about it a little bit, I think I understand the trouble that could come from removed services and upgrades, but then what's the correct way to do this?


Solution

  • You need to remove the service instances before you can upgrade to a version that doesn't contain the removed service package. Either:

    • In SF Explorer, navigate to the service and click Actions > Delete Service
    • In PowerShell:

      Connect-ServiceFabricCluster
      Remove-ServiceFabricService -ServiceName fabric:/MyApp/MyService
      

    DO BE CAREFUL - If you're deleting a stateful service you'll lose all its data. Always be sure to have a periodic backup of production data.