From 291dd08cd48a7a662e11090fe7759e4dd7a90a4f Mon Sep 17 00:00:00 2001 From: Ben Johnson Date: Tue, 26 Apr 2016 10:01:10 -0600 Subject: [PATCH] remove SHOW SERVERS & DROP SERVER This commit removes support for `SHOW SERVERS` and `DROP SERVER` from the `influxql` package. It also removes extraneous cluster testing code from `cmd/influxd/run`. Fixes #6465 --- CHANGELOG.md | 1 + cmd/influxd/run/server_cluster_test.go | 357 ------------------------- cmd/influxd/run/server_helpers_test.go | 193 ------------- cmd/influxd/run/server_test.go | 2 +- influxql/README.md | 6 +- influxql/ast.go | 42 --- influxql/parser.go | 37 +-- influxql/parser_test.go | 22 +- influxql/scanner_test.go | 2 - influxql/token.go | 8 - 10 files changed, 8 insertions(+), 662 deletions(-) delete mode 100644 cmd/influxd/run/server_cluster_test.go diff --git a/CHANGELOG.md b/CHANGELOG.md index 78effc69dba..19ebd670a9a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ - [#3883](https://github.com/influxdata/influxdb/issues/3883): Improve query sanitization to prevent a password leak in the logs. - [#6462](https://github.com/influxdata/influxdb/pull/6462): Add safer locking to CreateFieldIfNotExists - [#6361](https://github.com/influxdata/influxdb/pull/6361): Fix cluster/pool release of connection +- [#6470](https://github.com/influxdata/influxdb/pull/6470): Remove SHOW SERVERS & DROP SERVER support ## v0.12.2 [2016-04-20] diff --git a/cmd/influxd/run/server_cluster_test.go b/cmd/influxd/run/server_cluster_test.go deleted file mode 100644 index d126d1f49d5..00000000000 --- a/cmd/influxd/run/server_cluster_test.go +++ /dev/null @@ -1,357 +0,0 @@ -package run_test - -import ( - "fmt" - "strings" - "testing" - "time" - - "github.com/influxdata/influxdb/cmd/influxd/run" -) - -func TestCluster_CreateDatabase(t *testing.T) { - t.Skip() - t.Parallel() - - c, err := NewClusterWithDefaults(5) - defer c.Close() - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } -} - -func TestCluster_Write(t *testing.T) { - t.Skip() - t.Parallel() - - c, err := NewClusterWithDefaults(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - writes := []string{ - fmt.Sprintf(`cpu,host=serverA,region=uswest val=23.2 %d`, mustParseTime(time.RFC3339Nano, "2000-01-01T00:00:00Z").UnixNano()), - } - - _, err = c.Servers[0].Write("db0", "default", strings.Join(writes, "\n"), nil) - if err != nil { - t.Fatal(err) - } - - q := &Query{ - name: "write", - command: `SELECT * FROM db0."default".cpu`, - exp: `{"results":[{"series":[{"name":"cpu","columns":["time","host","region","val"],"values":[["2000-01-01T00:00:00Z","serverA","uswest",23.2]]}]}]}`, - } - err = c.QueryAll(q) - if err != nil { - t.Fatal(err) - } -} - -func TestCluster_DatabaseCommands(t *testing.T) { - t.Skip() - t.Parallel() - c, err := NewCluster(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - - defer c.Close() - - test := tests.load(t, "database_commands") - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} - -func TestCluster_Query_DropAndRecreateDatabase(t *testing.T) { - t.Skip() - t.Parallel() - c, err := NewCluster(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - test := tests.load(t, "drop_and_recreate_database") - - s := c.Servers[0] - if err := s.CreateDatabaseAndRetentionPolicy(test.database(), newRetentionPolicyInfo(test.retentionPolicy(), 1, 0)); err != nil { - t.Fatal(err) - } - if err := s.MetaClient.SetDefaultRetentionPolicy(test.database(), test.retentionPolicy()); err != nil { - t.Fatal(err) - } - - if err = writeTestData(c.Servers[0], &test); err != nil { - t.Fatal(err) - } - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} - -func TestCluster_Query_DropDatabaseIsolated(t *testing.T) { - t.Skip() - t.Parallel() - c, err := NewCluster(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - test := tests.load(t, "drop_database_isolated") - - s := c.Servers[0] - if err := s.CreateDatabaseAndRetentionPolicy("db0", newRetentionPolicyInfo("rp0", 1, 0)); err != nil { - t.Fatal(err) - } - if err := s.MetaClient.SetDefaultRetentionPolicy("db0", "rp0"); err != nil { - t.Fatal(err) - } - if err := s.CreateDatabaseAndRetentionPolicy("db1", newRetentionPolicyInfo("rp1", 1, 0)); err != nil { - t.Fatal(err) - } - - if err = writeTestData(s, &test); err != nil { - t.Fatal(err) - } - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} - -func TestCluster_Query_DropAndRecreateSeries(t *testing.T) { - t.Parallel() - t.Skip() - c, err := NewCluster(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - test := tests.load(t, "drop_and_recreate_series") - - s := c.Servers[0] - if err := s.CreateDatabaseAndRetentionPolicy("db0", newRetentionPolicyInfo("rp0", 1, 0)); err != nil { - t.Fatal(err) - } - if err := s.MetaClient.SetDefaultRetentionPolicy("db0", "rp0"); err != nil { - t.Fatal(err) - } - - if err = writeTestData(s, &test); err != nil { - t.Fatal(err) - } - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Fatal(query.Error(err)) - } - } - - // Re-write data and test again. - retest := tests.load(t, "drop_and_recreate_series_retest") - - if err = writeTestData(s, &test); err != nil { - t.Fatal(err) - } - - for _, query := range retest.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} - -func TestCluster_Query_DropSeriesFromRegex(t *testing.T) { - t.Parallel() - t.Skip() - c, err := NewCluster(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - test := tests.load(t, "drop_series_from_regex") - - s := c.Servers[0] - if err := s.CreateDatabaseAndRetentionPolicy(test.database(), newRetentionPolicyInfo(test.retentionPolicy(), 1, 0)); err != nil { - t.Fatal(err) - } - if err := s.MetaClient.SetDefaultRetentionPolicy(test.database(), test.retentionPolicy()); err != nil { - t.Fatal(err) - } - - if err = writeTestData(s, &test); err != nil { - t.Fatal(err) - } - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} - -func TestCluster_RetentionPolicyCommands(t *testing.T) { - t.Skip() - t.Parallel() - - configFunc := func(index int, config *run.Config) { - config.Meta.RetentionAutoCreate = false - } - - c, err := NewClusterCustom(5, configFunc) - - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - test := tests.load(t, "retention_policy_commands") - - s := c.Servers[0] - if _, err := s.MetaClient.CreateDatabase(test.database()); err != nil { - t.Fatal(err) - } - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} - -func TestCluster_DatabaseRetentionPolicyAutoCreate(t *testing.T) { - t.Parallel() - t.Skip() - c, err := NewCluster(5) - if err != nil { - t.Fatalf("error creating cluster: %s", err) - } - defer c.Close() - - test := tests.load(t, "retention_policy_auto_create") - - for _, query := range test.queries { - if query.skip { - t.Logf("SKIP:: %s", query.name) - continue - } - t.Logf("Running %s", query.name) - if query.once { - if _, err := c.Query(query); err != nil { - t.Error(query.Error(err)) - } else if !query.success() { - t.Error(query.failureMessage()) - } - continue - } - if err := c.QueryAll(query); err != nil { - t.Error(query.Error(err)) - } - } -} diff --git a/cmd/influxd/run/server_helpers_test.go b/cmd/influxd/run/server_helpers_test.go index 2d14ba50be7..4124c96b71a 100644 --- a/cmd/influxd/run/server_helpers_test.go +++ b/cmd/influxd/run/server_helpers_test.go @@ -13,11 +13,9 @@ import ( "os" "regexp" "strings" - "sync" "testing" "time" - "github.com/influxdata/influxdb/client/v2" "github.com/influxdata/influxdb/cmd/influxd/run" "github.com/influxdata/influxdb/services/httpd" "github.com/influxdata/influxdb/services/meta" @@ -482,194 +480,3 @@ func configureLogging(s *Server) { s.SetLogOutput(ioutil.Discard) } } - -type Cluster struct { - Servers []*Server -} - -func NewCluster(size int) (*Cluster, error) { - c := Cluster{} - c.Servers = append(c.Servers, OpenServer(NewConfig())) - - for i := 1; i < size; i++ { - c.Servers = append(c.Servers, OpenServer(NewConfig())) - } - - for _, s := range c.Servers { - configureLogging(s) - } - - if err := verifyCluster(&c, size); err != nil { - return nil, err - } - - return &c, nil -} - -func verifyCluster(c *Cluster, size int) error { - r, err := c.Servers[0].Query("SHOW SERVERS") - if err != nil { - return err - } - var cl client.Response - if e := json.Unmarshal([]byte(r), &cl); e != nil { - return e - } - - // grab only the meta nodes series - series := cl.Results[0].Series[0] - for i, value := range series.Values { - addr := c.Servers[0].MetaServers()[0] - if value[0].(float64) != float64(i+1) { - return fmt.Errorf("expected nodeID %d, got %v", i, value[0]) - } - if value[1].(string) != addr { - return fmt.Errorf("expected addr %s, got %v", addr, value[1]) - } - } - - return nil -} - -func NewClusterWithDefaults(size int) (*Cluster, error) { - c, err := NewCluster(size) - if err != nil { - return nil, err - } - - r, err := c.Query(&Query{command: "CREATE DATABASE db0"}) - if err != nil { - return nil, err - } - if r != emptyResults { - return nil, fmt.Errorf("%s", r) - } - - for i, s := range c.Servers { - got, err := s.Query("SHOW DATABASES") - if err != nil { - return nil, fmt.Errorf("failed to query databases on node %d for show databases", i+1) - } - if exp := `{"results":[{"series":[{"name":"databases","columns":["name"],"values":[["db0"]]}]}]}`; got != exp { - return nil, fmt.Errorf("unexpected result node %d\nexp: %s\ngot: %s\n", i+1, exp, got) - } - } - - return c, nil -} - -func NewClusterCustom(size int, cb func(index int, config *run.Config)) (*Cluster, error) { - c := Cluster{} - - config := NewConfig() - cb(0, config) - - c.Servers = append(c.Servers, OpenServer(config)) - - for i := 1; i < size; i++ { - config := NewConfig() - cb(i, config) - c.Servers = append(c.Servers, OpenServer(config)) - } - - for _, s := range c.Servers { - configureLogging(s) - } - - if err := verifyCluster(&c, size); err != nil { - return nil, err - } - - return &c, nil -} - -// Close shuts down all servers. -func (c *Cluster) Close() { - var wg sync.WaitGroup - wg.Add(len(c.Servers)) - - for _, s := range c.Servers { - go func(s *Server) { - defer wg.Done() - s.Close() - }(s) - } - wg.Wait() -} - -func (c *Cluster) Query(q *Query) (string, error) { - r, e := c.Servers[0].Query(q.command) - q.act = r - return r, e -} - -func (c *Cluster) QueryIndex(index int, q string) (string, error) { - return c.Servers[index].Query(q) -} - -func (c *Cluster) QueryAll(q *Query) error { - type Response struct { - Val string - Err error - } - - timeoutErr := fmt.Errorf("timed out waiting for response") - - queryAll := func() error { - // if a server doesn't return in 5 seconds, fail the response - timeout := time.After(5 * time.Second) - ch := make(chan Response, 0) - - for _, s := range c.Servers { - go func(s *Server) { - r, err := s.QueryWithParams(q.command, q.params) - ch <- Response{Val: r, Err: err} - }(s) - } - - resps := []Response{} - for i := 0; i < len(c.Servers); i++ { - select { - case r := <-ch: - resps = append(resps, r) - case <-timeout: - return timeoutErr - } - } - - for _, r := range resps { - if r.Err != nil { - return r.Err - } - if q.pattern { - if !expectPattern(q.exp, r.Val) { - return fmt.Errorf("unexpected pattern: \n\texp: %s\n\tgot: %s\n", q.exp, r.Val) - } - } else { - if r.Val != q.exp { - return fmt.Errorf("unexpected value:\n\texp: %s\n\tgot: %s\n", q.exp, r.Val) - } - } - } - - return nil - } - - tick := time.Tick(100 * time.Millisecond) - // if we don't reach consensus in 20 seconds, fail the query - timeout := time.After(20 * time.Second) - - if err := queryAll(); err == nil { - return nil - } - for { - select { - case <-tick: - if err := queryAll(); err == nil { - return nil - } - case <-timeout: - return fmt.Errorf("timed out waiting for response") - } - } -} diff --git a/cmd/influxd/run/server_test.go b/cmd/influxd/run/server_test.go index feeb365f4fe..f6587167c1e 100644 --- a/cmd/influxd/run/server_test.go +++ b/cmd/influxd/run/server_test.go @@ -4575,7 +4575,7 @@ func TestServer_Query_Where_With_Tags(t *testing.T) { name: "where on tag that should be double quoted but isn't", params: url.Values{"db": []string{"db0"}}, command: `show series where data-center = 'foo'`, - exp: `{"error":"error parsing query: found DATA, expected identifier, string, number, bool at line 1, char 19"}`, + exp: `{"results":[{"error":"invalid tag comparison operator"}]}`, }, &Query{ name: "where comparing tag and field", diff --git a/influxql/README.md b/influxql/README.md index db7cfd93099..05839c8bcd2 100644 --- a/influxql/README.md +++ b/influxql/README.md @@ -105,9 +105,9 @@ INTO KEY KEYS LIMIT SHOW MEASUREMEN MEASUREMENTS NOT OFFSET ON ORDER PASSWORD POLICY POLICIES PRIVILEGES QUERIES QUERY READ REPLICATION RESAMPLE RETENTION REVOKE SELECT SERIES -SERVER SERVERS SET SHARD SHARDS SLIMIT -SOFFSET STATS SUBSCRIPTION SUBSCRIPTIONS TAG TO -USER USERS VALUES WHERE WITH WRITE +SET SHARD SHARDS SLIMIT SOFFSET STATS +SUBSCRIPTION SUBSCRIPTIONS TAG TO USER USERS +VALUES WHERE WITH WRITE ``` ## Literals diff --git a/influxql/ast.go b/influxql/ast.go index c1811f6a1d9..3a452587e8c 100644 --- a/influxql/ast.go +++ b/influxql/ast.go @@ -102,7 +102,6 @@ func (*DropDatabaseStatement) node() {} func (*DropMeasurementStatement) node() {} func (*DropRetentionPolicyStatement) node() {} func (*DropSeriesStatement) node() {} -func (*DropServerStatement) node() {} func (*DropShardStatement) node() {} func (*DropSubscriptionStatement) node() {} func (*DropUserStatement) node() {} @@ -115,7 +114,6 @@ func (*SelectStatement) node() {} func (*SetPasswordUserStatement) node() {} func (*ShowContinuousQueriesStatement) node() {} func (*ShowGrantsForUserStatement) node() {} -func (*ShowServersStatement) node() {} func (*ShowDatabasesStatement) node() {} func (*ShowFieldKeysStatement) node() {} func (*ShowRetentionPoliciesStatement) node() {} @@ -217,7 +215,6 @@ func (*DropDatabaseStatement) stmt() {} func (*DropMeasurementStatement) stmt() {} func (*DropRetentionPolicyStatement) stmt() {} func (*DropSeriesStatement) stmt() {} -func (*DropServerStatement) stmt() {} func (*DropSubscriptionStatement) stmt() {} func (*DropUserStatement) stmt() {} func (*GrantStatement) stmt() {} @@ -225,7 +222,6 @@ func (*GrantAdminStatement) stmt() {} func (*KillQueryStatement) stmt() {} func (*ShowContinuousQueriesStatement) stmt() {} func (*ShowGrantsForUserStatement) stmt() {} -func (*ShowServersStatement) stmt() {} func (*ShowDatabasesStatement) stmt() {} func (*ShowFieldKeysStatement) stmt() {} func (*ShowMeasurementsStatement) stmt() {} @@ -2168,33 +2164,6 @@ func (s DropSeriesStatement) RequiredPrivileges() ExecutionPrivileges { return ExecutionPrivileges{{Admin: false, Name: "", Privilege: WritePrivilege}} } -// DropServerStatement represents a command for removing a server from the cluster. -type DropServerStatement struct { - // ID of the node to be dropped. - NodeID uint64 - - // Meta indicates if the server being dropped is a meta or data node - Meta bool -} - -// String returns a string representation of the drop series statement. -func (s *DropServerStatement) String() string { - var buf bytes.Buffer - _, _ = buf.WriteString("DROP ") - if s.Meta { - _, _ = buf.WriteString(" META SERVER ") - } else { - _, _ = buf.WriteString(" DATA SERVER ") - } - _, _ = buf.WriteString(strconv.FormatUint(s.NodeID, 10)) - return buf.String() -} - -// RequiredPrivileges returns the privilege required to execute a DropServerStatement. -func (s *DropServerStatement) RequiredPrivileges() ExecutionPrivileges { - return ExecutionPrivileges{{Name: "", Privilege: AllPrivileges}} -} - // DropShardStatement represents a command for removing a shard from // the node. type DropShardStatement struct { @@ -2247,17 +2216,6 @@ func (s *ShowGrantsForUserStatement) RequiredPrivileges() ExecutionPrivileges { return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}} } -// ShowServersStatement represents a command for listing all servers. -type ShowServersStatement struct{} - -// String returns a string representation of the show servers command. -func (s *ShowServersStatement) String() string { return "SHOW SERVERS" } - -// RequiredPrivileges returns the privilege required to execute a ShowServersStatement -func (s *ShowServersStatement) RequiredPrivileges() ExecutionPrivileges { - return ExecutionPrivileges{{Admin: true, Name: "", Privilege: AllPrivileges}} -} - // ShowDatabasesStatement represents a command for listing all databases in the cluster. type ShowDatabasesStatement struct{} diff --git a/influxql/parser.go b/influxql/parser.go index 72d20458b31..6dbc9f1dc54 100644 --- a/influxql/parser.go +++ b/influxql/parser.go @@ -126,8 +126,6 @@ func (p *Parser) parseShowStatement() (Statement, error) { return p.parseGrantsForUserStatement() case DATABASES: return p.parseShowDatabasesStatement() - case SERVERS: - return p.parseShowServersStatement() case FIELD: tok, pos, lit := p.scanIgnoreWhitespace() if tok == KEYS { @@ -181,7 +179,6 @@ func (p *Parser) parseShowStatement() (Statement, error) { "QUERIES", "RETENTION", "SERIES", - "SERVERS", "TAG", "USERS", "STATS", @@ -225,8 +222,6 @@ func (p *Parser) parseDropStatement() (Statement, error) { switch tok { case CONTINUOUS: return p.parseDropContinuousQueryStatement() - case DATA, META: - return p.parseDropServerStatement(tok) case DATABASE: return p.parseDropDatabaseStatement() case MEASUREMENT: @@ -245,7 +240,7 @@ func (p *Parser) parseDropStatement() (Statement, error) { case USER: return p.parseDropUserStatement() default: - return nil, newParseError(tokstr(tok, lit), []string{"CONTINUOUS", "DATA", "MEASUREMENT", "META", "RETENTION", "SERIES", "SHARD", "SUBSCRIPTION", "USER"}, pos) + return nil, newParseError(tokstr(tok, lit), []string{"CONTINUOUS", "MEASUREMENT", "RETENTION", "SERIES", "SHARD", "SUBSCRIPTION", "USER"}, pos) } } @@ -1380,29 +1375,6 @@ func (p *Parser) parseDropShardStatement() (*DropShardStatement, error) { return stmt, nil } -// parseDropServerStatement parses a string and returns a DropServerStatement. -// This function assumes the "DROP " tokens have already been consumed. -func (p *Parser) parseDropServerStatement(tok Token) (*DropServerStatement, error) { - // Parse the SERVER token - if tok, pos, lit := p.scanIgnoreWhitespace(); tok != SERVER { - return nil, newParseError(tokstr(tok, lit), []string{"SERVER"}, pos) - } - - s := &DropServerStatement{} - var err error - - if tok == META { - s.Meta = true - } - - // Parse the server's ID. - if s.NodeID, err = p.parseUInt64(); err != nil { - return nil, err - } - - return s, nil -} - // parseShowContinuousQueriesStatement parses a string and returns a ShowContinuousQueriesStatement. // This function assumes the "SHOW CONTINUOUS" tokens have already been consumed. func (p *Parser) parseShowContinuousQueriesStatement() (*ShowContinuousQueriesStatement, error) { @@ -1416,13 +1388,6 @@ func (p *Parser) parseShowContinuousQueriesStatement() (*ShowContinuousQueriesSt return stmt, nil } -// parseShowServersStatement parses a string and returns a ShowServersStatement. -// This function assumes the "SHOW SERVERS" tokens have already been consumed. -func (p *Parser) parseShowServersStatement() (*ShowServersStatement, error) { - stmt := &ShowServersStatement{} - return stmt, nil -} - // parseGrantsForUserStatement parses a string and returns a ShowGrantsForUserStatement. // This function assumes the "SHOW GRANTS" tokens have already been consumed. func (p *Parser) parseGrantsForUserStatement() (*ShowGrantsForUserStatement, error) { diff --git a/influxql/parser_test.go b/influxql/parser_test.go index 2f540701f5e..5210c0a4046 100644 --- a/influxql/parser_test.go +++ b/influxql/parser_test.go @@ -788,12 +788,6 @@ func TestParser_ParseStatement(t *testing.T) { // }, //}, - // SHOW SERVERS - { - s: `SHOW SERVERS`, - stmt: &influxql.ShowServersStatement{}, - }, - // SHOW GRANTS { s: `SHOW GRANTS FOR jdoe`, @@ -1176,16 +1170,6 @@ func TestParser_ParseStatement(t *testing.T) { }, }, - // DROP SERVER statement - { - s: `DROP META SERVER 123`, - stmt: &influxql.DropServerStatement{NodeID: 123, Meta: true}, - }, - { - s: `DROP DATA SERVER 123`, - stmt: &influxql.DropServerStatement{NodeID: 123, Meta: false}, - }, - // SHOW CONTINUOUS QUERIES statement { s: `SHOW CONTINUOUS QUERIES`, @@ -1980,8 +1964,6 @@ func TestParser_ParseStatement(t *testing.T) { {s: `DROP SERIES`, err: `found EOF, expected FROM, WHERE at line 1, char 13`}, {s: `DROP SERIES FROM`, err: `found EOF, expected identifier at line 1, char 18`}, {s: `DROP SERIES FROM src WHERE`, err: `found EOF, expected identifier, string, number, bool at line 1, char 28`}, - {s: `DROP META SERVER`, err: `found EOF, expected integer at line 1, char 18`}, - {s: `DROP DATA SERVER abc`, err: `found abc, expected integer at line 1, char 18`}, {s: `SHOW CONTINUOUS`, err: `found EOF, expected QUERIES at line 1, char 17`}, {s: `SHOW RETENTION`, err: `found EOF, expected POLICIES at line 1, char 16`}, {s: `SHOW RETENTION ON`, err: `found ON, expected POLICIES at line 1, char 16`}, @@ -1989,7 +1971,7 @@ func TestParser_ParseStatement(t *testing.T) { {s: `SHOW RETENTION POLICIES mydb`, err: `found mydb, expected ON at line 1, char 25`}, {s: `SHOW RETENTION POLICIES ON`, err: `found EOF, expected identifier at line 1, char 28`}, {s: `SHOW SHARD`, err: `found EOF, expected GROUPS at line 1, char 12`}, - {s: `SHOW FOO`, err: `found FOO, expected CONTINUOUS, DATABASES, DIAGNOSTICS, FIELD, GRANTS, MEASUREMENTS, QUERIES, RETENTION, SERIES, SERVERS, SHARD, SHARDS, STATS, SUBSCRIPTIONS, TAG, USERS at line 1, char 6`}, + {s: `SHOW FOO`, err: `found FOO, expected CONTINUOUS, DATABASES, DIAGNOSTICS, FIELD, GRANTS, MEASUREMENTS, QUERIES, RETENTION, SERIES, SHARD, SHARDS, STATS, SUBSCRIPTIONS, TAG, USERS at line 1, char 6`}, {s: `SHOW STATS FOR`, err: `found EOF, expected string at line 1, char 16`}, {s: `SHOW DIAGNOSTICS FOR`, err: `found EOF, expected string at line 1, char 22`}, {s: `SHOW GRANTS`, err: `found EOF, expected FOR at line 1, char 13`}, @@ -2002,7 +1984,7 @@ func TestParser_ParseStatement(t *testing.T) { {s: `CREATE CONTINUOUS QUERY`, err: `found EOF, expected identifier at line 1, char 25`}, {s: `CREATE CONTINUOUS QUERY cq ON db RESAMPLE FOR 5s BEGIN SELECT mean(value) INTO cpu_mean FROM cpu GROUP BY time(10s) END`, err: `FOR duration must be >= GROUP BY time duration: must be a minimum of 10s, got 5s`}, {s: `CREATE CONTINUOUS QUERY cq ON db RESAMPLE EVERY 10s FOR 5s BEGIN SELECT mean(value) INTO cpu_mean FROM cpu GROUP BY time(5s) END`, err: `FOR duration must be >= GROUP BY time duration: must be a minimum of 10s, got 5s`}, - {s: `DROP FOO`, err: `found FOO, expected CONTINUOUS, DATA, MEASUREMENT, META, RETENTION, SERIES, SHARD, SUBSCRIPTION, USER at line 1, char 6`}, + {s: `DROP FOO`, err: `found FOO, expected CONTINUOUS, MEASUREMENT, RETENTION, SERIES, SHARD, SUBSCRIPTION, USER at line 1, char 6`}, {s: `CREATE FOO`, err: `found FOO, expected CONTINUOUS, DATABASE, USER, RETENTION, SUBSCRIPTION at line 1, char 8`}, {s: `CREATE DATABASE`, err: `found EOF, expected identifier at line 1, char 17`}, {s: `CREATE DATABASE "testdb" WITH`, err: `found EOF, expected DURATION, NAME, REPLICATION, SHARD at line 1, char 31`}, diff --git a/influxql/scanner_test.go b/influxql/scanner_test.go index efa2373c376..cda8fc419c6 100644 --- a/influxql/scanner_test.go +++ b/influxql/scanner_test.go @@ -161,8 +161,6 @@ func TestScanner_Scan(t *testing.T) { {s: `REVOKE`, tok: influxql.REVOKE}, {s: `SELECT`, tok: influxql.SELECT}, {s: `SERIES`, tok: influxql.SERIES}, - {s: `SERVER`, tok: influxql.SERVER}, - {s: `SERVERS`, tok: influxql.SERVERS}, {s: `TAG`, tok: influxql.TAG}, {s: `TO`, tok: influxql.TO}, {s: `USER`, tok: influxql.USER}, diff --git a/influxql/token.go b/influxql/token.go index 762874046ec..e31c4dabdc1 100644 --- a/influxql/token.go +++ b/influxql/token.go @@ -67,7 +67,6 @@ const ( BY CREATE CONTINUOUS - DATA DATABASE DATABASES DEFAULT @@ -100,7 +99,6 @@ const ( KEYS KILL LIMIT - META MEASUREMENT MEASUREMENTS NAME @@ -121,8 +119,6 @@ const ( REVOKE SELECT SERIES - SERVER - SERVERS SET SHOW SHARD @@ -191,7 +187,6 @@ var tokens = [...]string{ BY: "BY", CREATE: "CREATE", CONTINUOUS: "CONTINUOUS", - DATA: "DATA", DATABASE: "DATABASE", DATABASES: "DATABASES", DEFAULT: "DEFAULT", @@ -226,7 +221,6 @@ var tokens = [...]string{ LIMIT: "LIMIT", MEASUREMENT: "MEASUREMENT", MEASUREMENTS: "MEASUREMENTS", - META: "META", NAME: "NAME", NOT: "NOT", OFFSET: "OFFSET", @@ -245,8 +239,6 @@ var tokens = [...]string{ REVOKE: "REVOKE", SELECT: "SELECT", SERIES: "SERIES", - SERVER: "SERVER", - SERVERS: "SERVERS", SET: "SET", SHOW: "SHOW", SHARD: "SHARD",