问题描述
我有 3 个分区的 Service Fabric 有状态应用程序,以下是配置
PartitionCount = 3,LowKey = 0 和 HighKey = 2
因此,在 ReliableCollections 中创建数据时,我需要发送什么分区键?下面是几个场景
using (var tx = this.StateManager.CreateTransaction())
{
var result = await myDictionary.TryGetValueAsync(tx,"Counter");
ServiceEventSource.Current.ServiceMessage(this.Context,"Current Counter Value: {0}",result.HasValue ? result.Value.ToString() : "Value does not exist.");
// will go into 1st partition since given key = 0 = LowKey
var t1 = await myDictionary.AddOrUpdateAsync(tx,"0",55,(key,value) => ++value);
// will go into 2nd partition since given key = 1
var t2 = await myDictionary.AddOrUpdateAsync(tx,"1",65,value) => ++value);
// will go into 3rdst partition since given key = 2 = HighKey
var t3 = await myDictionary.AddOrUpdateAsync(tx,"2",75,value) => ++value);
// but what iff i give key = 5/"nano",in which partition it will create this record
var t4 = await myDictionary.AddOrUpdateAsync(tx,"6",99,value) => ++value);
await tx.CommitAsync();
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)