Commit Graph

227 Commits (mhilton/influxdb-schema-system-table)

Author SHA1 Message Date
Martin Hilton 4c180e5d42 feat: influxdb_schema system table
Add a system table to expose the InfluxDB schema for tables in a
database. This exposes the schema of time series tables using InfluxDB
terminology and data type definitions.
2025-07-28 17:16:13 +01:00
praveen-influx a6bec9cd27
feat: admin token recovery (#26594)
* feat: additional server setup for admin token recovery

- new server to only serve admin token regeneration without an admin
  token has been added
- minor refactors to allow reuse of some of the utilities like trace
  layer for metrics moved to their own functions to allow them to be
  instantiated for both servers
- tests added to check if both the new server works right for
  regenerating token and also ensure none of the other functionalities
  are available on the admin token recovery server

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

* refactor: tidy ups + extra logging

* refactor: address PR feedback

- recovery server now only starts when `--admin-token-recovery-http-bind` is passed in
- as soon as regeneration is done, the recovery server shuts itself down
- the select! macro logic has been changed such that shutting down
  recovery server does not shutdown the main server

* refactor: host url updates when regenerating token

- when `--regenerate` is passed in, `--host` still defaults to the main
  server. To get to the recovery server, `--host` with the recovery
  server address should be passed in
2025-07-18 20:03:46 +01:00
praveen-influx 2392878850
feat: additional logging in the write path to capture db and ip (#26616)
* feat: additional logging in the write path to capture db and ip

closes: https://github.com/influxdata/influxdb_pro/issues/519

* refactor: address PR feedback
2025-07-18 16:40:12 +01:00
Trevor Hilton ee2dc2603e
feat: add system.processing_engine_trigger_arguments table (#26604)
Add a new system table that allows users to inspect the arguments
configured for processing engine triggers. The table has three columns:
- trigger_name: name of the trigger
- argument_key: key of the argument
- argument_value: value of the argument

Each trigger argument appears as a separate row in the table, making
it easy to query specific triggers or arguments.

Update snapshot files to include processing_engine_trigger_arguments table

Update test snapshots to include the new processing_engine_trigger_arguments
system table in:
- Table listing outputs
- Error messages showing valid table names
- Table summaries

This ensures tests properly reflect the new system table in their
expected outputs.
2025-07-11 11:41:14 -07:00
praveen-influx c681ea058d
refactor: remove server builder refactor (#26550)
* feat: additional endpoint to route secure request added

* feat: added server builder with options instead of generics

* feat: amend existing types to use new builder

* refactor: remove builder completely and initialize `Server` directly

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

* refactor: use CreateServerArgs to address lint error
2025-07-04 12:19:37 +01:00
Stuart Carnie 58b0725cf9
fix: Existing soft-deleted schema can be hard-deleted (#26574)
* feat: Allow hard_deleted date of deleted schema to be updated

* feat: Include hard_deletion_date in `_internal` `databases` and `tables`

* feat: Unit tests for testing deleted databases

* chore: Default is now to hard-delete with default duration

* test: Update test names and assertions for new default hard deletion behavior

- Renamed delete_table_defaults_to_hard_delete_never to delete_table_defaults_to_hard_delete_default
- Renamed delete_database_defaults_to_hard_delete_never to delete_database_defaults_to_hard_delete_default
- Updated assertions to expect default deletion duration instead of None/Never
- Aligns with the change of HardDeletionTime default from Never to Default

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* chore: Remove TODO

* chore: PR feedback and other improvements

* Ensure system databases and tables schema specify a timezone for the
  `hard_deletion_time` Timestamp columns (otherwise they display without
  a timezone)
* `DELETE` using `default` delay is idempotent, so multiple requests
  will not continue to update the `hard_deletion_time`
* Improved test coverage for these behaviours

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-07-03 07:26:13 +10:00
wayne ad73deef08
fix: v1 query API should default to ns for CSV output (#26577) 2025-07-01 12:09:49 -06:00
Stuart Carnie d396921aa0
chore: Update to Rust 1.88 (#26567)
* chore: Update to Rust 1.88

* chore: Fixes missed by Claude
2025-06-27 07:38:45 +10:00
Stuart Carnie 01c907de0e
fix: handle corrupt WAL files during replay without panic (#26556)
Add bounds checking to prevent panic when WAL files are empty or
truncated. Introduces `--wal-replay-fail-on-error` flag to control
behavior when encountering corrupt WAL files during replay.

- Add WalFileTooSmall error for files missing required header bytes
- Validate minimum file size (12 bytes) before attempting
  deserialization
- Make WAL replay configurable: skip corrupt files by default or fail
  on error
- Add comprehensive tests for empty, truncated, and header-only files

Closes #26549
2025-06-24 12:57:40 +01:00
Stuart Carnie 4c8283dd6f
feat: Hard delete database and table (#26553)
* feat: Hard delete database and table

* feat: Enable hard-deletion in OSS
2025-06-24 12:36:23 +01:00
wayne 8e0688912f
feat: allow users to specify lookback duration for PersistedFiles buffer (#26528) 2025-06-18 09:41:05 -06:00
praveen-influx 6bb0401c69
chore: porting some utilities that were created in pro (#26529)
- `AbortableTaskRunner` and it's friends in influxdb3_shutdown
- `ProcessUuidWrapper` and it's friends in influxdb3_process
- change sleep time in test

They're not used currently in any of the core code, but helps when
sync'ing core back to enterprise
2025-06-17 17:24:41 +01:00
Michael Gattozzi d07d2f75a2
feat: Add retention period to cli commands (#26520)
This commit touches quite a few things, but the main changes that need
to be taken into account are:

- An update command has been added to the CLI. This could be further
  extended in the future to update more than just Database retention
  periods. The API call for that has been written in such a
  way as to allow other qualities of the database to be updated
  at runtime from one API call. For now it only allows the retention
  period to be updated, but it could in theory allow us to rename a
  database without needing to wipe things, especially with a stable ID
  underlying everything.
- The create database command has been extended to allow
  its creation with a retention period. In tandem with the update
  command users can now assign or delete retention periods at will
- The ability to query catalog data about both databases and tables has
  been added as well. This has been used in tests added in this commit,
  but is also a fairly useful query when wanting to look at things such
  as the series key. This could be extended to a CLI command as well if
  we want to allow users to look at this data, but for now it's in the
  _internal table.

With these changes a nice UX has been created to allow our customers to
work with retention periods.
2025-06-16 10:22:45 -04:00
Trevor Hilton ac75103e52
feat: track gen1 duration in catalog (#26508)
* Tracks the generation duration configuration for the write buffer
  in the catalog.
* Still leverages the CLI arguments to set it on initial start up of
  the server.
* Exposes a system table on the _internal database to view the configured
  generation durations.
* This doesn't change how the gen1 duration is used by the write buffer.
* Adds several tests to check things work as intended.
2025-06-10 15:52:01 -04:00
Trevor Hilton 419d80ddbb
fix: do not allow _ in db names on API-based create (#26507)
Prevents database names that start with `_` when created explicitly
through the Create Database or Create Table APIs.
2025-06-09 12:52:05 -04:00
wayne fa646a6f64
chore: backport retention period implementation from enterprise (#26501)
Includes two main components:

* Removal of expired data from `PersistedFiles`.
* Modified `ChunkFilter` that precisely excludes expired data from query
  results even if the expired data hasn't been removed from the object
  store yet.

---------

Co-authored-by: Michael Gattozzi <mgattozzi@influxdata.com>
2025-06-06 18:07:34 -06:00
wayne d499c59bb1
chore: backport hard delete time in Catalog and deleter service from enterprise (#26500)
* Merge pull request #881 from influxdata/sgc/26156/hard_delete_table_apis

feat: Catalog tracks hard delete time; implement deleter service

* Merge pull request #885 from influxdata/sgc/26156/pr_881_followup

chore: PR #881 followup

---------

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
2025-06-05 14:41:01 -06:00
praveen-influx a67b50dac5
feat: add concurrency limit for WAL replay (#26483)
WAL replay currently loads _all_ WAL files concurrently running into
OOM. This commit adds a CLI parameter `--wal-replay-concurrency-limit`
that would allow the user to set a lower limit and run WAL replay again.

closes: https://github.com/influxdata/influxdb/issues/26481
2025-06-03 16:34:31 +01:00
wayne acdb8f650e
feat: add retention period to catalog (#26479)
* feat: add retention period to catalog

* fix: handle humantime parsing error properly

* refactor: use new iox_http_util types

---------

Co-authored-by: Michael Gattozzi <mgattozzi@influxdata.com>
2025-06-02 18:36:04 -06:00
Carol (Nichols || Goulding) 4c62b5273c
refactor: Use iox_http_util to make updating to hyper 1 easier (#26436)
* refactor: Use iox_http_util::Request instead of hyper::Request

* refactor: Use iox_http_util::RequestBuilder instead of hyper::Request::builder

* refactor: Use iox_http_util::empty_request_body instead of Body::empty

* refactor: Use iox_http_util::bytes_to_request_body instead of Body::from

* refactor: Use http_body::Body instead of hyper::body::HttpBody

* refactor: Use iox_http_util::Response instead of hyper::Response

* refactor: Use iox_http_util::ResponseBuilder instead of hyper::Response::builder

* refactor: Use iox_http_util::empty_response_body instead of Body::empty

* refactor: Use iox_http_util::bytes_to_response_body instead of Body::from

* refactor: Use iox_http_util::stream_results_to_response_body instead of Body::wrap_stream

* refactor: Use the read_body_bytes_for_tests helper fn
2025-06-02 14:57:55 -04:00
Trevor Hilton be25c6f52b
test: deduplication across memory and parquet chunks (#26477) 2025-05-29 16:27:32 -04:00
Trevor Hilton 5bf3a1aef8
test: add integration tests to influxdb3_server (#26474) 2025-05-28 21:39:40 -04:00
Trevor Hilton 4dc61df77f
chore: update to latest influxdb3_core (#26429)
* chore: update to latest core

* chore: allow CDLA permissive 2 license

* chore: update insta snapshot for new internal df tables

* test: update assertion in flightsql test

* fix: object store size hinting workaround in clap_blocks

Applied a workaround from upstream to strip size hinting from the object
store get request options. See:

https://github.com/influxdata/influxdb_iox/issues/13771

* fix: query_executor tests use object store size hinting workaround

* fix: insta snapshot test for show system summary command

* chore: update windows- crates for advisories

* chore: update to latest sha on influxdb3_core branch

* chore: update to latest influxdb3_core rev

* refactor: pr feedback

* refactor: do not use object store size hint layer

Instead of using the ObjectStoreStripSizeHint layer, just provide the
configuration to datafusion to disable the use of size hinting from
iox_query.

This is used in IOx and not relevant to Monolith.

* fix: use parquet cache for get_opts requests

* test: that the parquet cache is being hit from write buffer
2025-05-26 14:11:06 -04:00
Stuart Carnie c5ed113c5b
chore: Update rust toolchain to 1.87.0 (#26456)
Changes were due to a number of clippy improvements
2025-05-26 09:22:32 -04:00
Stuart Carnie 1abbb525db
fix: Ensure series key metadata is persisted to Parquet snapshots (#26449)
* chore: Ensure Parquet sort key is serialised with snapshots

* chore: PR feedback, rename state variable to match intent

* chore: Use `Default` trait to implement `TableBuffer::new`

* chore: Fix change in file size with extra metadata

* chore: Add rustdoc for `sort_key` field
2025-05-26 09:27:07 +10:00
Trevor Hilton d1c10f4b29
fix: backfill new tags with NULL instead of empty string (#26446)
* fix: backfill new tags with NULL instead of empty string

* refactor: use helper for append_null

* test: add a test to check null back/forward fill
2025-05-21 17:23:51 -04:00
praveen-influx 1ec063b0c4
feat: support named admin tokens (#26434)
* feat: support named admin tokens

- `--name` and `--expiry` are now allowed for `--admin` subcommand
- `--regenerate` is restricted to operator token only
- the endpoint is not allowed if auth is disabled

closes: https://github.com/influxdata/influxdb_pro/issues/854

This is a port of https://github.com/influxdata/influxdb_pro/pull/850 (hash:156981e4a1)

* refactor: address PR feedback
2025-05-20 15:30:19 +01:00
Stuart Carnie bf83e7fbb3
feat: `/ping` API contains versioning headers (#26433)
* feat: `/ping` API contains versioning headers

Further, the product version can be modified by updating the metadata in
the `influxdb3_process` `Cargo.toml`.

* chore: PR feedback

* chore: placate linter
2025-05-20 08:50:27 +10:00
praveen-influx 1f076b69c8
feat: add trigger count to telemetry (#26426)
* feat: add trigger count to telemetry

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

* refactor: do trigger counts by type
2025-05-16 17:18:26 +01:00
praveen-influx b404e8475c
fix: do not allow operator token from being deleted (#26418)
* fix: do not allow operator token from being deleted

closes: https://github.com/influxdata/influxdb_pro/issues/819

* refactor: address PR feedback

* fix: add a word and clarifying colon

* fix: failing test

---------

Co-authored-by: Peter Barnett <peter.barnett03@gmail.com>
2025-05-15 09:10:37 +01:00
praveen-influx 8aab3cc607
feat: allow health,ping,metrics to opt out of auth (#26406)
* feat: allow health,ping,metrics to opt out of auth

This commit introduces `--disable-authz <DISABLE_AUTHZ_RESOURCES>`. The
options for `DISABLE_AUTHZ_RESOURCES` are health, ping and metrics. By
default all these resources will be guarded

closes: https://github.com/influxdata/influxdb_pro/issues/774

* chore: update influxdb3/src/commands/helpers.rs

space after comma in help text

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

* chore: update influxdb3/src/help/serve.txt

space after comma in help text

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

* chore: update influxdb3/src/help/serve_all.txt

space after comma in help text

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

* refactor: use statics to reduce clones/copies

---------

Co-authored-by: Trevor Hilton <thilton@influxdata.com>
2025-05-13 15:47:53 +01:00
praveen-influx 8a3d98a273
feat: support `Basic $TOKEN` for all apis (#26363)
* feat: support `Basic $TOKEN` for all apis

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

* refactor: address PR feedback to return MalformedRequest error when `:` is used more than once in user-pass pair

* refactor: change the message sent back for malformed auth header
2025-05-09 18:11:37 +01:00
Trevor Hilton a2dc597d54
chore: update rust toolchain to 1.86.0 (#26355) 2025-05-05 17:33:26 -04:00
praveen-influx 08f2f857da
feat: additional info when started --without-auth (#26338)
- return 405 message body to indicate the endpoints are disabled
- extra log to say server has been started without auth
2025-04-29 08:06:44 -05:00
praveen-influx 9c8c7fe105
refactor: port changes from enterprise (#26329) 2025-04-25 18:08:07 +01:00
Trevor Hilton e977d263f8
chore: back-port changes from influxdb_pro#762 (#26323) 2025-04-25 10:02:08 -04:00
Trevor Hilton 85850cd394
feat: improve control of logs on test harness (#26325) 2025-04-24 21:09:00 -04:00
Trevor Hilton 0f52ebb90d
fix: group by tag columns with escape quotes (#26326)
* test: reproducer for #26216
* fix: group by tag columns with escape quotes
2025-04-24 20:31:14 -04:00
Michael Gattozzi e684fc1a24
feat: Add support for CORS requests from a browser (#26314)
This commit adds support for CORS by modifying our requests to make
preflight checks valid and to handle responses containing the necessary
headers for browsers to access the data they need. We keep what we
accept as open as this is essentially what requests to the server are
normally like and we gate the requests with an auth token.

Closes #26313
2025-04-24 15:16:18 -04:00
Stuart Carnie 8507bdc766
fix: Ensure `iox` table schema is sorted for SHOW TABLES (#26302)
* fix: Ensure `iox` table schema is sorted for SHOW TABLES

Closes #25860

* chore: Add insta snapshot

* chore: placate clippy
2025-04-23 09:05:06 +10:00
Michael Gattozzi af57abd6a9
feat: Allow setting a minimum TLS version (#26307)
This commit allows users to set a minimum TLS version. The default is
1.2. The choices are TLS 1.2 or TLS 1.3 which can be set via env var:

INFLUXDB3_TLS_MINIMUM_VERSION="tls-1.2"
or
INFLUXDB3_TLS_MINIMUM_VERSION="tls-1.3"

and for the command line flag for the serve command:

--tls-minimum-version tls-1.2

or

--tls-minimum-version tls-1.3

With this users have more fine grained control over what tls version
they require.

Closes #26255
2025-04-22 13:57:23 -04:00
Trevor Hilton e4cfbf71f7
chore: back-port catalog limit refactor from enterprise (#26278)
This back-ports some changes to how limits are enforced on the catalog
from enterprise. There were some changes that would catch some potential
bugs.
2025-04-16 14:03:24 -04:00
Trevor Hilton 5d7cb88f87
feat: track catalog retries as prometheus metric (#26251)
Adds a metric to track total retried catalog operations due to the catalog
being updated elsewhere. Includes a test to check the counter increments
on basic catalog operations.
2025-04-11 15:24:10 -04:00
Trevor Hilton b11cf81dc6
refactor: remove Option from catalog update APIs (#26250)
Catalog update APIs were returning an Option that was not necessary. It
was always Some, so this removes the Option from the API to make the
intent clear - if there is an update made by the requested change, there
is a Batch; whereas if the requested change is erroneous, or would not
produce a change, the response is Err.
2025-04-11 12:34:18 -04:00
praveen-influx e5af9f95d2
feat: enable auth by default (#26243)
* feat: enable auth by default

- Removes `--bearer-token` support and starts the server with auth by
  default.
- Adds `--without-auth` switch to start the server without any auth

* feat: changes for auth being turned off

when auth is turned off,
- disallow token endpoints (returns 405)
- remove hash column when querying tokens system table

* refactor: address PR feedback
2025-04-11 16:44:27 +01:00
praveen-influx 64eeb09687
feat: allow token deletes (#26247)
This commit allows deletion of tokens by name. Below is an example,

`influxdb3 delete token --token-name _admin --token $CURRENT_ADMIN_TOKEN`

It needs user confirmation before proceeding with the delete
2025-04-10 20:31:19 +01:00
Michael Gattozzi fe69793418
feat: Add TLS support for influxdb3 (#26246)
This commit adds TLS support to influxdb3 and allows users to pass in a
path to a key and cert file with the --tls-key and --tls-cert flags in
the serve command. It also adds the ability for every command to specify
a certificate authority for requests. This is mostly needed when the
cert is self signed, but there are other use cases for this.

The big thing is that most of our tests now use TLS by default. Included
are self signed certs for localhost and the the CA cert included in the
commit. Since these are *only* used for testing this should be fine to
include as they are not used in nor are they intended to be used in any
production system. The expiry has been set for 365 days and the file
perms are set to o600 like the original issue mentioned. The tests pass
with this restriction.

I've verified that the API works via curl with the self signed certs as
I did *not* need to pass in the -k option to bypass checking the certs
were valid. The same goes for our tests. They use the rootCA.pem file
to verify the self signed cert when connecting and reject it otherwise.

With this users can be confident that their queries are safely encrypted
during transport.

Note that TLS works for both FlightSQL and our normal APIs.

Closes #25774
2025-04-10 13:45:47 -04:00
praveen-influx 1983818e36
feat: porting token work from enterprise (#26239)
* feat: generate persistable admin token

- this commit allows admin token creation using `influxdb3 create token
  --admin` and also allows regeneration of admin token by `influxdb3
  create token --admin --regenerate`
- `influxdb3_authz` crate hosts all low level token types and behaviour
- catalog log and snapshot types updated to use the token repo
- tests that relied on auth have been updated to use the new token
  generation mechanism and new admin token generation/regeneration tests
  have been added

* feat: list admin tokens

- allows listing admin tokens
- uses _internal db for token system table
- mostly test fixes due to _internal db
2025-04-09 16:31:59 +01:00
Trevor Hilton 7d95c48ecf
fix: empty writes do not corrupt wal (#26223)
* test: reproducer for empty write issue

* fix: empty writes do not corrupt wal
2025-04-05 16:44:34 -04:00
Jackson Newhouse f881c5844b
chore: remove generic term from HttpApi (#26210) 2025-04-01 10:17:56 -07:00