Azure / Azure/elastic-db-tools
ListShardMap.TryGetMappingForKey intermittently throwing InvalidOperationException
- Dominant language
- C#
- Stars
- 147
- Forks
- 108
- PR merge metrics
- No merged PRs in 30d
Description
`ListShardMap.TryGetMappingForKey` is intermittently throwing an `InvalidOperationException`, within the call to the `.Single()` LINQ function.
It is expected that a `TryGet...` method doesn't throw but instead returns a status code.
We're using the latest version of the library as of the time of writing – v2.3.0.
We're currently trying to track down the precise conditions under which this exception occurs, but it only happens intermittently at irregular intervals so I'm unable to elucidate further at this time. I will update this issue once we have more details. In the interim, it would be great if you could investigate fixing this and we'd appreciate any advice into how we might have encountered this state.
The callstack at the point of the exception is:
```
An unhandled exception has occurred while executing the request. Exception: System.InvalidOperationException: Sequence contains no elements\n
at System.Linq.ThrowHelper.ThrowNoElementsException()\n at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source)\n
at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.BaseShardMapper.Lookup[TMapping,TKey](TKey key, LookupOptions lookupOptions, Func`4 constructMapping, ShardManagementErrorCategory errorCategory)\n
at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ListShardMapper`1.TryLookup(TKey key, LookupOptions lookupOptions, PointMapping`1& mapping)\n
at Microsoft.Azure.SqlDatabase.ElasticScale.ShardManagement.ListShardMap`1.TryGetMappingForKey(TKey key, LookupOptions lookupOptions, PointMapping`1& pointMapping)\n
at [our code]
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.