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

fix: remove breaking argument validation for _fieldKeys iterator #23875

Merged
merged 1 commit into from
Nov 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions cmd/influx_tools/export/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/influxdata/influxdb/cmd/influx_tools/internal/format/line"
"github.com/influxdata/influxdb/cmd/influx_tools/internal/format/text"
"github.com/influxdata/influxdb/cmd/influx_tools/server"
errors2 "github.com/influxdata/influxdb/pkg/errors"
"go.uber.org/zap"
)

Expand Down Expand Up @@ -105,9 +106,7 @@ func (cmd *Command) Run(args []string) (err error) {
case "discard":
wr = format.Discard
}
defer func() {
err = wr.Close()
}()
defer errors2.Capture(&err, wr.Close)()
Copy link
Contributor

Choose a reason for hiding this comment

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

Oops - does e, err := cmd.openExporter() above shadow err?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nevermind, this is fine


if cmd.conflicts != nil {
wr = format.NewConflictWriter(wr, line.NewWriter(cmd.conflicts))
Expand Down
11 changes: 0 additions & 11 deletions tsdb/shard.go
Original file line number Diff line number Diff line change
Expand Up @@ -2316,17 +2316,6 @@ const (
// NewFieldKeysIterator returns an iterator that can be iterated over to
// retrieve field keys.
func NewFieldKeysIterator(sh *Shard, opt query.IteratorOptions) (query.Iterator, error) {
const fieldKey = `fieldKey`
const fieldKeyType = `fieldType`
if len(opt.Aux) != 2 {
return nil, fmt.Errorf("wrong number of field arguments for Field Keys iterator. Expected 2, got %d", len(opt.Aux))
}
if opt.Aux[0].Val != fieldKey || opt.Aux[1].Val != fieldKeyType {
return nil,
fmt.Errorf("incorrect fields specified for Field Keys iterator: expected %s, got %s and expected %s, got %s",
fieldKey, opt.Aux[0].Val, fieldKeyType, opt.Aux[1].Val)
}

itr := &fieldKeysIterator{shard: sh}

index, err := sh.Index()
Expand Down