Merge pull request #2792 from influxdb/system_test_rpe

Deleted shard groups are not counted as "expired"
pull/2769/head
Philip O'Toole 2015-06-05 13:10:28 -07:00
commit 27790e283c
2 changed files with 6 additions and 3 deletions

View File

@ -586,6 +586,9 @@ func (rpi *RetentionPolicyInfo) ShardGroupByTimestamp(timestamp time.Time) *Shar
func (rpi *RetentionPolicyInfo) ExpiredShardGroups(t time.Time) []*ShardGroupInfo { func (rpi *RetentionPolicyInfo) ExpiredShardGroups(t time.Time) []*ShardGroupInfo {
groups := make([]*ShardGroupInfo, 0) groups := make([]*ShardGroupInfo, 0)
for i := range rpi.ShardGroups { for i := range rpi.ShardGroups {
if rpi.ShardGroups[i].Deleted() {
continue
}
if rpi.Duration != 0 && rpi.ShardGroups[i].EndTime.Add(rpi.Duration).Before(t) { if rpi.Duration != 0 && rpi.ShardGroups[i].EndTime.Add(rpi.Duration).Before(t) {
groups = append(groups, &rpi.ShardGroups[i]) groups = append(groups, &rpi.ShardGroups[i])
} }

View File

@ -72,7 +72,7 @@ func (s *Service) deleteShardGroups() {
if !s.MetaStore.IsLeader() { if !s.MetaStore.IsLeader() {
continue continue
} }
s.logger.Println("retention policy enforcement commencing") s.logger.Println("retention policy enforcement check commencing")
s.MetaStore.VisitRetentionPolicies(func(d meta.DatabaseInfo, r meta.RetentionPolicyInfo) { s.MetaStore.VisitRetentionPolicies(func(d meta.DatabaseInfo, r meta.RetentionPolicyInfo) {
for _, g := range r.ExpiredShardGroups(time.Now().UTC()) { for _, g := range r.ExpiredShardGroups(time.Now().UTC()) {
@ -101,7 +101,7 @@ func (s *Service) deleteShards() {
return return
case <-ticker.C: case <-ticker.C:
s.logger.Println("retention policy shard deletion commencing") s.logger.Println("retention policy shard deletion check commencing")
deletedShardIDs := make(map[uint64]struct{}, 0) deletedShardIDs := make(map[uint64]struct{}, 0)
s.MetaStore.VisitRetentionPolicies(func(d meta.DatabaseInfo, r meta.RetentionPolicyInfo) { s.MetaStore.VisitRetentionPolicies(func(d meta.DatabaseInfo, r meta.RetentionPolicyInfo) {
@ -118,7 +118,7 @@ func (s *Service) deleteShards() {
s.logger.Printf("failed to delete shard ID %d: %s", id, err.Error()) s.logger.Printf("failed to delete shard ID %d: %s", id, err.Error())
continue continue
} }
s.logger.Printf("shard ID% deleted", id) s.logger.Printf("shard ID %d deleted", id)
} }
} }
} }