-
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
Should be able to set negative times for dates before 1/1/1970 #302
Conversation
Since it's not clear what action should be taken in this case, I copied this from the mailing list:
|
…ft to replicate.
startIndex = 0 | ||
} | ||
startIndex := sort.Search(len(shards), func(n int) bool { | ||
return shards[n].endMicro > startTime |
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.
I don't think this is going to give you what you want. Since the endMicro will almost always be greater than the start time. You need to find the index of the shard that contains the endTime (since they're in time descending order). Should be: shards[n].endMicro >= endTime
// the shards are always in descending order, if we have the following shards | ||
// [t + 20, t + 30], [t + 10, t + 20], [t, t + 10] | ||
// if we are querying [t + 5, t + 15], we have to find the first shard whose | ||
// startMicro is less than the end time of the query, |
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.
Shard start times are inclusive while end times are exclusive like: [startTime, endTime).
… range note: this is hard to test since the shards will only return points in the given range, so even if we use more shards than we're supposed to the returned points will not be outside the query range. The only way to test this is to write a unit test.
The algorithm that splits the data to multiple shards had an off-by-one bug that caused one point from the next shard to be included in the current shard.
…to fix-302-negative-time Conflicts: src/cluster/shard.go
Should be able to set negative times for dates before 1/1/1970
From the mailing list: