Commit Graph

9708 Commits (0657ad9600a9a58237b7fad769aa8196715d766b)

Author SHA1 Message Date
Carol (Nichols || Goulding) 0657ad9600
fix: Rename QueryDatabase to QueryNamespace 2022-11-11 16:14:12 -05:00
Carol (Nichols || Goulding) 621560a0dc
fix: Rename QueryDatabaseMeta to QueryNamespaceMeta 2022-11-11 16:14:12 -05:00
Carol (Nichols || Goulding) d965004e52
fix: Rename DmlError::DatabaseNotFound to NamespaceNotFound 2022-11-11 15:46:05 -05:00
Carol (Nichols || Goulding) bdff4e8848
fix: Consistently use 'namespace' instead of 'database' in comments and other internal text 2022-11-11 15:46:04 -05:00
Nga Tran a3f2fe489c
refactor: remove retention_duration field from namespace catalog table (#6124) 2022-11-11 20:30:42 +00:00
Dom 1b322a6a6e
Merge pull request #6121 from influxdata/dom/deferred-namespace-name
perf(ingester): deferred namespace name discovery
2022-11-11 17:45:31 +00:00
Dom 2e7a1391f8
Merge branch 'main' into dom/deferred-namespace-name 2022-11-11 17:39:10 +00:00
Dom Dwyer 0f6470c390
refactor: use correct description for retries
Use the correct description for namespace query retries.
2022-11-11 18:38:30 +01:00
Dom Dwyer 1e5d3f31af
docs: clearer code comments / docs
Remove redundant comments & clarify returns.
2022-11-11 18:38:29 +01:00
Dom 18c86ca44f
refactor: named unused return
Co-authored-by: Carol (Nichols || Goulding) <193874+carols10cents@users.noreply.github.com>
2022-11-11 17:32:42 +00:00
Nga Tran ea2559a640
chore: update SQL syntax after adding the new column to_delete into table partition (#6123) 2022-11-11 16:21:45 +00:00
Nga Tran 9c4266c503
refactor: first step to remove unused retention_duration (#6113)
* refactor: first step to remove unused retention_duration

* refactor: remove retenion_duration from update catalog

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-11 15:21:06 +00:00
Dom Dwyer 2521aedb6a
perf(ingester): address namespaces by ID only
Removes reliance on string name identifiers for namespaces in the
ingester buffer tree, reducing the memory usage of the namespace index
and associated overhead.

The namespace name is required (though unused by IOx) in the IoxMetadata
embedded within a parquet file, and therefore the name is necessary at
persist time. For this reason, a DeferredLoad is used to query the
catalog (by ID) for the name, at some uniformly random duration of time
after initialisation of the NamespaceData, up to a maximum of 1 minute
later. This ensures the query remains off the hot ingest path, and the
jitter prevents spikes in catalog load during replay/ingester startup.

As an additional / easy optimisation, the persist code causes a
pre-fetch of the name in the background while compacting, hiding the
query latency should it not have already been resolved.

In order to keep the the ingester buffer & catalog decoupled / easily
testable, this commit uses a provider/factory trait
NamespaceNameProvider and corresponding implementation
(NamespaceNameResolver) in a similar fashion to the PartitionResolver,
allowing easy mocking for tests, and composition for prod code, allowing
future optimisations such as pre-fetching / caching the "hot" namespace
names at startup.

Internal string identifier removal is a pre-requisite for removing
string identifiers from the write wire format (#4880).
2022-11-11 14:37:21 +01:00
Dom Dwyer 611acc1ad2
refactor: plumb in DeferredLoad<NamespaceName>
Changes the ingester's buffer tree to use the deferred loading primitive
to resolve the namespace name for NamespaceData.

Note that the loader is initialised with the name in the first place -
this commit just introduces the use of the deferred loading primitive,
and doesn't change where the name is sourced from.
2022-11-11 14:37:20 +01:00
Dom Dwyer 3adc66a4b2
feat: Display impl for DeferredLoad
This lets deferred loads be used in place of a non-differed T, such as
log context fields.

If the value has not been resolved, the display impl returns
"<unresolved>".
2022-11-11 14:37:19 +01:00
Dom Dwyer 76ed1afb01
perf(ingester): support prefetch deferred loads
Allow a caller to signal to the DeferredLoad that the value it may or
may not have to materialise will be used imminently, optimistically
hiding the latency of resolving the value (typically a catalog query).
2022-11-11 14:37:18 +01:00
Dom e60b3191c8
Merge pull request #6120 from influxdata/dom/remove-redundant
refactor: remove redundant shard data init
2022-11-11 13:01:36 +00:00
Dom Dwyer d1cfa9d08b
refactor: remove redundant shard data init
Removes confusingly unused shard data initialisation.
2022-11-11 13:27:15 +01:00
Marco Neumann 7b83d6ec64
fix: traverse some more DataFusion error to extract tonic error (#6118)
See https://github.com/apache/arrow-datafusion/issues/4172 .
2022-11-11 12:24:47 +00:00
Marco Neumann 5398a1b986
chore: update blake2 because version 0.10.4 was yanked (#6119) 2022-11-11 11:36:11 +00:00
dependabot[bot] 358bdf6316
chore(deps): Bump ahash from 0.8.1 to 0.8.2 (#6115)
Bumps [ahash](https://github.com/tkaitchuck/ahash) from 0.8.1 to 0.8.2.
- [Release notes](https://github.com/tkaitchuck/ahash/releases)
- [Commits](https://github.com/tkaitchuck/ahash/compare/v0.8.1...v0.8.2)

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

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-11 10:47:00 +00:00
Dom 02be6ba7e4
refactor: generic deferred loader helper (#6095)
* refactor: generic deferred loader helper

Splits the DeferredSortKey loader introduced in #5807 into two parts - a
generic helper type that implements deferred/background loading of
values, and SortKey specific logic for use with it.

As this will be more widley used, this implementation features improved
behaviour of the deferred loader under concurrent demand requests
(multiple calls to get() do not attempt to concurrently resolve the
value), as well as complete cancellation safety (cancelling the get()
doesn't affect the liveness of the background task).

* docs: doc-link & minor comment amendments

Fixes naming, adds missing doc-links, and expands some code comments.

* test: bound wait times to avoid hangs

Adds timeouts to all .await of the code under test, ensuring tests don't
hang if something goes wrong.
2022-11-10 19:16:51 +00:00
Nga Tran 93e11d4c91
chore: Revert "feat: flag partitions for delete (#6075)" (#6111)
This reverts commit 77a2541172.
2022-11-10 17:01:39 +00:00
Nga Tran e9c8f40af2
chore: Revert "feat: call soft delete partitions from garbage collector (#6090)" (#6110)
This reverts commit 9fe7a50129.
2022-11-10 16:15:13 +00:00
Nga Tran e81ff1f4d5
chore: Revert "feat: catalog delete old partitions (#6099)" (#6109)
This reverts commit 664b0578e9.
2022-11-10 15:31:16 +00:00
Andrew Lamb 694443bb87
chore: Rename DatabaseName to NamespaceName (#6100)
* chore: Rename DatabaseName to NamespaceName

* fix: fmt

* chore: Updates some more references

* chore: more cleanup

* fix: adjust test

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-10 14:13:59 +00:00
Andrew Lamb 6c17ee29a5
feat: make logging clearer when parquet files upload is retried (#6056)
* feat: log success when parquet files are retried

* fix: Update parquet_file/src/storage.rs

Co-authored-by: Carol (Nichols || Goulding) <193874+carols10cents@users.noreply.github.com>

* fix: fmt

Co-authored-by: Carol (Nichols || Goulding) <193874+carols10cents@users.noreply.github.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-10 11:59:54 +00:00
Luke Bond 664b0578e9
feat: catalog delete old partitions (#6099)
* feat: catalog delete old partitions

* chore: remove debug println

* chore: remove debug println

* chore: clippy

* chore: sql statement refactor for deleting partitions

* chore: improve delete partition test

* chore: clippy
2022-11-10 10:51:22 +00:00
Marco Neumann 5f7a6e696f
refactor: chunk InfluxRPC `ReadResponses` (#6094)
Currently we see some prod panics:

```
'assertion failed: len <= std::u32::MAX as usize', tonic/src/codec/encode.rs:127:5
```

This is due to an upstream bug in tonic:
https://github.com/hyperium/tonic/issues/1141

However the fix will only turn this into an error instead of panicking.
We should instead NOT return such overlarge results, esp. because
InfluxRPC supports streaming.

While we currently don't perform streaming conversion (like streaming
the data out of the query stack into the gRPC layer), the 4GB size limit
can easily be triggered (in prod) w/ enough RAM. So let's re-chunk our
in-memory responses so that they stream nicely to the client.

We may later implement proper streaming conversion, see #4445 and #503.
2022-11-10 08:13:22 +00:00
Andrew Lamb 07c25335cf
chore: delete dead code `PartitionAddr` (#6101) 2022-11-09 21:31:14 +00:00
kodiakhq[bot] fc41013e6b
Merge pull request #6074 from influxdata/cn/upgrade-rust
chore: Upgrade to Rust 1.65
2022-11-09 16:01:04 +00:00
Carol (Nichols || Goulding) dd013c5402
fix: Update the expected size in a test
I tracked down the source of the size difference to the difference in
`mem::size_of::<mutable_batch::column::ColumnData>`. I believe this enum
is now able to take advantage of this niche-filling optimization:

<https://github.com/rust-lang/rust/pull/94075/>
2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) abcbe19966
fix: Box some Error type fields to make the Error types small
As found by this new Clippy lint:

<https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err>
2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) f33e367904
fix: Use is_none instead of == None, thanks Clippy!
Again seems kinda niche and not a huge deal, but apparently this doesn't
rely on `T: PartialEq` so probably good?

<https://rust-lang.github.io/rust-clippy/master/index.html#partialeq_to_none>
2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) 4ab506dbd4
fix: Collapse consecutive replace calls that can be one
Well this is rather niche but it seems good!

<https://rust-lang.github.io/rust-clippy/master/index.html#collapsible_str_replace>
2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) 43687a86d2
fix: Remove lots of needless borrows that Clippy can now identify
Except for in generated code that we don't control.
2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) fa46951524
fix: Remove needless deref done by auto deref, thanks Clippy! 2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) 5d9d1d9ee5
fix: Allow using an if to turn a boolean into 1 or 0
I'm not sure I agree with this clippy lint; I think the `if` is much
clearer

<https://rust-lang.github.io/rust-clippy/master/index.html#bool_to_int_with_if>
2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) 07505c8f72
fix: Remove needless borrows, thanks Clippy! 2022-11-09 10:54:18 -05:00
Carol (Nichols || Goulding) a3bee0c303
chore: Upgrade to Rust 1.65 2022-11-09 10:29:13 -05:00
Nga Tran 9fe7a50129
feat: call soft delete partitions from garbage collector (#6090) 2022-11-09 14:48:26 +00:00
Nga Tran 77a2541172
feat: flag partitions for delete (#6075)
* feat: flag partition for delete

* fix: compare the right date and time

* chore: Run cargo hakari tasks

* chore: cleanup

* fix: typos

* chore: rust style tidy ups in catalog

Co-authored-by: CircleCI[bot] <circleci@influxdata.com>
Co-authored-by: Luke Bond <luke.n.bond@gmail.com>
2022-11-09 12:06:23 +00:00
Dom d9c97795fc
feat: use IDs in ingester query API (#6093)
* refactor: NS+table ID (instead of name) in querier<>ingester

* feat(ingester): use IDs for query API

Changes the ingester to utilise the ID fields (instead of names) sent
over the query wire message wrapped within the Flight API.

BREAKING: this changes the "query-ingester" CLI command arguments which
now expects the namespace & table IDs, rather than their names.

* refactor(ingester): add more query logging context

Updates the log messages during query execution to include more context
fields.

* style: remove unused import

Co-authored-by: Marco Neumann <marco@crepererum.net>
2022-11-09 11:25:13 +00:00
Jake Goulding c0fcd5e32a
test: Ensure router's HTTP error messages are stable (#6006)
* test: Ensure router's HTTP error messages are stable

If you change the text of an error, the tests will fail.

If you add a new error variant to the `Error` enum but don't add it to
the test, test compilation will fail with a "non-exhaustive patterns"
message.

If you remove an error variant, test compilation will fail with a "no
variant named `RemovedError`" message.

You can get the list of error variants and their current text via
`cargo test -p router -- print_out_error_text --nocapture`.

A step towards accomplishing #5863

Co-authored-by: Carol (Nichols || Goulding) <carol.nichols@gmail.com>
Co-authored-by: Jake Goulding <jake.goulding@integer32.com>

* fix: Remove optional commas and document macro arguments

* docs: Clarify the purpose of the tests the check_errors macro generates

* fix: Add tests for inner mutable batch LP error variants

Co-authored-by: Carol (Nichols || Goulding) <carol.nichols@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
2022-11-09 09:37:55 +00:00
dependabot[bot] 679a7958b2
chore(deps): Bump hyper from 0.14.22 to 0.14.23 (#6080)
Bumps [hyper](https://github.com/hyperium/hyper) from 0.14.22 to 0.14.23.
- [Release notes](https://github.com/hyperium/hyper/releases)
- [Changelog](https://github.com/hyperium/hyper/blob/v0.14.23/CHANGELOG.md)
- [Commits](https://github.com/hyperium/hyper/compare/v0.14.22...v0.14.23)

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

Signed-off-by: dependabot[bot] <support@github.com>

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>
2022-11-09 09:15:12 +00:00
dependabot[bot] 8edd640e05
chore(deps): Bump cc from 1.0.74 to 1.0.76 (#6092)
Bumps [cc](https://github.com/rust-lang/cc-rs) from 1.0.74 to 1.0.76.
- [Release notes](https://github.com/rust-lang/cc-rs/releases)
- [Commits](https://github.com/rust-lang/cc-rs/compare/1.0.74...1.0.76)

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

Signed-off-by: dependabot[bot] <support@github.com>

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>
2022-11-09 09:07:42 +00:00
Marco Neumann 1a5fc3d772
test: use `EXPLAIN ANALYZE` for SQL metric tests (#6084)
* test: use `EXPLAIN ANALYZE` for SQL metric tests

Needs a bit more infra (due to normalization), but this seems to be
worth it so we can easily hook up more metrics in the future.

* docs: explain regexes
2022-11-09 09:00:27 +00:00
Stuart Carnie 106d3a76de
feat: Parse InfluxQL line and inline comments (#6076)
* feat: Added single and inline comment combinators

* chore: Add tests for ws0 function

* feat: Add ws1 combinator

* feat: Use ws0 and ws1 combinators to properly handle comments
2022-11-08 22:53:19 +00:00
Luke Bond dfb820615c
feat: deletion flagging in GC based on retention policy (#6073)
* feat: deletion flagging in GC based on retention policy

* chore: typo in comment

* fix: only soft delete parquet files that aren't yet soft deleted

* fix: guard against flakiness in catalog test

* chore: some better tests for parquet file delete flagging

Co-authored-by: Nga Tran <nga-tran@live.com>
2022-11-08 20:22:35 +00:00
Dom aebf2024a4
Merge pull request #6069 from influxdata/dom/kafka-ids-consumer
perf(ingester): eliminate table / namespace queries
2022-11-08 16:20:25 +00:00