Azure / Azure/elastic-db-tools

Creating RangeMapping with DateTimeOffset has unintuitive results when range endpoints have same UtcTime but different offset

Open
#117 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
147
Forks
108
PR merge metrics
No merged PRs in 30d

Description

Create a RangeShardMap with the following ranges:

```
new DateTimeOffset(0001, 1, 1, 0, 0, 0, TimeSpan.FromMinutes(-1))
new DateTimeOffset(1899, 12, 31, 23, 59, 0, TimeSpan.FromMinutes(-1))
new DateTimeOffset(1900, 1, 1, 0, 0, 0, TimeSpan.Zero)
new DateTimeOffset(1900, 1, 1, 0, 1, 0, TimeSpan.FromMinutes(1))
DateTimeOffset.MaxValue
```

I got unintuitive errors depending on which ordering I used. Errors were either that the range was in the wrong order (low > high) or that there were overlapping mappings.

Note that the 3 middle values have the same universal time but have different offsets. According to SQL server order, the above ordering is correct, but according to .NET these values are all equal.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.