From 24590cf4761d017245624dcfa6cb223eb196863c Mon Sep 17 00:00:00 2001 From: Faith Chikwekwe Date: Tue, 5 Nov 2019 17:13:13 -0800 Subject: [PATCH] fix(cmd/influx): fix bug that causes long startup when running 'influx help' or related commands --- CHANGELOG.md | 1 + cmd/influx/query.go | 9 ++++++++- cmd/influx/repl.go | 7 ++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f6384bdd10..2a462c8976c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Bug Fixes +1. [15777](https://github.com/influxdata/influxdb/pull/15777): fix long startup when running 'influx help' 1. [15731](https://github.com/influxdata/influxdb/pull/15731): Ensure array cursor iterator stats accumulate all cursor stats ## v2.0.0-alpha.19 [2019-10-30] diff --git a/cmd/influx/query.go b/cmd/influx/query.go index 8c56305a89c..75e60bde4d9 100644 --- a/cmd/influx/query.go +++ b/cmd/influx/query.go @@ -4,9 +4,13 @@ import ( "context" "fmt" + "github.com/influxdata/flux" + "github.com/influxdata/flux/repl" + _ "github.com/influxdata/flux/stdlib" // Import the stdlib platform "github.com/influxdata/influxdb" - _ "github.com/influxdata/influxdb/query/builtin" + + _ "github.com/influxdata/influxdb/query/stdlib" // Import the stdlib "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -40,6 +44,9 @@ func init() { } func fluxQueryF(cmd *cobra.Command, args []string) error { + + flux.FinalizeBuiltIns() + if flags.local { return fmt.Errorf("local flag not supported for query command") } diff --git a/cmd/influx/repl.go b/cmd/influx/repl.go index 5efb46f3afc..556e4e325ed 100644 --- a/cmd/influx/repl.go +++ b/cmd/influx/repl.go @@ -6,10 +6,12 @@ import ( "github.com/influxdata/flux" "github.com/influxdata/flux/repl" + _ "github.com/influxdata/flux/stdlib" // Import the stdlib platform "github.com/influxdata/influxdb" "github.com/influxdata/influxdb/http" "github.com/influxdata/influxdb/query" - _ "github.com/influxdata/influxdb/query/builtin" + + _ "github.com/influxdata/influxdb/query/stdlib" // Import the stdlib "github.com/spf13/cobra" "github.com/spf13/viper" ) @@ -41,6 +43,9 @@ func init() { } func replF(cmd *cobra.Command, args []string) error { + + flux.FinalizeBuiltIns() + if flags.local { return fmt.Errorf("local flag not supported for repl command") }