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

Enforce retention policies #1562

Merged
merged 13 commits into from
Feb 11, 2015
Merged

Enforce retention policies #1562

merged 13 commits into from
Feb 11, 2015

Conversation

otoolep
Copy link
Contributor

@otoolep otoolep commented Feb 10, 2015

No description provided.

@otoolep
Copy link
Contributor Author

otoolep commented Feb 11, 2015

This is work-in-progress, as I have some questions about this untested implementation, and also need to add unit-testing.

@otoolep
Copy link
Contributor Author

otoolep commented Feb 11, 2015

A summary of the implementation follows.

Each data node runs the "retention policy enforcement" loop, and looks for shard groups within each Retention Policy, which have an "end time", plus the retention period, earlier than now. For all matching shard groups, a command is sent to the Raft cluster, requesting deletion of this shard group. Each data node, upon receipt of this command, deletes any shards it has associated with this shard group, and updates its local copy of the metastore.

Because all data nodes will run the loop, it does mean that multiple deletion commands may be generated for a given shard group (when its end time passes) -- the data nodes account for this by simply ignoring requests to delete non-existent shard groups.

@otoolep otoolep force-pushed the enforce_retention_policies branch 4 times, most recently from 388d3dc to cb3d19f Compare February 11, 2015 01:38
}

// Remove from metastore.
rp.removeShardGroupByID(c.ID)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is these lines I have questions about for @benbjohnson around serlialization of database meta to metastore.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Answered by @benbjohnson and fixed by beefdee

@otoolep
Copy link
Contributor Author

otoolep commented Feb 11, 2015

Unit tests added, green build.

Still need to perform some system testing.

@otoolep otoolep force-pushed the enforce_retention_policies branch 3 times, most recently from bd478c8 to f544bea Compare February 11, 2015 05:57
@otoolep otoolep self-assigned this Feb 11, 2015
MaxOpenShards int `toml:"max-open-shards"`
PointBatchSize int `toml:"point-batch-size"`
WriteBatchSize int `toml:"write-batch-size"`
Engines map[string]toml.Primitive `toml:"engines"`
Copy link
Member

Choose a reason for hiding this comment

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

Should just remove the WriteBufferSize, MaxOpenShards, PointBatchSize, WriteBatchSize, and Engines members on the Data struct

@pauldix
Copy link
Member

pauldix commented Feb 11, 2015

One small comment, but other than that LGTM

@otoolep
Copy link
Contributor Author

otoolep commented Feb 11, 2015

I performed a system test this morning, using an actual influxd process. Code looks good. I created a long (1 hour) and short (1 minute) retention policy, and wrote data to each. Within a couple of minutes (system had a retention check interval of 30 seconds) the short policy's shard groups were deleted. Log follows.

[srvr] 2015/02/11 10:18:04 broker enforcing retention policies with check interval of 30s
...
[srvr] 2015/02/11 10:18:34 retention policy enforcement check commencing
[srvr] 2015/02/11 10:19:04 retention policy enforcement check commencing
[srvr] 2015/02/11 10:19:34 retention policy enforcement check commencing
[srvr] 2015/02/11 10:20:04 retention policy enforcement check commencing
[srvr] 2015/02/11 10:20:04 shard group 1, retention policy short, database foo due for deletion
[srvr] 2015/02/11 10:20:34 retention policy enforcement check commencing

Queries of data in short returned no results, but queries of data in long did.

@otoolep
Copy link
Contributor Author

otoolep commented Feb 11, 2015

This appears to be an integration test failure, I haven't seen it before. The integration tests may still be racy.

I'll kick Travis and try again.

@otoolep
Copy link
Contributor Author

otoolep commented Feb 11, 2015

Green build, we appear to have some racy tests. This is currently captured by issue #1556.

otoolep added a commit that referenced this pull request Feb 11, 2015
@otoolep otoolep merged commit af41030 into master Feb 11, 2015
@otoolep otoolep removed the review label Feb 11, 2015
@otoolep otoolep deleted the enforce_retention_policies branch February 11, 2015 18:51
for _, db := range s.databases {
for _, rp := range db.policies {
for _, g := range rp.shardGroups {
if g.EndTime.Add(rp.Duration).Before(time.Now()) {
Copy link
Member

Choose a reason for hiding this comment

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

Should be using UTC here, otherwise it's going to be off if their server isn't set to that.

mark-rushakoff pushed a commit that referenced this pull request Jan 11, 2019
Fixed the task id path, Added RunController instance to pAdapter
mark-rushakoff pushed a commit that referenced this pull request Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants