Commit Graph

49431 Commits (praveen/add-snapshot-walop)

Author SHA1 Message Date
Praveen Kumar 90a72611e0
feat: use SnapshotOp 2025-01-08 10:55:50 +00:00
Praveen Kumar 6619e9ecce
refactor: address PR feedback 2025-01-03 13:17:41 +00:00
Praveen Kumar 936b6cf80f
feat: force snapshot under memory pressure
- The main change is to detach wal and snapshot, in a way all 3 of the
  following things can happen
    - flush the wal buffer only (already handled, before this commit)
    - flush wal buffer and snapshot (already handled, before this commit)
    - snapshot without flushing wal buffer (introduced in this commit)
  This is achieved by introducing another method `snapshot` in
  `WalFileNotifier` trait. The main dependency between wal and snapshot
  is the `wal_file_number`, since this is tracked in `SnapshotTracker`
  separately we can switch to using `SnapshotTracker`'s
  `last_wal_sequence_number` instead of the one that comes through the
  `WalContents`.
- A higher level background loop is introduced that checks the overall
  table buffer size every `N` seconds and if it is greater than a
  threshold (`X`) then it calls `snapshot` method. Both `N` and `X` are
  configurable through cli. `N` defaults to 10s and `X` defaults to 70%
- Some refactoring of code so that existing methods can be reused when
  only snapshotting

closes: https://github.com/influxdata/influxdb/issues/25685
2025-01-02 13:14:00 +00:00
Trevor Hilton de227b95d9
refactor: cleanup v3 write API and series key method on catalog (#25723)
Store the series key column names on the TableDefinitin in catalog so
looking up the series key by column names is more efficient

Remove the /api/v3/write API and related code/tests
2024-12-30 09:32:54 -05:00
Trevor Hilton 6f4639262d
feat: track lines rejected in prometheus metrics (#25722)
* feat: track lines rejected in prometheus metrics

This adds the metric `influxdb3_write_lines_rejected` metric which tracks
the total number of lines rejected from incoming writes.

Note, that this only tacks the number of rejected lines when the default
`accept_partial` of `true` is provided to incoming write requests.
2024-12-29 10:05:57 -05:00
Trevor Hilton 03ea565802
feat: cli arg to specify max parquet fanout (#25714)
This allows the `max_parquet_fanout` to be specified in the CLI for the `influxdb3 serve` command. This could be done previously via the `--datafusion-config` CLI argument, but the drawbacks to that were:
1. that is a fairly advanced option given the available key/value pairs are not well documented
2. if `iox.max_parquet_fanout` was not provided to that argument, the default would be set to `40`

This PR maintains the existing `--datafusion-config` CLI argument (with one caveat, see below) which allows users to provide a set key/value pairs that will be used to build the internal DataFusion config, but in addition provides the `--datafusion-max-parquet-fanout` argument:
```
    --datafusion-max-parquet-fanout <MAX_PARQUET_FANOUT>
          When multiple parquet files are required in a sorted way (e.g. for de-duplication), we have two options:

          1. **In-mem sorting:** Put them into `datafusion.target_partitions` DataFusion partitions. This limits the fan-out, but requires that we potentially chain multiple parquet files into a single DataFusion partition. Since chaining sorted data does NOT automatically result in sorted data (e.g. AB-AB is not sorted), we need to preform an in-memory sort using `SortExec` afterwards. This is expensive. 2. **Fan-out:** Instead of chaining files within DataFusion partitions, we can accept a fan-out beyond `target_partitions`. This prevents in-memory sorting but may result in OOMs (out-of-memory) if the fan-out is too large.

          We try to pick option 2 up to a certain number of files, which is configured by this setting.

          [env: INFLUXDB3_DATAFUSION_MAX_PARQUET_FANOUT=]
          [default: 1000]
```
with the default value of `1000`, which will override the core `iox_query` default of `40`.

A test was added to check that this is propagated down to the `IOxSessionContext` that is used during queries.

The only change to the `datafusion-config` CLI argument was to rename `INFLUXDB_IOX` in the environment variable to `INFLUXDB3`:
```
    --datafusion-config <DATAFUSION_CONFIG>
          Provide custom configuration to DataFusion as a comma-separated list of key:value pairs.

          # Example ```text --datafusion-config "datafusion.key1:value1, datafusion.key2:value2" ```

          [env: INFLUXDB3_DATAFUSION_CONFIG=]
          [default: ]
```
2024-12-27 12:42:30 -05:00
praveen-influx 96a580f365
refactor: porting changes in pro to oss (#25712)
- query_executor is moved to it's own module so that it's easier to swap
  the setup for pro.
- system_tables setup is also modified
2024-12-27 15:02:22 +00:00
praveen-influx 3f678678d7
chore: update core dependencies (#25708)
- one notable change is `make_object_store` from clap_blocks has been
  removed. Instead use `ObjectStoreConfig::make_object_store()`
2024-12-24 14:21:59 +00:00
Trevor Hilton 0cb00d8e0b
fix: do not count deleted dbs and tables toward limit (#25702) 2024-12-21 16:47:17 -05:00
Jackson Newhouse 0db71b69b9
fix(catalog): consistent ordering of catalog operations (#25690) 2024-12-20 15:17:38 -08:00
Michael Gattozzi c764d37636
feat: Add json lines support to query output (#25698) 2024-12-20 14:57:19 -05:00
Michael Gattozzi 048e45fff9
fix: change 200 to 204 for compatibility of v1/v2 (#25699) 2024-12-20 14:56:18 -05:00
Michael Gattozzi 2a132f1edf
fix: change failed query with missing db to 404 (#25693) 2024-12-20 11:53:13 -05:00
Trevor Hilton d10ad87f2c
feat: write metrics (#25692)
Added prometheus metrics to track lines written and bytes written per
database. The write buffer does the tracking after validation of incoming
line protocol.

Tests added to verify.
2024-12-20 11:02:36 -05:00
praveen-influx 4f9d641d5a
feat: telem uptime and rename (#25682)
* feat: add uptime to telemetry

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

* refactor: rename stats fields for telemetry

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

* refactor: PR feedback
2024-12-20 08:52:02 +00:00
Paul Dix 0eab724bee
fix: Field not in queryable buffer (#25691) 2024-12-19 19:22:47 -05:00
Michael Gattozzi e51bea65b4
feat: create DB and Tables via REST and CLI (#25687)
* feat: create DB and Tables via REST and CLI

This commit does a few things:

1. It brings the database command naming scheme for types inline with
   the rest of the CLI types
2. It brings the table command naming scheme for types inline with
   the rest of the CLI types
3. Adds tests to check that the num of dbs is not exceeded and that you
   cannot create more than one database with a given name.
4. Adds tests to check that you can create a table and put data into it
   and querying it
5. Adds tests for the CLI for both the database and table commands
6. It creates an endpoint to create databases given a JSON blob
7. It creates an endpoint to create tables given a JSON blob

With this users can now create a database or table without first needing
to write to the database via the line protocol!

Closes #25640
Closes #25641
2024-12-19 16:01:34 -05:00
Paul Dix 56576402cc
fix: Ensure tags are never null (#25680)
* fix: Ensure tags are never null

This injects empty strings into tags for any rows in the buffer where the tag value is null. This is required because the tags are what make up the series key, which must have all non-null values.

There is an ongoing discussion about what the real behavior should be here, but for now this will get our users running that break without this behavior. Discussion is in #25674.

Fixes #25648

* fix: clippy failures
2024-12-18 17:09:23 -05:00
Trevor Hilton 93222f756b
feat: log errors on panic in sort_dedupe_persist (#25678)
This adds some error handling and logging around the method that sorts,
deduplicates, and persists parquet data during the snapshot process

The errors will need to be handled in follow-on work, but this is for
helping debug fatal errors during the process.
2024-12-18 13:51:30 -05:00
Trevor Hilton d265e111ce
feat: suport projection pushdown in metadata cache (#25675) 2024-12-17 20:13:25 -05:00
Jackson Newhouse 8bfccb74ab
feat(processing_engine): Runtime and write-back improvements (#25672)
* Move processing engine invocation to a seperate tokio task.
* Support writing back line protocol from python via insert_line_protocol().
* Update structs to work with bincode.
2024-12-17 16:38:12 -08:00
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