Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
343 views
in Technique[技术] by (71.8m points)

c# - Default service descriptions can not be modified as part of upgrade set EnableDefaultServicesUpgrade to true

I am trying to upgrade my Service Fabric application via Visual Studio.

I ended up having to use the diff package approach to ensure that only the services I change are in the upgrade.

I did this via a command file which removed the non-required files.

Now I have walked into another error which is annoying with its lack of detail:

Start-ServiceFabricApplicationUpgrade : Default service descriptions can not be modified as part of upgrade. Modified 
2>default service: fabric:/MYAPPLICATION/MYSERVICE. To allow it, set 
2>EnableDefaultServicesUpgrade to true.

Where exactly do I put this?

Please note that this is coming from Visual Studio.

I rarely get any joy using PowerShell.

I have seen references to the Update-ServiceFabricService CmdLet, but there is no more information about exactly what I need to do.

I have tried this in the application manifest without success:

<?xml version="1.0" encoding="utf-8"?>
<ApplicationManifest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ApplicationTypeName="MyServiceFabricApplication.ServiceFabricType" ApplicationTypeVersion="7.0.0" xmlns="http://schemas.microsoft.com/2011/01/fabric">
  <Parameters>
    <Parameter Name="EnableDefaultServicesUpgrade" DefaultValue="true" />
    <Parameter Name="MyParameter" DefaultValue="value" />
    Parameters>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service1.ServiceFabricPkg" ServiceManifestVersion="4.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service2.ServiceFabricPkg" ServiceManifestVersion="2.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service3.ServiceFabricPkg" ServiceManifestVersion="3.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service4.ServiceFabricPkg" ServiceManifestVersion="2.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.PlatformApi.ServiceFabricPkg" ServiceManifestVersion="2.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.LivePriceManager.ServiceFabricPkg" ServiceManifestVersion="3.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <ServiceManifestImport>
    <ServiceManifestRef ServiceManifestName="MyServiceFabricApplication.Service5.ServiceFabricPkg" ServiceManifestVersion="3.0.0" />
    <ConfigOverrides>
      <ConfigOverride Name="Config">
        <Settings>
          <Section Name="appSettings">
            <Parameter Name="MyParameter" Value="[MyParameter]" />
          </Section>
        </Settings>
      </ConfigOverride>
    </ConfigOverrides>
  </ServiceManifestImport>
  <DefaultServices>
    <Service Name="Service1" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service1.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service2" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service2.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service3" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service3.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service7" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service7.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service5" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service5.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service6" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service6.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
    <Service Name="Service4" ServicePackageActivationMode="ExclusiveProcess">
      <StatelessService ServiceTypeName="MyServiceFabricApplication.Service4.ServiceFabricType">
        <SingletonPartition />
      </StatelessService>
    </Service>
  </DefaultServices>
</ApplicationManifest>

Paul

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First, before I give you a solution, I will give a reason...

EnableDefaultServicesUpgrade is a flag to allow upgrading default services descriptions during application upgrades. When set to true, Default service descriptions are overwritten with new values, this is required to prevent accidental changes to the description that will cause possible failures or dataloss.

  • When set to false (default), it will make checks to prevent failures to happen,
  • When set to true, you assume the risk that these changes are safe

An example is when you change the number of partitions in a service and SF predict this will cause dataloss or other failures.

The fix:

EnableDefaultServicesUpgrade is a flag in the cluster definition, not in the service. You have to set this in your cluster manifest.

Your cluster manifest will have a section that looks like this:

...some stuff above...
{
  "name": "ClusterManager",
  "parameters": [
  {
    "name": "EnableDefaultServicesUpgrade",
    "value": true
  }]
  ... some more stuf below
 }

To change it on Azure:

You can use the portal 'http://resources.azure.com' as described in this link

On local cluster:

You copy the clusterconfig.json from the cluster installation folder, apply the changes a trigger a cluster upgrade using the following command Start-ServiceFabricClusterConfigurationUpgrade -ClusterConfigPath .clusterconfig.json

By the way...

You are using DefaultServices, you should avoid it, there are quite a few questions on SO why.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...