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 delete from influxdb #98

Merged
merged 3 commits into from May 20, 2021
Merged

feat: port delete from influxdb #98

merged 3 commits into from May 20, 2021

Conversation

danxmoran
Copy link
Contributor

Closes #11

internal/api/cli.gen.yml Outdated Show resolved Hide resolved
if !params.BucketID.Valid() && params.BucketName == "" {
return ErrMustSpecifyBucket
}
start, err := time.Parse(time.RFC3339Nano, params.Start)
Copy link
Contributor

Choose a reason for hiding this comment

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

I had a couple synapses connect while thinking through the time parsing. A while back I worked on this: influxdata/influxdb#21369 - which added a range of allowable start and stop times that the /api/v2/delete API endpoint. When you get into the inner workings of the OSS storage engine the dates get converted to unix time and there can be some weird stuff happening if the dates are outside a (admittedly ridiculous) timeframe.

So I'm wondering what happens if you send dates outside this time range via the CLI to the OSS API. I guess you'd get an error response that the CLI would display? That would probably be alright. Or do you need to prevent invalid time ranges on the CLI...and how that might work with cloud, since I don't know if that API has similar limitations.

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 thought, looks like a decent UX to me:

$ ./bin/darwin/influx delete --bucket dan --start '1677-09-21T00:12:42Z' --stop '2020-01-01T00:00:00Z'
Error: failed to delete data: invalid request; error parsing request json: invalid start time, start time must not be before 1677-09-21T00:12:43.145224194Z
$ ./bin/darwin/influx delete --bucket dan --start '2020-01-01T00:00:00Z' --stop '2262-04-11T23:47:17Z'
Error: failed to delete data: invalid request; error parsing request json: invalid stop time, stop time must not be after 2262-04-11T23:47:16.854775806Z

Copy link
Contributor

Choose a reason for hiding this comment

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

Good deal, that does seem to convey the right message.

Copy link
Contributor

@williamhbaker williamhbaker left a comment

Choose a reason for hiding this comment

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

👍

@danxmoran danxmoran merged commit e4af676 into main May 20, 2021
@danxmoran danxmoran deleted the dm-port-delete-11 branch May 20, 2021 13:20
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.

Port the delete command tree from influxdb
2 participants