Skip to content

Commit

Permalink
Don't include shard group end time in point checks
Browse files Browse the repository at this point in the history
End time was included in the check for a point.  This meant a
point that was truncated and landed on the end time could fall
in both the prior and next shard groups.  For example, a range
17:00-18:00 and 18:00-19:00 would both include a point that was
at 18:00.
  • Loading branch information
jwilder committed May 19, 2015
1 parent 9ab1aeb commit be0d522
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion database.go
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ func NewRetentionPolicy(name string) *RetentionPolicy {
// Returns nil group does not exist.
func (rp *RetentionPolicy) shardGroupByTimestamp(timestamp time.Time) *ShardGroup {
for _, g := range rp.shardGroups {
if timeBetweenInclusive(timestamp, g.StartTime, g.EndTime) {
if (g.StartTime.Before(timestamp) || g.StartTime.Equal(timestamp)) && g.EndTime.After(timestamp) {
return g
}
}
Expand Down

0 comments on commit be0d522

Please sign in to comment.