dotnet / dotnet/orleans

Grain interface versioned but still going to old version during rolling upgrade

Open
#8,439 4 comments 1 reaction 1 assignee Claimed by @ReubenBond View on GitHub
bug
Dominant language
C#
Stars
10.9k
Forks
2.1k
Avg merge
13h 56m
Merged PRs (30d)
351

Description

During a rolling upgrade, when I introduce a new version of a grain interface with a new method that includes a new type, the calls from the newly deployed silos are trying to use grains activated on old silos with the old version, instead of deactivating them and activating them on suitable and supported silos. This is happening despite using `StrictVersionCompatible` as the compatibility strategy and `LatestVersion` as the version selector strategy.

```
.Configure(options =>
{
options.DefaultCompatibilityStrategy = nameof(StrictVersionCompatible);
options.DefaultVersionSelectorStrategy = nameof(LatestVersion);
})
```

Original Interface:
```csharp
[Version(1)]
public interface ISampleGrain: IGrainWithGuidKey
{
Task MyMethod(MyObject request);
}
```

New Interface:
```csharp
[Version(2)]
public interface ISampleGrain: IGrainWithGuidKey
{
Task MyMethod(MyObject request);
Task MyMethodV2(MyObjectV2 request);
}
```

### Expected Behavior

The new silos should only call new silos with the new version of the grain interface. The `StrictVersionCompatible` strategy should prevent calls to the old version of the grain interface, and the `LatestVersion` selector should prefer the latest available version.

### Actual Behavior

The new silos are attempting to create activations on grains in old silos, leading to these logs on the old silos:
```
Named type "MyObjectV2" is invalid: Type string "MyObjectV2" cannot be resolved.
```
Obviously the old silos cannot resolve `MyObjectV2` because they are still running an old version of the code during rolling update.

It is my understanding, [according to the docs](https://learn.microsoft.com/en-us/dotnet/orleans/grains/grain-versioning/grain-versioning#grain-version-compatibility-and-placement), that this should not happen and current activations of that interface need to be deactivated and activated only on suitable and supported silos.

### Environment
Orleans version: 3.6.2
.NET version: 7

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.