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

Support mutable meta queries in a cluster #5753

Merged
merged 7 commits into from
Feb 24, 2016
Merged

Conversation

e-dard
Copy link
Contributor

@e-dard e-dard commented Feb 19, 2016

Fixes #5612, #5573 and #5518. Partially #2755

Adds support in a multi-node cluster for the following commands:

  • DROP DATABASE;
  • DROP MEASUREMENT;
  • DROP RETENTION POLICY;
  • DROP SERIES.

The approach is as follows. Queries that involve modifying data on Data Nodes will be handed off by the QueryExecuter to the MetaExecutor. The MetaExecutor will then build appropriate messages and make RPC calls to all data nodes in the cluster.

The node that received the query will apply any commands to its own tsdb.Store locally—they will not be sent over the network.

Errors encountered from remotely executed commands will be collected by the MetaExecutor and the first of these (if any) returned to the user.

Assuming no errors were returned by any data nodes, the node executing the original query will then make any calls necessary to the Meta Store.

Detailed Flow for DROP DATABASE:

  • HTTP API receives query
  • HTTP API passes query to cluster.QueryExecutor
  • cluster.QueryExecutor confirms database exists
  • cluster.QueryExecutor deletes database on local tsdb.Store
  • cluster.QueryExecutor tells cluster.MetaExecutor to execute the statement
  • cluster.MetaExecutor creates an executeStatementRequestMessage RPC command which is sent to cluster.Service on all other data nodes.
  • cluster.Service dispatches command to cluster.Service.processExecuteStatementRequest
  • cluster.Service.processExecuteStatementRequest unmarshals the request, parses the statement, and passes it to cluster.Service.executeStatement
  • cluster.Service.executeStatement switches on the statement type and calls appropriate tsdb.Store.DeleteDatabase.

Errors propagate back from each node through RPC to the node that executed the statement on the cluster and that node returns failure if any node fails to execute.

  • cluster.QueryExecutor tells meta.Client to delete the database

TODO

  • Provide more useful errors?
  • Fix some broken tests.
  • Remove logging / println / commented out litter.
  • Update CHANGELOG.
  • Squash stuff down.

@e-dard e-dard changed the title [WIP] Support mutable meta queries in a cluster Support mutable meta queries in a cluster Feb 22, 2016
panic("wrong connection type in MetaExecutor")
}
// Return connection to pool by "closing" it.
defer func(conn net.Conn) { conn.Close() }(conn)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this wrapped in a function? Wouldn't this work the same:

defer conn.Close()

Copy link
Contributor

Choose a reason for hiding this comment

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

Somebody must have been smoking crack. whistles innocently

@benbjohnson
Copy link
Contributor

Minor comments, otherwise lgtm 👍

return &MetaExecutor{
timeout: DefaultWriteTimeout,
pool: newClientPool(),
maxConnections: 1000,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this max connections per node? If so, default is too high. We use 3 per-node for writes. Also, should be a constant like: https://github.com/influxdata/influxdb/blob/master/cluster/config.go#L21

dgnorton and others added 7 commits February 24, 2016 11:24
The Meta Executor will make allow data nodes to execute queries
remotely on each other, via RPC calls.
Fixes #5612, #5573 and #5518.

Using the MetaExecuter, queries that need to run on both data nodes
and optionally the meta store will be executed across all data nodes
in the cluster.
benbjohnson added a commit that referenced this pull request Feb 24, 2016
Support mutable meta queries in a cluster
@benbjohnson benbjohnson merged commit 23ef15b into master Feb 24, 2016
@benbjohnson benbjohnson deleted the er-meta-queries branch February 24, 2016 17:18
@e-dard
Copy link
Contributor Author

e-dard commented Feb 24, 2016

🏆

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.

4 participants