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

feat: Port 1.x retention policy enforcement service #19521

Merged
merged 3 commits into from
Sep 9, 2020

Conversation

stuartcarnie
Copy link
Contributor

@stuartcarnie stuartcarnie commented Sep 8, 2020

Closes #19309

This PR introduces the retention policy enforcement service from InfluxDB 1.x. This service is responsible for evaluating retention policy rules and deleted shards which fall outside the time bounds.

In addition, configuration of the check interval is available via

--storage-retention-check-interval=<duration>

Finally, due to the introduction of the retention policy service, a number of types and interfaces were removed to keep the static checker happy, as they were no longer used.

@stuartcarnie stuartcarnie added the area/2.x OSS 2.0 related issues and PRs label Sep 8, 2020
@stuartcarnie stuartcarnie added this to the Sprint 20-Q3-6 milestone Sep 8, 2020
@stuartcarnie stuartcarnie self-assigned this Sep 8, 2020
@stuartcarnie stuartcarnie force-pushed the sgc/issue/19309 branch 3 times, most recently from 6c1a5ce to faed872 Compare September 8, 2020 23:34
@stuartcarnie stuartcarnie marked this pull request as ready for review September 9, 2020 14:10
@stuartcarnie stuartcarnie requested review from a team, sebito91 and benbjohnson and removed request for a team and sebito91 September 9, 2020 14:10
return nil
}

// TODO: Should we enforce a minimum interval?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure it's worth adding minimums. Hopefully people won't be adjusting this config option at all.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will remove that comment


config Config
wg sync.WaitGroup
done chan struct{}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit. This is probably just ported over from the previous implementation but I like using a cancelable background context instead of a done channel. It handles idempotency during closing and a lot of things already take a context.Context.

e.g.

type Service struct {
    ctx context.Context
    cancel func()
}

func NewService() *Service {
    s := &Service{}
    s.ctx, s.cancel = context.WithCancel(context.Background())
    return s
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good shout – I'll alter the Open method to take a context.Context

Configuration of the check interval is available via

```
--storage-retention-check-interval
```

Closes #19309
* Pass context.Context to Service.Open
* Remove redundant comments
* Bind to retention.Config configuration to be consistent with 1.x
@stuartcarnie stuartcarnie merged commit e265f60 into master Sep 9, 2020
@stuartcarnie stuartcarnie deleted the sgc/issue/19309 branch September 9, 2020 17:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/2.x OSS 2.0 related issues and PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Port 1.x Retention Policy service
2 participants