Merge pull request #3030 from influxdb/better_sg_logging
Fix excessive shard group creation loggingpull/3038/head
commit
c9906d8777
|
@ -20,6 +20,7 @@
|
|||
- [#3002](https://github.com/influxdb/influxdb/pull/3002): Remove measurement from shard's index on DROP MEASUREMENT.
|
||||
- [#3021](https://github.com/influxdb/influxdb/pull/3021): Correct set HTTP write trace logging. Thanks @vladlopes.
|
||||
- [#3027](https://github.com/influxdb/influxdb/pull/3027): Enforce minimum retention policy duration of 1 hour.
|
||||
- [#3030](https://github.com/influxdb/influxdb/pull/3030): Fix excessive logging of shard creation.
|
||||
|
||||
## v0.9.0 [2015-06-11]
|
||||
|
||||
|
|
|
@ -1071,13 +1071,24 @@ func (s *Store) PrecreateShardGroups(cutoff time.Time) error {
|
|||
for _, g := range rp.ShardGroups {
|
||||
// Check to see if it is going to end before our interval
|
||||
if g.EndTime.Before(cutoff) {
|
||||
s.Logger.Printf("pre-creating successive shard group for group %d, database %s, policy %s",
|
||||
g.ID, di.Name, rp.Name)
|
||||
if newGroup, err := s.CreateShardGroupIfNotExists(di.Name, rp.Name, g.EndTime.Add(1*time.Nanosecond)); err != nil {
|
||||
nextShardGroupTime := g.EndTime.Add(1 * time.Nanosecond)
|
||||
|
||||
// Check if successive shard group exists.
|
||||
if sgi, err := s.ShardGroupByTimestamp(di.Name, rp.Name, nextShardGroupTime); err != nil {
|
||||
s.Logger.Printf("failed to check if successive shard group for group exists %d: %s",
|
||||
g.ID, err.Error())
|
||||
continue
|
||||
} else if sgi != nil && !sgi.Deleted() {
|
||||
continue
|
||||
}
|
||||
|
||||
// It doesn't. Create it.
|
||||
if newGroup, err := s.CreateShardGroupIfNotExists(di.Name, rp.Name, nextShardGroupTime); err != nil {
|
||||
s.Logger.Printf("failed to create successive shard group for group %d: %s",
|
||||
g.ID, err.Error())
|
||||
} else {
|
||||
s.Logger.Printf("new shard group %d successfully created", newGroup.ID)
|
||||
s.Logger.Printf("new shard group %d successfully created for database %s, retention policy %s",
|
||||
newGroup.ID, di.Name, rp.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue