Commit Graph

49460 Commits (e421baf0bc38b5c563e88bf6c8fd89d647ef2a52)

Author SHA1 Message Date
Paul Dix 31b9209dd6
fix: Snapshot QueryableBuffer error (#25673)
Fixes bug in queryable buffer where if a block of data was missing one of the columns defined in a table sort key, the creation of the logical plan to sort and dedupe the data would fail, causing a panic.

Fixes #25670
2024-12-17 16:57:07 -05:00
Trevor Hilton 7d92b75731
feat: add influxdb3_clap_blocks crate with runtime config (#25665)
* feat: add influxdb3_clap_blocks with runtime config

Added a new workspace crate `influxdb3_clap_blocks` which will be a
starting point for adding InfluxDB 3 OSS/Pro specific CLI configuration
that no longer references IOx, and allows for us to trim out unneeded
configurations for the monolithic InfluxDB 3.

Other than changing references from IOX to INFLUXDB3, this makes one
important change: it enables IO on the DataFusion runtime. This, for now,
is an experimental change to see if we can relieve some concurrency
issues that we have been experiencing.

* chore: add observability deps for windows
2024-12-16 15:31:55 -05:00
Michael Gattozzi 238642b1c0
fix: move to fetch_update from fetch_add for IDs (#25663)
With this change we now provide a check for new IDs for overflow. This
will cause the system to panic on overflow now rather than causing
silent corruption as this is an unrecoverable state. While this is a
highly unlikely scenario given how big the id numbers can be, it would
be better to have this in place now, rather than trying to figure out
a subtle nasty corruption bug later.

Closes #25542
2024-12-16 11:32:33 -05:00
Michael Gattozzi 90b9071297
fix: Change references of Edge into OSS (#25661)
This changes the code to reference InfluxDB 3 OSS rather than Edge which
had been it's original name when we first started the project. With this
we now have the code reflect what we are actually calling it. On top of
this the long help text has been changed to give advice about how to
actually run the code now with the bare minimum set of flags needed now
as `influxdb serve` is no longer a viable command on it's own.

Closes #25649
2024-12-16 11:24:35 -05:00
praveen-influx 9fa4932598
chore: porting the changes from pro (#25660)
move ringbuffer to be allocated on heap as the MAX_CAPACITY per event
type has gone up to 10k
2024-12-16 15:12:19 +00:00
Trevor Hilton df84f9e68e
feat: support LIMIT in metadata cache (#25658) 2024-12-14 13:33:46 -08:00
Jackson Newhouse 486d79d801
feat(processing_engine): initial implementation of Processing Engine plugins and triggers (#25639) 2024-12-13 14:11:38 -08:00
Michael Gattozzi 535ddd606d
feat: Parallelize loading snapshots from storage (#25657) 2024-12-13 15:47:56 -05:00
praveen-influx e0d8778bb1
feat: default the telemetry url (#25656) 2024-12-13 16:22:19 +00:00
Brandon Pfeifer a043433760
chore: invalidate CloudFront on upload (#25651) 2024-12-12 16:00:23 -05:00
Michael Gattozzi 9292a3213d
feat: Significantly decrease startup times for WAL (#25643)
* feat: add startup time to logging output

This change adds a startup time counter to the output when starting up
a server. The main purpose of this is to verify whether the impact of
changes actually speeds up the loading of the server.

* feat: Significantly decrease startup times for WAL

This commit does a few important things to speedup startup times:
1. We avoid changing an Arc<str> to a String with the series key as the
   From<String> impl will call with_column which will then turn it into
   an Arc<str> again. Instead we can just call `with_column` directly
   and pass in the iterator without also collecting into a Vec<String>
2. We switch to using bitcode as the serialization format for the WAL.
   This significantly reduces startup time as this format is faster to
   use instead of JSON, which was eating up massive amounts of time.
   Part of this change involves not using the tag feature of serde as
   it's currently not supported by bincode
3. We also parallelize reading and deserializing the WAL files before
   we then apply them in order. This reduces time waiting on IO and we
   eagerly evaluate each spawned task in order as much as possible.

This gives us about a 189% speedup over what we were doing before.

Closes #25534
2024-12-12 11:27:51 -05:00
Brandon Pfeifer b2f6c1a0b6
feat: publish snapshot on merge to main (#25644) 2024-12-11 17:38:24 -05:00
Jackson Newhouse 9f541b7c94
refactor(catalog): Rework how CatalogOps update the DatabaseSchema (#25642) 2024-12-11 10:33:25 -08:00
Trevor Hilton 3a66fe0ec3
fix: flaky metadata cache JSON test (#25638) 2024-12-10 09:47:00 -08:00
Trevor Hilton 37219af9d4
feat: track parquet cache metrics (#25632)
* feat: parquet cache metrics

* feat: track parquet cache metrics

Adds metrics to track the following in the in-memory parquet cache:
* cache size in bytes (also included a fix in the calculation of that)
* cache size in n files
* cache hits
* cache misses
* cache misses while the oracle is fetching a file

A test was added to check this functionality

* refactor: clean up logic and fix cache removal tracking error

Some logic and naming was cleaned up and the boolean to optionally track
metrics on entry removal was removed, as it was incorrect in the first place:
a fetching entry still has a size, which counts toward the size of the
cache. So, this makes is such that anytime an entry is removed, whether
its state is success or fetching, its size will be decremented from
the cache size metrics.

The sizing caclulations were made to be correct, and the cache metrics
test was updated with more thurough assertions
2024-12-10 09:32:15 -05:00
Trevor Hilton 0bfef47ff9
refactor: move parquet cache to influxdb3_cache crate (#25630) 2024-12-09 11:56:52 -05:00
Trevor Hilton 161c8b4eda
refactor: remove query concurrency limit (#25629) 2024-12-09 11:06:14 -05:00
Trevor Hilton ef3599d7ce
test: metadata cache query using JSON format (#25626) 2024-12-06 15:36:49 -05:00
Trevor Hilton 154ff7da23
feat: LastCacheExec to track predicate pushdown in last cache queries (#25621) 2024-12-06 10:53:19 -08:00
Trevor Hilton 9b87cd7a65
refactor: move last cache to influxdb3_cache crate (#25620)
Moved all of the last cache implementation into the `influxdb3_cache`
crate. This also splits out the implementation into three modules:
- `cache.rs`: the core cache implementation
- `provider.rs`: the cache provider used by the database to hold multiple
  caches.
- `table_function.rs`: same as before, holds the DataFusion impls

Tests were preserved and moved to `mod.rs`, however, they were updated to
not rely on the WriteBuffer implementation, and instead use the types in
the `influxdb3_cache::last_cache` module directly. This simplified the
test code, while not changing any of the test assertions at all.
2024-12-05 14:04:25 -05:00
praveen-influx 7211e8a96c
feat: move ring buffer to use array instead of vec (#25616)
In this commit the vec backing the buffer is swapped for an array.
Criterion benchmarks were added to compare the perf to make sure it has
not made it worse. The vec implementation has been removed after the
benchmarks done locally
2024-12-04 21:05:07 +00:00
Trevor Hilton dbb1f55b5e
chore: update core for latest sync (#25617) 2024-12-04 14:11:13 -05:00
Trevor Hilton 0daa3f2f1d
feat: track persist time in wal file content (#25614) 2024-12-03 15:37:43 -05:00
Michael Gattozzi d2fbd65a44
feat: Deny extra tags on write APIs (#25596)
This commit does three important major changes:

1. We will deny writes to the v1, v2, and v3 write apis that add new tags in
   subsequent writes after the first write
2. We make every table have a series key by default now
3. We enfore sorting order by the series key which is the order the keys came in

With these changes we have consistentcy across the various write apis and can
make optimizations and future features with the assumption we have a series key.

Closes #25585
2024-12-03 12:10:26 -05:00
praveen-influx f23aa0d460
feat: add method to create RecordBatch in SysEventStore (#25610)
- This commit allows `RecordBatch` to be created directly from event
  store. It means we can avoid cloning events and avoids creating
  intermediate vec. To achieve that, there's a new method
  `as_record_batch` that's been added with a trait bound `ToRecordBatch`
  that events are expected to implement.
- Minor tidy ups (renaming methods) and added test

closes: https://github.com/influxdata/influxdb/issues/25609
2024-12-03 15:16:28 +00:00
praveen-influx 43755c2d9c
feat: sys events store added (#25603)
This commit introduces basic store for sys events and the backing ring
buffer. Since the buffer needs to hold arbitrary data, it uses `Box<dyn
Any>`

closes: https://github.com/influxdata/influxdb/issues/25581
2024-12-02 10:55:37 +00:00
Trevor Hilton 81d1ff1d62
chore: upgrade to rust 1.83.0 (#25605) 2024-11-29 18:21:48 -05:00
Trevor Hilton a01fd16d4d
fix: plan queries on DF threadpool to not block IO in REST API (#25604) 2024-11-29 16:03:17 -05:00
Trevor Hilton b7fd8e2386
feat: remove metadata caches on db and table delete (#25599) 2024-11-28 11:35:29 -05:00
Trevor Hilton 81715fbfea
refactor: display column names for predicates in EXPLAIN for metadata cache (#25598) 2024-11-28 11:18:12 -05:00
Trevor Hilton 13ab41fa1f
feat: CLI to create and delete metadata caches (#25595)
This adds two new CLI commands to the `influxdb3` binary:
* `influxdb3 meta-cache create`
* `influxdb3 meta-cache delete`

To create and delete metadata caches, respectively.

A basic integration test was added to check that this works E2E.

The `influxdb3_client` was updated with methods to create and delete
metadata caches, and which is what the CLI commands use under the hood.
2024-11-28 09:04:20 -05:00
Trevor Hilton 9ead1dfe4b
feat: meta_caches system table (#25593)
This adds a new system table "meta_caches" that allows users to view the
state of their metadata caches on a per-db basis

An integration test was added to verify that it works.
2024-11-28 08:57:02 -05:00
Trevor Hilton 234d37329a
feat: metacache REST APIs to create and delete (#25587) 2024-11-27 08:41:46 -05:00
praveen-influx bfa0e71558
feat: make query executor as trait object (#25591)
* feat: make query executor as trait object

This commit moves `QueryExecutorImpl` behind a `dyn` (trait object) as
we have other impls in core for `QueryExecutor` and this will keep both
pro and OSS traits in sync

* chore: fix cargo audit failures

- address https://rustsec.org/advisories/RUSTSEC-2024-0399.html by
running `cargo update --precise 0.23.18 --package rustls@0.23.14`

- address yanked version of `url` crate (2.5.3) by running
`cargo update -p url`
2024-11-26 17:18:22 +00:00
Trevor Hilton 8e23032ceb
feat: add metadata cache provider with APIs for write and query (#25566)
This adds the MetaDataCacheProvider for managing metadata caches in the
influxdb3 instance. This includes APIs to create caches through the WAL
as well as from a catalog on initialization, to write data into the
managed caches, and to query data out of them.

The query side is fairly involved, relying on Datafusion's TableFunctionImpl
and TableProvider traits to make querying the cache using a user-defined
table function (UDTF) possible.

The predicate code was modified to only support two kinds of predicates:
IN and NOT IN, which simplifies the code, and maps nicely with the DataFusion
LiteralGuarantee which we leverage to derive the predicates from the
incoming queries.

A custom ExecutionPlan implementation was added specifically for the
metadata cache that can report the predicates that are pushed down to
the cache during query planning/execution.

A big set of tests was added to to check that queries are working, and
that predicates are being pushed down properly.
2024-11-22 10:57:26 -05:00
praveen-influx 3cde24feb4
feat: delete table (#25572)
This commit allows deleting (soft) a table. For an user, following
command will allow soft deleting a table (bar) in db (foo)

```
influxdb3 table delete --dbname foo --table bar --host $host
```

- Added `soft_delete_table` to `DatabaseManager` trait, which already
  hosts `soft_delete_database` method. The code roughly follows the same
  flow as db delete. Although like db schema, it does clone on write
  because the reference is behind an Arc, `Arc::make_mut` is used in
  this change.
- Moved db delete related cli parser under "manage" module that has both
  db and table delete functionality
- Some minor tidyups (removing unused methods, renaming method so that
  the order in name matches actual return type eg. `table_id_and_schema`,
  should return (id, schema) and not (schema, id))

closes: https://github.com/influxdata/influxdb/issues/25561
2024-11-22 08:42:45 +00:00
Jackson Newhouse 956e223388
fix: don't rebuild snapshot if it has already been taken. (#25570) 2024-11-20 08:55:42 -08:00
Michael Gattozzi 230bf02f93
feat: delete old Catalogs on persist (#25568)
This commit changes the code so that we only keep the 10 most recent
Catalogs. When a new one is persisted we delete any old ones that
exist. If the deletion would fail we don't panic and let a future
persist cleanup the catalogs rather than failing the persist itself.
This commit also adds a test to make sure that only the catalogs we
expect to are deleted on persist.
2024-11-19 12:42:20 -05:00
praveen-influx 33c2d47ba9
feat: drop/delete database (#25549)
* feat: drop/delete database

This commit allows soft deletion of database using `influxdb3 database
delete <db_name>` command. The write buffer and last value cache are
cleared as well.

closes: https://github.com/influxdata/influxdb/issues/25523

* feat: reuse same code path when deleting database

- In previous commit, the deletion of database immediately triggered
  clearing last cache and query buffer. But on restarts same logic had
  to be repeated to allow deleting database when starting up. This
  commit removes immediate deletion by explicitly calling necessary
  methods and moves the logic to `apply_catalog_batch` which already
  applies `CatalogOp` and also clearing cache and buffer in
  `buffer_ops` method which has hooks to call other places.

closes: https://github.com/influxdata/influxdb/issues/25523

* feat: use reqwest query api for query param

Co-authored-by: Trevor Hilton <thilton@influxdata.com>

* feat: include deleted flag in DatabaseSnapshot

- `DatabaseSchema` serialization/deserialization is delegated to
 `DatabaseSnapshot`, so the `deleted` flag should be included in
 `DatabaseSnapshot` as well.
- insta test snapshots fixed

closes: https://github.com/influxdata/influxdb/issues/25523

* feat: address PR comments + tidy ups

---------

Co-authored-by: Trevor Hilton <thilton@influxdata.com>
2024-11-19 16:08:14 +00:00
Trevor Hilton 53f54a6845
feat: metadata cache core impl (#25552)
* feat: core metadata cache structs with basic tests

Implement the base MetaCache type that holds the hierarchical structure
of the metadata cache providing methods to create and push rows from the
WAL into the cache.

Added a prune method as well as a method for gathering record batches
from a meta cache. A test was added to check the latter for various
predicates and that the former works, though, pruning shows that we need
to modify how record batches are produced such that expired entries are
not emitted.

* refactor: filter expired entries and do some clean up in the meta cache
2024-11-18 12:28:12 -05:00
Trevor Hilton 2ac3df1bca
refactor: use `SerdeVecMap` in `PersistedSnapshot` (#25541)
* refactor: use SerdeVecMap in PersistedSnapshot

This changes from the use of a HashMap to store the DB -> Table structure
in the PersistedSnapshot files to using a SerdeVecMap, which will have
the identifiers serialized as integers instead of strings.

* test: add a snapshot test for persisted snapshots
2024-11-12 16:31:36 -05:00
praveen-influx 814eb31309
chore: update core deps (#25532)
* chore: update core deps

- arrow/parquet deps are patched (as in core)
- three specific code changes to cope with changes in core crates
  - TransitionPartitionId, use `from_parts` instead of `new`
  - arrow buffers can take &[u8] directly without `to_vec()`/`vec!`
    (used only in tests)
  - `schema` and `influxdb_line_protocol` crates need `v3` feature enabled

* chore: update deny.toml

* chore: formatting and deny toml changes

Unicode-3.0 license is added to allowed licenses list, without it
end up with 19 errors (`zerovec`, `zerovec-derive` etc.)

* chore: address PR feedback

- move enabling v3 feature to root Cargo.toml
- added the upstream PR for datafusion-common that introduced RUSTSEC-2024-0384
2024-11-12 16:07:31 +00:00
Paul Dix 35e29d1408
feat: Update catalog to use sequence number in path (#25526)
Updates the catalog to use its own sequence number in the path. This will enable downstream Pro systems that pick up PersistedSnapshots to get the specific catalog that a snapshot is associated with since its sequence number is included.

Also updated the type to be CatalogSequenceNumber to make it more clear & readable when being used.
2024-11-08 15:50:15 -05:00
Trevor Hilton 3bb63b2d71
fix: throw error when adding fields to non-existent table in WAL (#25525)
* fix: throw error when adding fields to non-existent table

* test: add test for expected behaviour in catalog op apply

This also added in some helpers to the wal crate that were previously
added to pro.
2024-11-08 13:15:07 -05:00
praveen-influx c2b8a3a355
feat: add column names to last cache sys table (#25521)
* feat: add column names to last cache sys table

closes: https://github.com/influxdata/influxdb/issues/25511

* feat: move all `get_by_id` methods to take reference in schema
2024-11-08 16:08:30 +00:00
Trevor Hilton 391b67f9ab
feat: configurable last cache eviction (#25520)
* refactor: make last cache eviction optional

This changes how the last cache is evicted. It will no longer run eviction
on writes to the cache, instead, there is an optional method to create a
last cache provider that will run eviction in a background task on a specified
interval.

Otherwise, when records are produced from the cache, only those that have
not expired will be produced.

This should reduce locks on the cache and hopefully improve performance.

* feat: configurable last cache eviction interval

* docs: clean up var names, code docs, and comments
2024-11-06 09:59:17 -05:00
Trevor Hilton da294a265e
refactor: remove conversion step in validator (#25515)
The write validator now builds the row data destined for the WAL
directly, vs. creating an intermediate type to hold row data.
2024-11-04 15:23:54 -05:00
Trevor Hilton ec01934c57
chore: remove unnecessary rustsec for the tonic cve (#25516)
`cargo deny` was showing that no crate matched the advisory criteria for this [RUSTSEC advisory](https://rustsec.org/advisories/RUSTSEC-2024-0376.html), so this PR removes the ignore entry.

In addition, the `hashbrown` crate was causing a new audit failure, and updating it required that the `Zlib` license be added to our list of allowed licenses.

No issue for this, but it is blocking another PR at the moment (https://github.com/influxdata/influxdb/pull/25515).
2024-11-04 15:02:39 -05:00
praveen-influx f745ea69c8
fix: default url for telemetry should include protocol (#25514)
closes: https://github.com/influxdata/influxdb/issues/25502
2024-11-04 14:20:54 +00:00
Trevor Hilton aa70a73487
fix: the cache target for build artefacts in Dockerfile (#25510) 2024-11-01 17:20:00 -04:00