Skip to content

Commit

Permalink
Merge pull request influxdata#6850 from influxdata/js-shard-group-max…
Browse files Browse the repository at this point in the history
…-time

Modify the max nanosecond time to be one nanosecond less
  • Loading branch information
jsternberg authored Jun 16, 2016
2 parents 3b400a2 + 8e1b036 commit 65e9903
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
- [#6771](https://github.com/influxdata/influxdb/issues/6771): Fix the point validation parser to identify and sort tags correctly.
- [#6835](https://github.com/influxdata/influxdb/pull/6835): Include sysvinit-tools as an rpm dependency.
- [#6834](https://github.com/influxdata/influxdb/pull/6834): Add port to all graphite log output to help with debugging multiple endpoints
- [#6850](https://github.com/influxdata/influxdb/pull/6850): Modify the max nanosecond time to be one nanosecond less.

## v0.13.0 [2016-05-12]

Expand Down
2 changes: 1 addition & 1 deletion influxql/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (

// MaxTime is used as the maximum time value when computing an unbounded range.
// This time is 2262-04-11 23:47:16.854775806 +0000 UTC
MaxTime = models.MaxNanoTime - 1
MaxTime = models.MaxNanoTime
)

// Iterator represents a generic interface for all Iterators.
Expand Down
2 changes: 1 addition & 1 deletion models/points_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,7 @@ func TestParsePointNegativeTimestamp(t *testing.T) {
}

func TestParsePointMaxTimestamp(t *testing.T) {
test(t, `cpu value=1 9223372036854775807`,
test(t, fmt.Sprintf(`cpu value=1 %d`, models.MaxNanoTime),
NewTestPoint(
"cpu",
models.Tags{},
Expand Down
4 changes: 2 additions & 2 deletions models/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const (

// MaxNanoTime is the maximum time that can be represented.
//
// 2262-04-11 23:47:16.854775807 +0000 UTC
// 2262-04-11 23:47:16.854775806 +0000 UTC
//
MaxNanoTime = int64(math.MaxInt64)
MaxNanoTime = int64(math.MaxInt64) - 1
)

var (
Expand Down
3 changes: 2 additions & 1 deletion services/meta/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@ func (data *Data) CreateShardGroup(database, policy string, timestamp time.Time)
sgi.StartTime = timestamp.Truncate(rpi.ShardGroupDuration).UTC()
sgi.EndTime = sgi.StartTime.Add(rpi.ShardGroupDuration).UTC()
if sgi.EndTime.After(time.Unix(0, models.MaxNanoTime)) {
sgi.EndTime = time.Unix(0, models.MaxNanoTime)
// Shard group range is [start, end) so add one to the max time.
sgi.EndTime = time.Unix(0, models.MaxNanoTime+1)
}

data.MaxShardID++
Expand Down

0 comments on commit 65e9903

Please sign in to comment.