-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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: add shard-group duration settings to CLI and API #20620
Conversation
Hi @hinst, thank you for this contribution! Since this affects the server's public API, I'll need to check with our Cloud team to be sure it's something they're also able to implement and support. |
@hinst apologies for the long delay. The good news is that we intent to accept this change! Ideally as part of our upcoming 2.0.5 release. I need to double-check the proposed API for any edge cases and open a parallel PR against our Cloud implementation (returning a "not implemented" error if the new feature is used there) |
@@ -60,6 +60,7 @@ Replacement `tsi1` indexes will be automatically generated on startup for shards | |||
1. [20565](https://github.com/influxdata/influxdb/pull/20565): Update V1 API spec to document all valid Accept headers and matching Content-Types. | |||
1. [20578](https://github.com/influxdata/influxdb/pull/20578): Respect the --skip-verify flag when running `influx query`. | |||
1. [20495](https://github.com/influxdata/influxdb/pull/20495): Update Flux functions list in UI to reflect that `v1` package was renamed to `schema`. | |||
1. [19764](https://github.com/influxdata/influxdb/pull/20620): Add shard duration settings to CLI and API |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After rebasing onto / merging with latest master
, this will need to move up to the "Features" section under "unreleased". Would propose:
1. [19764](https://github.com/influxdata/influxdb/pull/20620): Add shard duration settings to CLI and API | |
1. [20620](https://github.com/influxdata/influxdb/pull/20620): Add support for explicitly setting shard-group durations. Thanks @hinst! |
@@ -73,6 +74,7 @@ func (b *cmdBucketBuilder) cmdCreate() *cobra.Command { | |||
|
|||
cmd.Flags().StringVarP(&b.description, "description", "d", "", "Description of bucket that will be created") | |||
cmd.Flags().StringVarP(&b.retention, "retention", "r", "", "Duration bucket will retain data. 0 is infinite. Default is 0.") | |||
cmd.Flags().StringVarP(&b.shardGroupDuration, "shardDuration", "", "", "Shard group duration used internally in storage. Default is 7 days") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cmd.Flags().StringVarP(&b.shardGroupDuration, "shardDuration", "", "", "Shard group duration used internally in storage. Default is 7 days") | |
cmd.Flags().StringVarP(&b.shardGroupDuration, "shardDuration", "", "", "Shard group duration used internally by the storage engine. Can only be specified when using InfluxDB OSS.") |
@@ -335,6 +343,7 @@ func (b *cmdBucketBuilder) printBuckets(printOpt bucketPrintOpt) error { | |||
"ID": bkt.ID.String(), | |||
"Name": bkt.Name, | |||
"Retention": bkt.RetentionPeriod, | |||
"Shard duration": bkt.ShardGroupDuration, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to think through what this will look like when listing objects returned by InfluxDB Cloud.
@@ -320,7 +328,7 @@ func (b *cmdBucketBuilder) printBuckets(printOpt bucketPrintOpt) error { | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's too far from the diff for me to comment on directly, but I think we'll also need support in the update
command.
The server-side code for the update path will also need changed. At the moment, I believe it will reset the shard-group duration every time the retention policy is updated. We probably instead want the update
API to accept both an RP and a shard-group duration (each one optional), and use:
- Duration is unset = don't change the current shard-group duration
- Duration set to 0 = have the server recompute a "good" duration based on the bucket's RP
shardGroupDuration: | ||
type: integer | ||
format: int64 | ||
description: shard duration measured in nanoseconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of nanos, could we use seconds to match the units used by retentionRules
?
@@ -36,6 +36,7 @@ type Bucket struct { | |||
Description string `json:"description"` | |||
RetentionPolicyName string `json:"rp,omitempty"` // This to support v1 sources | |||
RetentionPeriod time.Duration `json:"retentionPeriod"` | |||
ShardGroupDuration time.Duration `json:"shardGroupDuration"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may need to make this:
ShardGroupDuration time.Duration `json:"shardGroupDuration"` | |
ShardGroupDuration *time.Duration `json:"shardGroupDuration,omitempty"` |
So Cloud can distinguish not-set from explicitly-0. Will get back to you after I work on the Cloud side of things...
For anyone watching this PR: I've pulled @hinst's commits into a branch of my own, where I'm iterating on the API design |
Hi |
Closes #19764
Changes: