Commit Graph

11696 Commits (c7197a289e769ed8da10ef392346a4f584b5e6de)

Author SHA1 Message Date
Marco Neumann c7197a289e
fix: gRPC error code for invalid InfluQL (#7519)
This was "internal". The mapping works like this: we take the
`DataFusionError` and call `find_root` which should traverse the
`External(...)` chain (even through Arrow) to find the last error that
is not within the Arrow/DataFusion land. This is then mapped by us.

`DataFusionError::External(...)` is no further inspected and mapped
straight to "internal". I think this if fine because in the end we're
mostly dealing w/ DataFusion stuff anyways.

I've slightly changed the error mapping in the planner to emit
`DataFusionError::Plan(...)` instead which we map to "invalid argument".
I think this is way better for the user.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-12 16:00:38 +00:00
Andrew Lamb f3de4e39f0
docs: Improve documentation on query API (#7520)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-12 15:53:42 +00:00
Joe-Blount 7dd221aee0
chore: add logging around compaction job semaphore (#7523)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-12 15:47:02 +00:00
kodiakhq[bot] 0cdeef531f
Merge pull request #7517 from influxdata/dom/remove-explicit-replica
chore: remove ingest_replica
2023-04-12 15:39:26 +00:00
Dom 13572e36fa
Merge branch 'main' into dom/remove-explicit-replica 2023-04-12 16:29:18 +01:00
kodiakhq[bot] ffe8714956
Merge pull request #7417 from influxdata/cn/cold-compaction-selection
feat: Add the ability to specify a max threshold duration on CatalogToCompactPartitionsSource
2023-04-12 15:26:21 +00:00
kodiakhq[bot] 14d7098ddd
Merge branch 'main' into cn/cold-compaction-selection 2023-04-12 15:19:06 +00:00
kodiakhq[bot] b9a49907fe
Merge pull request #7521 from influxdata/cn/remove-write-buffer
fix: Remove the write buffer crate
2023-04-12 15:18:11 +00:00
Carol (Nichols || Goulding) 3199d65c2f
feat: Add the ability to specify a max threshold duration on CatalogToCompactPartitionsSource 2023-04-12 11:08:51 -04:00
Carol (Nichols || Goulding) a244e5b078
test: Add some tests for CatalogToCompactPartitionsSource's existing behavior 2023-04-12 11:07:43 -04:00
Carol (Nichols || Goulding) 65c90b0281
fix: Remove the write buffer crate 2023-04-12 11:01:26 -04:00
kodiakhq[bot] 110a2112fe
Merge pull request #7518 from influxdata/cn/remove-old-router
fix: Remove old router
2023-04-12 14:59:00 +00:00
Carol (Nichols || Goulding) d025362ce0
fix: Remove old router 2023-04-12 10:15:48 -04:00
Dom 92bf602f69
Merge branch 'main' into dom/remove-explicit-replica 2023-04-12 15:06:44 +01:00
Dom Dwyer ed06d8e760
chore: remove ingest_replica
The replication implementation uses a different design - the
ingest_replica is no longer needed.
2023-04-12 16:06:31 +02:00
kodiakhq[bot] 1c24440305
Merge pull request #7503 from influxdata/savage/router-read-through-namespace-cache
feat(router): Use a read-through decorator for `NamespaceCache` usage
2023-04-12 13:50:17 +00:00
Fraser Savage a9d1a3a5f9
Merge branch 'main' into savage/router-read-through-namespace-cache 2023-04-12 14:40:56 +01:00
Fraser Savage dc6053bfba
refactor(router): Apply further code review changes, clean up docs 2023-04-12 14:40:02 +01:00
Fraser Savage 8a2b88398f
refactor(router): Apply suggestions from code review
Assert an invariant, document existing edge cases and a little cleanup.

Co-authored-by: Dom <dom@itsallbroken.com>
2023-04-12 14:12:12 +01:00
Dom 28f931db56
Merge pull request #7514 from influxdata/dom/ingester-bench-context
test(bench): ingester2 write benchmarks
2023-04-12 13:42:18 +01:00
Dom Dwyer 5c6d51c808
refactor: constify defaults
Constify default TestContext config params.
2023-04-12 14:28:06 +02:00
Dom Dwyer dd92459c41
test(bench): ingester2 write benchmarks
Adds a single-line & batched write request benchmarks to ingester2.

When using the WAL, a floor of 10ms is added to all writes (the WAL
linger time, configurable). With the WAL disabled in code, benchmarked
writes complete in less than a millisecond:

    single row/write
        time:   [1.9138 µs 1.9168 µs 1.9197 µs]
        thrpt:  [520.92 Kelem/s 521.70 Kelem/s 522.51 Kelem/s]

    batched/write/1000
        time:   [129.15 µs 129.97 µs 131.28 µs]
        thrpt:  [7.6173 Melem/s 7.6941 Melem/s 7.7429 Melem/s]

Note these benchmarks exclude network I/O, and measure single-threaded,
synchronous write client performance.
2023-04-12 12:51:47 +02:00
Dom Dwyer 02c7ec0727
test: add ingester2_test_ctx
Moves the ingester2 TestContext & builder to its own crate for reuse
between integration tests & benchmarks (and more?!)

This allows us to DRY & reuse the test code with it's nice API for
benchmarks too, without forcing it all to be in the "prod" build of
ingester2 (and the dependencies, and their dependencies, etc).

This also means this code can be built and cached instead of being
rebuilt all the time during normal development.
2023-04-12 12:51:47 +02:00
Marco Neumann e7fcb25904
feat: `SHOW FIELD KEYS` InfluxQL plan+exec (#7405)
Closes https://github.com/influxdata/idpe/issues/17362
2023-04-12 09:09:29 +00:00
Stuart Carnie 772b79b86b
feat: Validate the semantics of the projection clause of a SELECT (#7500)
* feat: Validate the semantics of the projection clause of a SELECT

Closes #7499

* chore: Complete sentences are helpful 😂
2023-04-11 22:43:23 +00:00
Joe-Blount f05be907cb
chore: increasing concurrency a little more (#7510)
* chore: increasing concurrency a little more

This raises the threshold for single threading compactions to 100 column partitions.  With the non-linear scaling, 70 column partitions would take 49% of the concurrency limit (allowing only 2 of such sized partitions to compact concurrently).  Anything over 70 can only compact with something smaller than itself.

I'm gradually walking these up, partly to avoid causing OOMs in prod, and partly because I want to get a feel for how reactive the average concurrency is to these changes.

* chore: fix comment typo
2023-04-11 22:04:44 +00:00
Chunchun Ye 911d57c2d4
fix: replace empty schema with GET_PRIMARY_KEYS_SCHEMA (#7508)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 21:40:52 +00:00
Joe-Blount 980589504d
chore: make compactor concurrency scale non-linearly (#7509)
* chore: make compactor concurrency scale non-linearly

* chore: rust formatter making the test cases harder to read
2023-04-11 20:10:20 +00:00
Fraser Savage a6ccb05caf
refactor(router): DML handler tests use helper fn to set-up NS cache 2023-04-11 16:47:48 +01:00
Fraser Savage 728b7293b9
feat(router): Use read-through namespace cache for NamespaceResolver
The NamespaceResolver was using its own very similar look-aside caching
to the DML handlers, this commit leverages the read-through cache
implementation to deduplicate more code and makes the read through
behavioural expectation explicit for namespace autocreation.
2023-04-11 15:38:18 +01:00
Fraser Savage d590d19e3b
feat(router): Use read-through NamespaceCache with DML handlers
This removes the look-aside cache from the retention_validation
and schema_validation DML handlers, instead setting up the new
NamespaceCache decorator and using that to handle cache misses.
2023-04-11 15:38:17 +01:00
Fraser Savage 0bb88dcd4f
refactor(router): Return Result from NamespaceCache, use GAT for Error
This commit refactors the NamespaceCache trait to return a result
instead of an option for calls to `get_schema()`, allowing callers and
decorators to differentiate between cache misses, namespaces not
existing and transient I/O errors. This allows implementations to
interact with backend catalog storage.
2023-04-11 15:38:17 +01:00
Fraser Savage 082e8db9ef
refactor(router): Make NamespaceCache an async_trait
In order to implement a read-through NamespaceCache
decorator the `get_cache()` call will need to interact
with async catalog methods, so this allows implementations
to call await within the `get_cache()` body.
2023-04-11 15:38:16 +01:00
Marco Neumann f97e1765d8
fix: do not loose schema for empty query responses (#7506)
Within our query tests and our CLI, we've used to print out empty
query responses as:

```text
++
++
```

This is pretty misleading. Why are there no columns?! The reason is that
while Flight provides us with schema information, we often have zero
record batches (because why would the querier send an empty batch). Now
lets fix this by creating an empty batch on the client side based on the
schema data we've received. This way, people know that there are columns
but no rows:

```text
+-------+--------+------+------+
| count | system | time | town |
+-------+--------+------+------+
+-------+--------+------+------+
```

An alternative fix would be to pass the schema in addition to
`Vec<RecordBatch>` to the formatting code, but that seemed to be more
effort.

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 14:35:29 +00:00
Chunchun Ye b131895fc2
feat(flightsql): Support `GetPrimaryKeys` metadata endpoint with an empty RecordBatch (#7496)
* feat: add CommandGetPrimaryKeys metadata endpoint and tests

* chore: update schema for the returned record batch

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 14:13:44 +00:00
Marco Neumann b29bdf73ab
feat: improve querier->ingester tracing (#7501)
* feat: improve querier->ingester tracing

- add more hierarchy items on the querier side
- ensure that streaming is correctly traced by the querier

* refactor: improve span name

Co-authored-by: Andrew Lamb <alamb@influxdata.com>

* docs: `QueryDataTracer`

---------

Co-authored-by: Andrew Lamb <alamb@influxdata.com>
2023-04-11 13:43:42 +00:00
Marco Neumann e809ec14d1
chore: `cargo update` (#7505)
Seems like dependabot is running behind a bit. Let me help:

```console
$ cargo update
    Updating crates.io index
    Updating git repository `https://github.com/apache/arrow-datafusion.git`
    Updating git repository `https://github.com/influxdata/rskafka.git`
    Updating git repository `https://github.com/mkmik/heappy`
    Updating async-stream v0.3.4 -> v0.3.5
    Updating async-stream-impl v0.3.4 -> v0.3.5
    Updating axum v0.6.11 -> v0.6.12
    Updating concurrent-queue v2.1.0 -> v2.2.0
    Updating core-foundation-sys v0.8.3 -> v0.8.4
    Updating cxx v1.0.92 -> v1.0.94
    Updating cxx-build v1.0.92 -> v1.0.94
    Updating cxxbridge-flags v1.0.92 -> v1.0.94
    Updating cxxbridge-macro v1.0.92 -> v1.0.94
    Removing errno v0.2.8
    Removing errno v0.3.0
      Adding errno v0.3.1
    Updating fd-lock v3.0.10 -> v3.0.12
    Updating iana-time-zone v0.1.54 -> v0.1.56
    Removing linux-raw-sys v0.1.4
    Removing linux-raw-sys v0.3.0
      Adding linux-raw-sys v0.3.1
    Updating pest v2.5.6 -> v2.5.7
    Updating pest_derive v2.5.6 -> v2.5.7
    Updating pest_generator v2.5.6 -> v2.5.7
    Updating pest_meta v2.5.6 -> v2.5.7
    Updating proc-macro2 v1.0.54 -> v1.0.56
    Removing rustix v0.36.11
    Updating serde v1.0.159 -> v1.0.160
    Updating serde_derive v1.0.159 -> v1.0.160
    Updating syn v2.0.11 -> v2.0.14
    Updating windows v0.46.0 -> v0.48.0
```
2023-04-11 13:01:53 +00:00
Dom 374a85fef0
Merge pull request #7429 from influxdata/dom/req-mode-parsing
feat(router): CST mode
2023-04-11 13:01:34 +01:00
Dom Dwyer 73d44ec9a1
Merge remote-tracking branch 'origin/main' into dom/req-mode-parsing 2023-04-11 13:34:52 +02:00
Martin Hilton d2585002fe
chore(authz): Change "namespace" to "database" (#7502)
Part of the wider effort to consistently use tht term "database"
for the user-facing terminology, update the authorization system.
Whilst this system is technically user-facing, it is unlikely many
users will see it. It is however new enough that the change is
relatively little effort.
2023-04-11 11:04:51 +00:00
Andrew Lamb 8c42fedf33
chore: Remove dead code (#7475)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 10:44:49 +00:00
Andrew Lamb 1a80b8073c
fix: Improve span names for query access (#7476)
* fix: Improve span names for query access

* fix: update test

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 10:34:09 +00:00
Dom 78f2b3a36a
Merge branch 'main' into dom/req-mode-parsing 2023-04-11 11:00:22 +01:00
Martin Hilton 1a42155077
chore: end to end tests for authorization (#7441)
* chore: end-to-end tests for authorization

Add tests to validate the behaviour of the authorization machinery
in the write and query paths.

In order to facilitate this an authorizer implentation has been
added to the the test helpers that runs an authorizer gRPC service
for the use of tests. The gRPC service is started in the process
that is running the test and listens on a OS-assigned port number.
The authorization service cannot be shared between tests so a
non-shared cluster must be used when the authorizer is configured.

The influxdb_iox_client has been enhanced so that the user can
configure additional headers in the flight client, which is used
for SQL and InfluxQL queries. This uses the same interface as the
Flight SQL client has for the same job.

* chore: fix lint errors

* chore: review suggestion

Consolate the authorization tests into fewer tests in order to avoid
repeating set-up and tear-down unnecessarily.
2023-04-11 09:56:45 +00:00
Andrew Lamb 8b25a3a64c
chore: Remove unused dependencies, found by cargo-machete (#7491)
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 08:32:32 +00:00
dependabot[bot] 07668f643b
chore(deps): Bump sqlparser from 0.32.0 to 0.33.0 (#7498)
Bumps [sqlparser](https://github.com/sqlparser-rs/sqlparser-rs) from 0.32.0 to 0.33.0.
- [Release notes](https://github.com/sqlparser-rs/sqlparser-rs/releases)
- [Changelog](https://github.com/sqlparser-rs/sqlparser-rs/blob/main/CHANGELOG.md)
- [Commits](https://github.com/sqlparser-rs/sqlparser-rs/compare/v0.32.0...v0.33.0)

---
updated-dependencies:
- dependency-name: sqlparser
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 08:21:10 +00:00
Marco Neumann 1d3d7d422b
chore: enable frame-pointer (#7471)
Not having frame pointers on x64 is a painful for profiling and debugging.
Sure we can use DWARF, but it is slow, memory-hungry (you easily need
gigabytes just for a simple benchmark), and often broken.

In constrat to 32bit x86, x64 has enough general purpose registers and
the processor likely has even more physical ones that it can access through
register renaming. One register more won't make the difference for
us.

Prior art:

- Go: https://github.com/golang/go/issues/15840
- RustC: https://github.com/rust-lang/rust/pull/107689 (not merged yet)
- Fedora tried: https://lwn.net/Articles/919940/

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-11 08:14:31 +00:00
Joe-Blount ef62f439b8
feat: scale compactor concurrency based on table column count (#7492)
* feat: scale compactor concurrency based on table column count

* chore: address review comments
2023-04-10 21:44:29 +00:00
dependabot[bot] 4fece24077
chore(deps): Bump is-terminal from 0.4.6 to 0.4.7 (#7481)
Bumps [is-terminal](https://github.com/sunfishcode/is-terminal) from 0.4.6 to 0.4.7.
- [Release notes](https://github.com/sunfishcode/is-terminal/releases)
- [Commits](https://github.com/sunfishcode/is-terminal/compare/v0.4.6...v0.4.7)

---
updated-dependencies:
- dependency-name: is-terminal
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2023-04-10 21:01:58 +00:00
wiedld 9a56d08ddc test: add namespace char validation tests, to highlight the current contracts for v1/v2 and MT/CST. Contracts will be iterated with followup issue 7489 2023-04-10 12:59:20 -07:00