influx-cli icon indicating copy to clipboard operation
influx-cli copied to clipboard

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

Open paulheg opened this issue 1 year ago • 2 comments

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 avatar Feb 14 '24 16:02 paulheg

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

paulheg avatar Feb 14 '24 16:02 paulheg

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

philjb avatar Feb 14 '24 18:02 philjb