Skip to content
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

Merged
merged 9 commits into from
Mar 11, 2014

Conversation

jvshahid
Copy link
Contributor

From the mailing list:

I've tried to create records before epoch (1/1/1970) by posting data like

[ { "name": "test", "columns": ["time", "value"],
 "points": [  [-1, 1], [-2, 2] ] } ]

This doesn't result in an error but queries for the data return nothing. I suspect InfluxDB doesn't support dates prior to 1/1/1970. Is this right?

@pauldix pauldix added this to the 0.5.0 milestone Mar 5, 2014
@jvshahid
Copy link
Contributor

jvshahid commented Mar 6, 2014

Since it's not clear what action should be taken in this case, I copied this from the mailing list:

You should be able to enter in negative timestamps. The times are kept in microsecond scale but we convert them to uint64 for proper ordering in LevelDB so there must be some bug in the conversion process or something.

@jvshahid jvshahid modified the milestone: 0.5.0 Mar 10, 2014
@jvshahid jvshahid self-assigned this Mar 10, 2014
jvshahid added a commit that referenced this pull request Mar 11, 2014
startIndex = 0
}
startIndex := sort.Search(len(shards), func(n int) bool {
return shards[n].endMicro > startTime
Copy link
Member

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,
Copy link
Member

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
jvshahid added a commit that referenced this pull request Mar 11, 2014
Should be able to set negative times for dates before 1/1/1970
@jvshahid jvshahid merged commit b4babbd into master Mar 11, 2014
@jvshahid jvshahid deleted the fix-302-negative-time branch March 11, 2014 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants