Commit Graph

217 Commits (praveen/token-support)

Author SHA1 Message Date
Praveen Kumar 695631566f
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:10:27 +01:00
Praveen Kumar d69fbfc746
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
2025-04-09 16:06:04 +01:00
Trevor Hilton 1dd8cccbdd
feat: catalog updates state to stopped on shutdown (#26241) 2025-04-09 10:56:10 -04:00
Trevor Hilton b472e14625
test: check error behaviour on create table api (#26233)
Added an integration test that verifies that invalid field types produce
an error instead of leading to a panic.
2025-04-07 14:14:21 -04:00
Trevor Hilton c7854363c4
chore: back-port changes to shutdown code from enterprise (#26206)
* refactor: make ShutdownManager Clone

ShutdownManager can be clone since its underlying types from tokio are
all shareable via clone.

* refactor: make ShutdownToken not Clone

Alters the API so that the ShutdownToken is not cloneable. This will help
ensure that the Drop implementation is invoked from the correct place.
2025-04-01 11:32:23 -04:00
Jackson Newhouse d245b2e886
fix(processing_engine): properly extract data from DictionaryArrays (#26204) 2025-03-31 11:38:23 -07:00
Trevor Hilton a8e12803b0
fix: additional check on frontend shutdown (#26205)
Added an additional check in the serve command to ensure that the frontend
has shutdown before exiting so that we don't close any connections pre-
emptively.
2025-03-31 13:59:47 -04:00
Trevor Hilton 24887770ef
feat: shutdown on WAL overwritten (#26203)
* feat: trigger shutdown if wal has been overwritten

WAL persist uses PutMode::Create in order to invoke shutdown if another
process writes to the WAL ahead of it.

A test was added to check that it works from CLI test suite.

* chore: clippy
2025-03-31 12:58:18 -04:00
Trevor Hilton eda2fc9b21
refactor: ensure shutdown complete via Drop impl (#26202)
This ensures a ShutdownToken will invoke `complete` by calling it from
its `Drop` implementation. This means registered components are not
required to signal completion, but can if needed.

Some comments and other cleanup refactoring was done as well.
2025-03-31 10:25:55 -04:00
Trevor Hilton 9401137825
feat: handle graceful shutdown (#26197)
* feat: add influxdb3_shutdown crate

provides basic wait methods for unix/windows OS's

* feat: graceful shutdown

* docs: add rust docs and test to influxdb3_shutdown

Added rustdoc comments to types and methods in the influxdb3_shutdown
crate as well as a test that shows the ordering of a shutdown.
2025-03-31 09:58:40 -04:00
Jackson Newhouse 7c02593fef
chore: Overhaul CLI tests for better ergonomics. (#26168)
* chore: Overhaul CLI tests for better ergonomics.

* chore: switch with_query() to with_sql().
2025-03-20 09:19:12 -07:00
Trevor Hilton d2da058ded
chore: cleanup token create CLI message (#26158) 2025-03-18 10:08:16 -04:00
Trevor Hilton 863a6d0b4a
feat: ack catalog update broadcast (#26118)
This creates a CatalogUpdateMessage type that is used to send
CatalogUpdates; this type performs the send on the oneshot Sender so
that the consumer of the message does not need to do so.

Subscribers to the catalog get a CatalogSubscription, which uses the
CatalogUpdateMessage type to ACK the message broadcast from the catalog.

This means that catalog message broadcast can fail, but this commit does
not provide any means of rolling back a catalog update.

A test was added to check that it works.
2025-03-17 20:20:07 -04:00
Trevor Hilton 3ad0670452
test: small change to distinct cache cli test (#26152)
Added one check to the distinct cache create test that checks duplicate
creation behaviour while investigating influxdb_pro#601
2025-03-17 11:05:25 -04:00
Jackson Newhouse e49f0e89fa
fix(processing_engine): Change how temporary plugin files are managed. (#26141) 2025-03-14 10:52:38 -07:00
Jackson Newhouse e1015f15f7
feat(processing_engine): proper escaping of LineBuilder arguments. (#26134) 2025-03-14 09:31:58 -07:00
Jackson Newhouse 331f88533c
feat(processing_engine): Attach a node id to the processing engine and triggers for multi-node support compatibility. (#26136) 2025-03-13 16:10:02 -07:00
Michael Gattozzi 97b8c471f8
fix: Make sure JSON fully closes on empty records (#26130) 2025-03-12 14:01:40 -04:00
Trevor Hilton b6cb6dd51e
chore: back-port catalog debug log cleanup from enterprise (#26128)
* chore: back-port debug log cleanup for catalog

* chore: back-port debug log cleanup for wal

* chore: back-port debug log cleanup for write
2025-03-12 13:20:21 -04:00
Jackson Newhouse a455598be6
feat(processing_engine): Implement Processing Engine Cache. (#26111) 2025-03-11 15:48:47 -07:00
Trevor Hilton 503819468e
feat: catalog checkpoints (#26126) 2025-03-11 18:20:36 -04:00
Trevor Hilton 72dc4458fd
chore: backport changes to catalog from enterprise (#26116)
* chore: backport changes to influxdb3_catalog crate

* chore: backport changes to influxdb3_cache crate

* chore: backport changes to influxdb3_write crate

* chore: backport changes to influxdb3_proc_eng crate

* chore: backport influxdb3 crate changes for catalog

* chore: backport changes to influxdb3_id crate

* chore: backport changes to influxdb3_wal crate

* chore: backport changes to influxdb3_clap_blocks crate

* chore: backport changes to influxdb3_client crate

* chore: backport influxdb3_server crate changes

* chore: fix after full backport

* fix: ordering of catalog broadcast
2025-03-11 12:11:51 -04:00
Jackson Newhouse 5fa417c3f0
feat: remove system-py (#26087)
* feat: remove system-py

* chore: allow Apache-2.0 WITH LLVM-exception license.
2025-03-10 11:10:33 -07:00
Jackson Newhouse a1f0f2b691
fix: add error_behavior to test matching expression. (#26101) 2025-03-04 11:09:34 -08:00
Jackson Newhouse c930d9eef8
feat(processing_engine): error handling for triggers. (#26086) 2025-03-04 09:32:58 -08:00
Jackson Newhouse 357c05f3d0
feat(processing_engine): Support Flask semantics for responses from request plugins. (#26095) 2025-03-04 09:00:59 -08:00
wayne d1711d284a
fix: test case introduced by #26094 (#26096) 2025-03-03 17:27:23 -07:00
wayne e00e0f1a86
fix: allow equal sign in plugin trigger arguments (#26094) 2025-03-03 13:06:35 -07:00
wayne e2c3e7c8c8
feat: improve CLI list arg consistency (always use commas) (#26088)
* chore: eliminate SeparateList, use comma-delimited flag list options everywhere
* fix: remove num_args attribute from comma-delimited args
2025-03-03 12:52:13 -07:00
Jackson Newhouse 208b82a32d
fix(processing_engine): Use default globals so that builtins are automatically included. (#26072) 2025-02-27 16:11:08 -08:00
Jamie Strandboge aa09d761a0
chore: clean up runtime code for python setup (#26042)
* chore: clean up runtime code for python setup

ccd5d22aab introduced working but temporary code for setting up the
python runtime environment. This cleans that up:

* refactor various find_python() functionality into virtualenv.rs
* refactor PYTHONHOME calculation to virtualenv.rs:find_python_install()
* adjust init_pyo3() to temporarily set PYTHONHOME based on
  virtualenv.rs:find_python_install() as this is the only place it is
  needed (indeed, venv activation scripts try to remove it)

Importantly, virtualenv.rs:find_python_install() tries to find the
python build standalone runtime based on a few heuristics. This function
could be improved in the fullness of time to, eg, be configured via a
build parameter.

Also, virtualenv.rs:find_python() can be used pre and post venv
activation. Before entering the venv, it will use find_python_install()
which is useful for things like setting up the initial venv. After
entering the venv, it will honor VIRTUAL_ENV (as set by
virtualenv.rs:initialize_venv()) to find python, which is important for
install packages with pip and having them installed into the venv.

* chore: update README_processing_engine.md for default venv

* chore: add bug reference for venv migrations with python minor releases

* chore: add security URLs to README_processing_engine.md

* chore: find_python_home() returns Option<PathBuf>. Thanks Jackson Newhouse

* fix: manually set sys.prefix, exec_prefix and sys.path

When activating a venv in the shell, sys.base_prefix and
sys.base_exec_prefix should be set to the installation location while
sys.prefix and sys.exec_prefix should be set to the venv dir.
Unfortunately, when initialize_venv() and init_pyo3() are called, we
can't use Py_InitializeFromConfig() to set any of these and certain
platforms are unable to find python-build-standalone. For now, we'll
temporarily set PYTHONHOME in init_pyo3() to the installation location
to make python work. By setting it at this point in the code, sys.prefix
and sys.exec_prefix end up also being set to the installation location,
which is fine when not under a venv, but is different from when entering
an venv.

To address this, in PYTHON_INIT.call_once() and when VIRTUAL_ENV is set
(which initialize_venv() will have set at this point), manually set
sys.prefix and sys.exec_prefix to what is in VIRTUAL_ENV.

Similarly, when activating a venv in the shell, sys.path is appended to
have the venv's site-packages dir. Previously we were setting PYTHONPATH
in initialize_venv() which ensures that the venv's site-packages dir is
in sys.path, but this ends up having the venv's site-packages dir first
in sys.path. To correct this, don't set PYTHONPATH any more and instead
adjust PYTHON_INIT.call_once() to append the venv's site-packages dir to
sys.path when VIRTUAL_ENV is set.

Finally, when exiting init_pyo3(), unconditionally unset PYTHONHOME when
VIRTUAL_ENV is set (like activation scripts do) and restore/unset when
it isn't.

Prior to these changes, all target incorrectly had the venv's
site-packages first in sys.path and OSX and Windows additionally had an
incorrect sys.prefix and sys.exec_prefix. With these initialization
changes in place, the runtime environment for the plugins is much closer
to that of a shell activated venv.
2025-02-26 12:06:23 -06:00
Jackson Newhouse f4b3fae186
feat(processing_engine): Have automatic plugin dir at /plugins for docker. (#26047) 2025-02-21 10:09:51 -08:00
Michael Gattozzi 1f72bfcc33
feat: Update to Rust 1.85 and 2024 Edition (#26046) 2025-02-20 14:58:07 -05:00
praveen-influx f1fc498dbf
feat: updates to default memory settings (#26023)
- breaking change, replaced `--parquet-mem-cache-size-mb` and env var for
  it with `--parquet-mem-cache-size` (takes value now in percentage or
  MB), now defaults to 20% of total available memory
- force snapshotting is set at 50%
- datafusion mem pool is set to 20%

closes: https://github.com/influxdata/influxdb/issues/26009
2025-02-20 16:03:30 +00:00
Jamie Strandboge 1d35695951
fix: prefer pip over over uv (#26039)
Official builds build with python build standalone currently only work
with pip. Until https://github.com/influxdata/influxdb/issues/26016 is
decided upon, prefer pip instead of uv.
2025-02-19 13:49:22 -06:00
Jamie Strandboge 42117701c0
fix: properly perform venv activation on windows (#26038) 2025-02-19 10:40:08 -06:00
Jamie Strandboge f5ae1bc64e
fix: detect python runtime for PipManager and venv setup (#26029)
* fix: consider PYTHONHOME when detecting PipManager

* fix: consider VIRTUAL_ENV when setting path to python from venv
2025-02-18 10:58:17 -05:00
Jamie Strandboge ccd5d22aab
feat: build and use python-build-standalone with official builds (#25969)
* feat(ci): fetch and configure for python-build-standalone binaries

* fix: make the process engine usable on windows

* feat(ci): build with python-build-standalone (and drop musl)

* fix(ci): set rpath on Linux and libpath on OSX in ci

* fix: set PYTHONHOME everywhere and PYTHONPATH on Windows

* chore(ci): update to use more recent ci-packager-next

* fix(ci): adjust validate to allow certain dynamically linked libraries

* chore: remove install_influxdb.sh (using install_influxdb3.sh instead)

* chore(install_influxdb3.sh): update for processing engine and release builds

* fix: temporarily use rpm --nodeps until compile with old GLIBC

* feat(ci): build docker with python-build-standalone

* chore: add README_processing_engine.md

* chore: add a few more details to README_processing_engine.md

* fix(ci): use patchelf --set-rpath

Not all patchelf versions support --add-rpath for appending to the
RPATH, but --set-path can be used with a colon-separated list. Use
--set-rpath first for maximum compatibility.

* chore: update README_processing_engine.md for standalone local builds

* fix(Dockerfile): also use patchelf --set-rpath

* chore: update code comment for accuracy

* chore: typos, grammar and formatting change in README_processing_engine.md

* chore: update README_processing_engine.md for Docker arm64 (thanks Jackson)
2025-02-13 16:16:05 -06:00
Jackson Newhouse b0a24220c0
feat(processing_engine): Allow async plugin execution. (#25994) 2025-02-13 09:08:19 -08:00
Trevor Hilton 8548410d67
test: query distinct cache via flight sql (#26014) 2025-02-13 11:13:09 -05:00
Jackson Newhouse fbcb9403c4
feat(processing_engine): log processing engine logging calls to sys events. (#25939) 2025-02-04 15:16:04 -08:00
wayne fa18b6d8da
refactor: DRY up influxdb3_client code (#25962)
* deduplicate QueryParams->QueryRequest and Format->QueryFormat
* move WriteParams into influxdb3_types crate
* DRY up client HTTP request handling code in *RequestBuilder.send
  methods.
* DRY up a bunch of other non-Builder http request handling
2025-02-04 08:54:37 -07:00
wayne 0fffcc8c37
refactor: introduce influxdb3_types crate (#25946)
Partially fixes https://github.com/influxdata/influxdb/issues/24672

* move most HTTP req/resp types into `influxdb3_types` crate
* removes the use of locally-scoped request type structs from the `influxdb3_client` crate
* fix plugin dependency/package install bug
  * it looks like the `DELETE` http method was being used where `POST` was expected for `/api/v3/configure/plugin_environment/install_packages` and `/api/v3/configure/plugin_environment/install_requirements`
2025-02-03 11:28:47 -07:00
Jackson Newhouse d9dd8a32a2
fix(processing_engine): Use the configured request path for Request plugins. (#25945) 2025-01-31 10:36:47 -08:00
Michael Gattozzi b7d2475ea6
chore: move separate cli and server tests (#25934)
This commit restructures our tests to look like Enterprise in their
layout. We break cli.rs into it's own module, combine the server tests
and cli tests under one lib.rs file and handle the changes for
visibility and import paths needed to make things work. the packages
tests have been cfged out as a module so that it would not need to be
added on a per test basis. Note that those tests fail locally for me
currently, but it seems like we weren't testing these in CI at the
moment.

There is no issue for this.
2025-01-31 11:41:44 -05:00
Jackson Newhouse 3a2a830a39
fix: persist create database action. (#25944) 2025-01-30 16:01:41 -08:00
praveen-influx 56ca85ef8e
feat: introduce parquet caching in query path (#25937)
* feat: introduce parquet caching in query path

This commit scans the parquet files that will be used in query to check
if they can be cached. There are three conditions to satisfy,
  - not cached already
  - cache has enough space
  - file times overlap with the cache policy times

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

* refactor: rename env var
2025-01-30 21:16:37 +00:00
wayne 05da40fa9b
fix: clarify table creation conflict error message (#25936)
Also include a basic CLI integration test to exemplify the new error message.
2025-01-30 13:08:35 -07:00
wayne bb92eb0759
feat: add precision flag to write subcommand (#25935)
* feat: add --precision flag to 'influxdb3 write'
* test: add tests to validate 'influxdb write --precision'
2025-01-30 11:08:17 -07:00
wayne 99c9d02baa
feat: add 'show system' subcommand to display system tables (#25912)
test: add 'show system' subcommand tests
2025-01-29 10:44:19 -07:00