influxdata / influx-cli

CLI for managing resources in InfluxDB v2
MIT License
61 stars 22 forks source link

shard duration 0 (infinite) not applying, `Error: retention policy duration must be greater than the shard duration` #524

Open paulheg opened 4 months ago

paulheg commented 4 months ago

Steps to reproduce: List the minimal actions needed to reproduce the behaviour.

  1. create influxdb:latest container
  2. try creating a bucket with influx bucket create --name "test" --shard-group-duration 10000w -r 0

Expected behaviour: Should create the bucket since the retention value is zero -> infinite

Actual behaviour: Error: failed to create bucket: 500 Internal Server Error: retention policy duration must be greater than the shard duration

Environment info: INFLUXDB_VERSION: 2.7.3 INFLUX_CLI_VERSION: 2.7.3

paulheg commented 4 months ago

just tested it with INFLUXDB_VERSION 2.7.5 INFLUX_CLI_VERSION 2.7.3, with no luck

philjb commented 4 months ago

Hi - this is an issue in the influx-cli tool: https://github.com/influxdata/influx-cli, not influxdb 2.7 itself. The tool does not support creating an infinite duration bucket with an explicit shard group duration, because it is defaulting the retention to 720hrs (30 days) if the retention is zero but a shard group duration is specified.

See this code block: https://github.com/influxdata/influx-cli/blob/c73d46ed4246ae168a07f70c34474056f54bc4f7/clients/bucket/create.go#L53-L56

If you're willing, you can submit a pr to fix it in the tool.

You can create your bucket directly using the api instead of the cli tool: https://docs.influxdata.com/influxdb/v2/admin/buckets/create-bucket/?t=InfluxDB+API