Commit Graph

185 Commits (docker_plugin_improvements)

Author SHA1 Message Date
Jackson Newhouse 901234538c feat(processing_engine): improve package management for standalone python. 2025-02-20 09:18:27 -08: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
Jackson Newhouse 8840d99e9d
feat(processing_engine): integration with virtual environments. (#25895)
* feat(processing_engine): integration with virtual environments.

* feat: Initial scaffolding for environment managers (pip, pipx, uv).

* feat(processing_engine): CLI for package management, remove pipx support.

* feat(processing_engine): test installations in virtualenvs.

* feat(processing_engine): Automatically setup virtual environment on startup.
2025-01-28 15:30:17 -08:00
Paul Dix 9a5424693c
feat: Update trigger creation to validate plugin file present (#25918)
This updates trigger creation to load the plugin file before creating the trigger.

Another small change is to make Github references use filenames and paths identical to what they would be in the plugin-dir. This makes it a little easier to have the plugins repo local and develop against it and then be able to reference the same file later with gh: once it's up on the repo.
2025-01-27 12:31:49 -05:00
Paul Dix d49276a7fb
feat: Refactor plugins to only require creating trigger (#25914)
This refactors plugins and triggers so that plugins no longer need to be "created". Since plugins exist in either the configured local directory or on the Github repo, a user now only needs to create a trigger and reference the plugin filename.

Closes #25876
2025-01-27 11:26:46 -05:00
Michael Gattozzi 43e186d761
feat: add no_sync write_lp param for fast writes (#25902) 2025-01-24 13:34:38 -05:00
Michael Gattozzi 061b62a09b
feat(cli): write & query via stdin, string & file (#25907)
This change allows *both* the write and query commands to accept input
via stdin, string, or by a file. With this change larger queries are more
feasible to write as they can now be written in a file and smaller
writes via a string are now possible. This also makes the program work
more like people would expect it to, especially on unix based systems.

This commit also contains three tests to make sure the functionality works
as expected.

Closes #25772
Closes #25892
2025-01-24 10:02:44 -05:00
praveen-influx 4ef972eab4
feat: first stab at locally updating parquet cache (#25904)
* feat: first stab at locally updating parquet cache

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

* refactor: use enums to separate out the modes

This commit introduced the `Immediate` and `Eventual` modes for
fulfilling the cache request. In immediate mode since the data is
readily available to be cached, we can avoid extra requests to object
store.

part of: https://github.com/influxdata/influxdb/issues/25887
2025-01-24 14:36:06 +00:00
Trevor Hilton d451ef0de6
refactor: writer-id to node-id (#25905) 2025-01-23 18:09:24 -05:00
Michael Gattozzi 63bd5096f5
feat: loosen 72 hour query/write restriction (#25890)
This commit does a few key things:

- Removes the 72 hour query and write restrictions in Core
- Limits the queries to a default number of parquet files. We chose 432
  as this is about 72 hours using default settings for the gen1
  timeblock
- The file limit can be increased, but the help text and error message
  when exceeded note that query performance will likely be degraded as
  a result.
- We warn users to use smaller time ranges if possible if they hit this
  query error

With this we eliminate the hard restriction we have in place, but
instead create a soft one that users can choose to take the performance
hit with. If they can't take that hit then it's recomended that they
upgrade to Enterprise which has the compactor built in to make
performant historical queries.
2025-01-23 10:02:26 -05:00
Paul Dix f3efa35670
feat: reloads plugins if modified (#25865)
This updates plugins so that they will reload the code if the local file is modified. Github pugins continue to be loaded only once when they are initially created or loaded on startup.

This will make iterating on plugin development locally much easier.

Closes #25863
2025-01-22 06:21:07 -08:00
Paul Dix e87f8862b3
feat: Add request plugin capability (#25864)
* feat: Add request plugin capability

Adds the request plugin type. Triggers can be bound to an API endpoint at /api/v3/engine/<path>. Requests will get yielded to the plugin with the query parameters, request parameters, and request body.

I didn't implement the test endpoint for this plugin type as it seems much more natural for users to save the file and make a new request. Once #25863 is done it'll make it very easy.

Closes #25862

* chore: fix spelling in error message
2025-01-21 20:22:27 -08:00
praveen-influx d39a4a2f21
feat: rename json_lines to jsonl for cli (#25888)
closes: https://github.com/influxdata/influxdb/issues/25873
2025-01-21 17:32:55 +00:00
praveen-influx 447f66d9a7
fix: allow default browser header (#25885)
Although the `format` in the request is used, the value coming
through the header is parsed earlier. So, when that lookup in
the header fails an error is returned (`InvalidMimeType`).

In this commit, there are extra checks to allow the default `Accept`
header values that come from the browser by defaulting it to `json`

closes: https://github.com/influxdata/influxdb/issues/25874
2025-01-21 13:43:07 +00:00
Jackson Newhouse 1d8d3d66fc
feat(processing_engine): Add cron plugins and triggers to the processing engine. (#25852)
* feat(processing_engine): Add cron plugins and triggers to the processing engine.

* feat(processing_engine): switch from 'cron plugin' to 'schedule plugin', use TimeProvider.

* feat(processing_engine): add test for test scheduled plugin.
2025-01-18 07:18:18 -05:00
wayne d800d8e368
feat: add flags to control telemetry behaviors (#25849)
* feat: add hidden CLI option to disable sending telemetry
* feat: --telemetry-host option to facilitate CLI testing
* test: validate telemetry flags via stdout in CLI tests
* chore: remove explicit predicates dependency
2025-01-17 18:18:21 -07:00
Paul Dix b39b48a2cf
feat: load plugins from our github plugin repo (#25861)
Adds the ability to load a plugin from our public github repo here: https://github.com/influxdata/influxdb3_pluginshttps://github.com/influxdata/influxdb3_plugins

If the plugin filename is specified as `gh:examples/wal_plugin` it will pull from the github repo at `<dir>/<name>/<name>.py`.

Closes #25836
2025-01-17 15:44:42 -05:00
Jackson Newhouse 244ac567a8
fix(processing_engine): start triggers when server is started. (#25848) 2025-01-16 16:39:42 -08:00
Paul Dix eb0b1eb8c6
feat: improve plugin logging interface (#25851)
* feat: improve plugin logging interface

Updates the plugin log functions so they can take any number of Python objects which will be converted into a single log line string.

Closes #25847

* refactor: udpate on PR feedback
2025-01-16 18:02:14 -05:00
Paul Dix daa5cbd270
feat: better plugin errors for query and line building (#25850) 2025-01-16 16:57:30 -05:00
Paul Dix 1f71750bfe
feat: return better plugin execution errors (#25842)
* feat: return better plugin execution errors

This sets up the framework for fleshing out more useful plugin execution errors that get returned to the user during testing. We'll also want to capture these for logging in system tables.

Also fixes a test that was broken in previous commit on time limits. Didn't show up because of the feature flag.

* fix: compile errors without system-py feature
2025-01-16 15:58:05 -05:00
Trevor Hilton b8a94488b5
feat: support v1 query API GROUP BY semantics (#25845)
This updates the v1 /query API hanlder to handle InfluxDB v1's unique
query response structure when GROUP BY clauses are provided.

The distinction is in the addition of a "tags" field to the emitted series
data that contains a map of the GROUP BY tags along with their distinct
values associated with the data in the "values" field.

This required splitting the QueryExecutor into two query paths for InfluxQL
and SQL, as this allowed for handling InfluxQL query parsing in advance
of query planning.

A set of snapshot tests were added to check that it all works.
2025-01-16 11:59:01 -05:00
Jamie Strandboge caeabcf52e
chore: use an unusable url instead of localhost for token create (#25830) 2025-01-13 16:59:10 -05:00
Michael Gattozzi aa8a8c560d
feat: Set 72 hour query/write limit for Core (#25810)
This commit sets InfluxDB 3 Core to have a 72 hour limit for queries and
writes. What this means is that writes that contain historical data
older than 72 hours will be rejected and queries will filter out data
older than 72 hours. Core is intended to be a recent timeseries database
and performance over data older than 72 hours will degrade without a
garbage collector, a core feature of InfluxDB 3 Enterprise. InfluxDB 3
Enterprise does not have this write or query limit in place.

Note that this does *not* mean older data is deleted. Older data is
still accessible in object storage as Parquet files that can still be
used in other services and analyzed with dataframe libraries like pandas
and polars.

This commit does a few things:
- Uses timestamps in the year 2065 for tests as these should not break
  for longer than many of us will be working in our lifetimes. This is
  only needed for the integration tests as other tests use the
  MockProvider for time.
- Filters the buffer and persisted files to only show data newer than
  3 days ago
- Fixes the integration tests to work with the fact that writes older
  than 3 days are rejected
2025-01-12 13:08:01 -05:00
Trevor Hilton db24a62658
refactor: change host-id to writer-id (#25804)
This changes the CLI arg `host-id` to `writer-id` to more accurately
indicate meaning.

This changes also goes through the codebase and changes struct fields,
methods, and variables to use the term `writer_id` or `writer_identifier_prefix`
instead of `host_id` etc., to make the meaning clear in the code.

This also changes the catalog serialization to use the field `writer_id`
instead of `host_id`, which is breaking change.
2025-01-12 11:40:47 -05:00
Paul Dix 491a37b0d4
feat: Update create plugin to use server file (#25803)
This updates the create plugin API and CLI so that it doesn't take the pugin code, but instead takes a file name of a file that must be in the plugin-dir of the server. It returns an error if the plugin-dir is not configured or if the file isn't there.

Also updates the WAL and catalog so that it doesn't store the plugin code directly. The code is read from disk one time when the plugin runs.

Closes #25797
2025-01-11 21:02:51 -05:00
praveen-influx 50963443a4
feat: introduce num wal files to keep (#25801)
* feat: introduce num wal files to keep

This commit allows a configurable number of wal files to be left behind
in OS. This is necessary as enterprise replicas rely on these files.

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

* refactor: address PR feedback

* refactor: address PR comment
2025-01-12 00:33:13 +00:00
Paul Dix ebf78aa6c9
feat: Updates to plugin API (#25799)
* Add uint64_field to LineBuilder
* Add bool_field to LineBuilder
* Change query_rows to query in Python API
* Update error output for test wal_plugin
2025-01-11 18:03:34 -05:00
Paul Dix bdcdb4f296
refactor: rename plugin activate/deactivate to enable/disable (#25793)
Closes #25789
2025-01-11 13:40:24 -05:00
Paul Dix e8422a240a
feat: Wire up arguments to wal plugin trigger (#25783)
This allows the user to specify arguments that will be passed to each execution of a wal plugin trigger. The CLI test was updated to check this end to end.

Closes #25655
2025-01-10 16:58:18 -05:00
praveen-influx 15de3863f3
feat: use custom domain name for telemetry (#25782)
closes: https://github.com/influxdata/influxdb3_hub/issues/5
2025-01-10 19:53:04 +00:00
Paul Dix 0da0785960
feat: Finish wiring up WAL plugin with trigger (#25781)
This updates the WAL so that it can have new file notifiers added that will get updated when the wal flushes. The processing engine now implements the WALNotifier trait.

I've updated the CLI test for creating a trigger to run and end-to-end test that defines a plugin, creates a trigger, writes data into the database, triggering the plugin, which writes summary statistics back into the database in a different table. The test queries the destination table to confirm that the plugin worked.
2025-01-10 12:56:49 -05:00
Trevor Hilton c71dafc313
refactor: rename metadata cache to distinct value cache (#25775) 2025-01-10 08:48:51 -05:00
Paul Dix 7230148b58
feat: Update WAL plugin for new structure (#25777)
* feat: Update WAL plugin for new structure

This ended up being a very large change set. In order to get around circular dependencies, the processing engine had to be moved into its own crate, which I think is ultimately much cleaner.

Unfortunately, this required changing a ton of things. There's more testing and things to add on to this, but I think it's important to get this through and build on it.

Importantly, the processing engine no longer resides inside the write buffer. Instead, it is attached to the HTTP server. It is now able to take a query executor, write buffer, and WAL so that the full range of functionality of the server can be exposed to the plugin API.

There are a bunch of system-py feature flags littered everywhere, which I'm hoping we can remove soon.

* refactor: PR feedback
2025-01-10 05:52:33 -05:00