refactor: rename `query` mode to `database`

pull/24376/head
Marco Neumann 2021-10-27 09:31:41 +02:00
parent 41bc373fe8
commit 6e29cec502
13 changed files with 46 additions and 44 deletions

View File

@ -120,7 +120,7 @@ This which will create a binary at `target/debug/influxdb_iox`.
To start the InfluxDB IOx server, run:
```shell
./target/debug/influxdb_iox run query
./target/debug/influxdb_iox run database
```
By default the server will start an HTTP server on port `8080` and a gRPC server on port `8082`.
@ -128,20 +128,20 @@ By default the server will start an HTTP server on port `8080` and a gRPC server
You can also compile and run with one command:
```shell
cargo run -- run query
cargo run -- run database
```
To compile for performance testing, build in release mode:
```shell
cargo build --release
./target/release/influxdb_iox run query
./target/release/influxdb_iox run database
```
You can also run in release mode with one step:
```shell
cargo run --release -- run query
cargo run --release -- run database
```
To run all available tests in debug mode, you may want to set min stack size to avoid the current known stack overflow issue:

View File

@ -7,7 +7,7 @@
# The full list of available configuration values can be found by in
# the command line help (e.g. `env: INFLUXDB_IOX_DB_DIR=`):
#
# ./influxdb_iox run query --help
# ./influxdb_iox run database --help
#
#
# The identifier for the server. Used for writing to object storage and as

View File

@ -14,21 +14,21 @@ Some examples
```bash
# Default verbosity
$ ./influxdb_iox run query
$ ./influxdb_iox run database
# More verbose
$ ./influxdb_iox run query -v
$ ./influxdb_iox run database -v
# Even more verbose
$ ./influxdb_iox run query -vv
$ ./influxdb_iox run database -vv
# Everything!!
$ ./influxdb_iox run query --log-filter trace
$ ./influxdb_iox run database --log-filter trace
# Default info, but debug within http module
$ ./influxdb_iox run query --log-filter info,influxdb_iox::influxdb_ioxd::http=debug
$ ./influxdb_iox run database --log-filter info,influxdb_iox::influxdb_ioxd::http=debug
```
Additionally, the output format can be controlled with `--log-format`
```bash
$ ./influxdb_iox run query --log-filter debug --log-format logfmt
$ ./influxdb_iox run database --log-filter debug --log-format logfmt
```
## Developer Guide
@ -69,7 +69,7 @@ will strip out all trace level callsites from the release binary.
### Format
IOx supports logging in many formats. For a list run `influxdb_iox run query --help` and view the help output
IOx supports logging in many formats. For a list run `influxdb_iox run database --help` and view the help output
for `--log-format`.
<sup>1.</sup> This span propagation uses thread-local storage and therefore does not automatically carry across

View File

@ -3,10 +3,10 @@
An IOx node can be started from the command line:
```shell
influxdb_iox run query
influxdb_iox run database
```
See help (via `influxdb_iox run query --help`) for arguments.
See help (via `influxdb_iox run database --help`) for arguments.
## Server ID

View File

@ -87,14 +87,14 @@ set.
### Configuration differences when running the tests
When running `influxdb_iox run query`, you can pick one object store to use. When running the tests,
When running `influxdb_iox run database`, you can pick one object store to use. When running the tests,
you can run them against all the possible object stores. There's still only one
`INFLUXDB_IOX_BUCKET` variable, though, so that will set the bucket name for all configured object
stores. Use the same bucket name when setting up the different services.
Other than possibly configuring multiple object stores, configuring the tests to use the object
store services is the same as configuring the server to use an object store service. See the output
of `influxdb_iox run query --help` for instructions.
of `influxdb_iox run database --help` for instructions.
## InfluxDB 2 Client

View File

@ -215,7 +215,7 @@ impl TestServer {
Command::new("docker")
.arg("run")
.arg("query")
.arg("database")
.arg("--name")
.arg(&container_name)
.arg("--publish")

View File

@ -18,8 +18,8 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, StructOpt)]
#[structopt(
name = "run",
about = "Runs in query mode",
long_about = "Run the IOx query server.\n\nThe configuration options below can be \
about = "Runs in database mode",
long_about = "Run the IOx database server.\n\nThe configuration options below can be \
set either with the command line flags or with the specified environment \
variable. If there is a file named '.env' in the current working directory, \
it is sourced before loading the configuration.
@ -45,7 +45,7 @@ pub struct Config {
#[structopt(long = "--num-worker-threads", env = "INFLUXDB_IOX_NUM_WORKER_THREADS")]
pub num_worker_threads: Option<usize>,
// TODO(marco): Remove once the query-run-mode (aka the `server` crate) cannot handle routing anymore and we're
// TODO(marco): Remove once the database-run-mode (aka the `server` crate) cannot handle routing anymore and we're
// fully migrated to the new router code.
/// When IOx nodes need to talk to remote peers they consult an internal remote address
/// mapping. This mapping is populated via API calls. If the mapping doesn't produce

View File

@ -3,12 +3,12 @@ use structopt::StructOpt;
use crate::structopt_blocks::run_config::RunConfig;
pub mod query;
pub mod database;
#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("Error in query subcommand: {}", source))]
QueryError { source: query::Error },
#[snafu(display("Error in database subcommand: {}", source))]
DatabaseError { source: database::Error },
}
pub type Result<T, E = Error> = std::result::Result<T, E>;
@ -16,9 +16,9 @@ pub type Result<T, E = Error> = std::result::Result<T, E>;
#[derive(Debug, StructOpt)]
pub struct Config {
// TODO(marco) remove this
/// Config for query mode, for backwards compatibility reasons.
/// Config for database mode, for backwards compatibility reasons.
#[structopt(flatten)]
query_config: query::Config,
database_config: database::Config,
#[structopt(subcommand)]
command: Option<Command>,
@ -27,25 +27,27 @@ pub struct Config {
impl Config {
pub fn run_config(&self) -> &RunConfig {
match &self.command {
None => &self.query_config.run_config,
Some(Command::Query(config)) => &config.run_config,
None => &self.database_config.run_config,
Some(Command::Database(config)) => &config.run_config,
}
}
}
#[derive(Debug, StructOpt)]
enum Command {
Query(query::Config),
Database(database::Config),
}
pub async fn command(config: Config) -> Result<()> {
match config.command {
None => {
println!("WARNING: Not specifying the run-mode is deprecated. Defaulting to 'query'.");
query::command(config.query_config)
println!(
"WARNING: Not specifying the run-mode is deprecated. Defaulting to 'database'."
);
database::command(config.database_config)
.await
.context(QueryError)
.context(DatabaseError)
}
Some(Command::Query(config)) => query::command(config).await.context(QueryError),
Some(Command::Database(config)) => database::command(config).await.context(DatabaseError),
}
}

View File

@ -1,5 +1,5 @@
use crate::{
commands::run::query::Config,
commands::run::database::Config,
structopt_blocks::{
object_store::{check_object_store, warn_about_inmem_store},
run_config::RunConfig,

View File

@ -60,19 +60,19 @@ compile_error!("heappy and jemalloc_replacing_malloc features are mutually exclu
Examples:
# Run the InfluxDB IOx server:
influxdb_iox run query
influxdb_iox run database
# Run the interactive SQL prompt
influxdb_iox sql
# Display all server settings
influxdb_iox run query --help
influxdb_iox run database --help
# Run the InfluxDB IOx server with extra verbose logging
influxdb_iox run query -v
influxdb_iox run database -v
# Run InfluxDB IOx with full debug logging specified with RUST_LOG
RUST_LOG=debug influxdb_iox run query
RUST_LOG=debug influxdb_iox run database
Command are generally structured in the form:
<type of object> <action> <arguments>

View File

@ -387,7 +387,7 @@ impl TestServer {
let child = Command::cargo_bin("influxdb_iox")
.unwrap()
.arg("run")
.arg("query")
.arg("database")
.env("LOG_FILTER", log_filter)
.env("INFLUXDB_IOX_OBJECT_STORE", "file")
.env("INFLUXDB_IOX_DB_DIR", dir.path())

View File

@ -18,7 +18,7 @@ fn test_unreadable_store_early_exit() {
let mut process = Command::cargo_bin("influxdb_iox")
.unwrap()
.arg("run")
.arg("query")
.arg("database")
.env("INFLUXDB_IOX_OBJECT_STORE", "s3")
.env("AWS_ACCESS_KEY_ID", "foo")
.env("AWS_SECRET_ACCESS_KEY", "bar")

View File

@ -27,16 +27,16 @@ If you're profiling IOx, be sure you've compiled and are running a release build
```
cargo build --release
./target/release/influxdb_iox run query --server-id 1
./target/release/influxdb_iox run database --server-id 1
```
or:
```
cargo run --release -- run query --server-id 1
cargo run --release -- run database --server-id 1
```
Server ID is the only required attribute for running IOx; see `influxdb_iox run query --help` for all the
Server ID is the only required attribute for running IOx; see `influxdb_iox run database --help` for all the
other configuration options for the server you may want to set for your experiment. Note that the
default HTTP API address is `127.0.0.1:8080` unless you set something different with `--api-bind`
and the default gRPC address is `127.0.0.1:8082` unless you set something different using
@ -46,8 +46,8 @@ For the Kafka setup, you'll need to start two IOx servers, so you'll need to set
for at least one of them. Here's an example of the two commands to run:
```
cargo run --release -- run query --server-id 1
cargo run --release -- run query --server-id 2 --api-bind 127.0.0.1:8084 --grpc-bind 127.0.0.1:8086
cargo run --release -- run database --server-id 1
cargo run --release -- run database --server-id 2 --api-bind 127.0.0.1:8084 --grpc-bind 127.0.0.1:8086
```
You'll also need to run a Kafka instance. There's a Docker compose script in the influxdb_iox