-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Truncate the shard group end time if it exceeds MaxNanoTime #6693
Conversation
By analyzing the blame information on this pull request, we identified @e-dard to be a potential reviewer |
ab1b1d0
to
be4cd2d
Compare
} else if pb.EndTime != nil { | ||
sgi.EndTime = UnmarshalTime(pb.GetEndTime()) | ||
} else { | ||
return errors.New("unable to unmarshal EndTime, missing both EndTime and Duration") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/missing both EndTime and Duration/missing either EndTime or Duration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be a panic instead? It should never happen, but I feel like I have to account for this situation since both of the items are optional.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also it's missing both of them since this error only happens when pb.Duration == nil && pb.EndTime == nil
.
be4cd2d
to
3ca2741
Compare
I updated the PR to serialize both the end time and the duration, but to always prefer the duration if it's there. This keeps it compatible if someone upgrades and wants to go back a version. Should I add the |
3ca2741
to
3384f7c
Compare
@@ -371,6 +372,9 @@ func (data *Data) CreateShardGroup(database, policy string, timestamp time.Time) | |||
sgi.ID = data.MaxShardGroupID | |||
sgi.StartTime = timestamp.Truncate(rpi.ShardGroupDuration).UTC() | |||
sgi.EndTime = sgi.StartTime.Add(rpi.ShardGroupDuration).UTC() | |||
if sgi.EndTime.After(models.MaxNanoTime) { | |||
sgi.EndTime = models.MaxNanoTime |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In here also need to do sgi.StartTime = sgi.EndTime.Add(-models.MaxNanoTime.UnixNano())
or similar.
b712781
to
83dd10c
Compare
83dd10c
to
0d386e1
Compare
@jsternberg this LGTM now 👍 |
0d386e1
to
907c88d
Compare
Related #6599.