I have stateful service that uses uniform int64 partitioning with 5 partitions
<UniformInt64Partition PartitionCount="5" LowKey="-9223372036854775808" HighKey="9223372036854775807" />
This results in partitions as below
[
{
"lowKey": -5534023222112865000,
"highKey": -1844674407370955300,
"id": "92b4c32e-cb3c-432f-aea0-4579fc72850c",
"kind": 2
},
{
"lowKey": 5534023222112865000,
"highKey": 9223372036854776000,
"id": "dd9b084d-88fa-4773-94d9-f634d22a2c03",
"kind": 2
},
{
"lowKey": -9223372036854776000,
"highKey": -5534023222112865000,
"id": "d7322e52-cf1e-47c2-b713-e983f443b533",
"kind": 2
},
{
"lowKey": -1844674407370955300,
"highKey": 1844674407370955300,
"id": "dfe2f994-bdc7-4b32-b54f-78a0245e4c4c",
"kind": 2
},
{
"lowKey": 1844674407370955300,
"highKey": 5534023222112865000,
"id": "6ad81ffb-5f3c-48ba-91d9-e65b23c528a4",
"kind": 2
}
]
So if I have a request using the partition key 55340232221128650067
Why has this been resolved by the 92b4c32e-cb3c-432f-aea0-4579fc72850c partition?
I am using the logic below to find the partition
public static long MapUlongToLong(ulong ulongValue)
{
return unchecked((long)ulongValue + long.MinValue);
}
protected override async Task<ResolvedServicePartition> FindPartition(ulong key = 0)
{
var longValue = MapUlongToLong(key);
var partitionKey = new ServicePartitionKey(longValue);
var resolver = ServicePartitionResolver.GetDefault();
var result = await resolver.ResolveAsync(FullServiceName, partitionKey, CancellationToken.None).ConfigureAwait(false);
return result;
}
I have to map ulong to long because when I tried using the big value in code it classed this as a ulong value
Is this causing the problem?
Are there alternatives?
Paul