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

Deleted shard groups are not counted as "expired" #2792

Merged
merged 1 commit into from
Jun 5, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions meta/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,9 @@ func (rpi *RetentionPolicyInfo) ShardGroupByTimestamp(timestamp time.Time) *Shar
func (rpi *RetentionPolicyInfo) ExpiredShardGroups(t time.Time) []*ShardGroupInfo {
groups := make([]*ShardGroupInfo, 0)
for i := range rpi.ShardGroups {
if rpi.ShardGroups[i].Deleted() {
continue
}
if rpi.Duration != 0 && rpi.ShardGroups[i].EndTime.Add(rpi.Duration).Before(t) {
groups = append(groups, &rpi.ShardGroups[i])
}
Expand Down
6 changes: 3 additions & 3 deletions services/retention/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *Service) deleteShardGroups() {
if !s.MetaStore.IsLeader() {
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) {
for _, g := range r.ExpiredShardGroups(time.Now().UTC()) {
Expand Down Expand Up @@ -101,7 +101,7 @@ func (s *Service) deleteShards() {
return

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)
s.MetaStore.VisitRetentionPolicies(func(d meta.DatabaseInfo, r meta.RetentionPolicyInfo) {
Expand All @@ -118,7 +118,7 @@ func (s *Service) deleteShards() {
s.logger.Printf("failed to delete shard ID %d: %s", id, err.Error())
continue
}
s.logger.Printf("shard ID% deleted", id)
s.logger.Printf("shard ID %d deleted", id)
}
}
}
Expand Down