You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit cfd3e48
Browse filesBrowse the repository at this point in the historyBrowse files
The ordinary `database_worker/package.test` uses a tiny executable wrapper so
98
+
the default regression stays fast. The explicit heavyweight target builds and
99
+
packages three real workers, then restores and executes each one through
100
+
`database://`: a PyInstaller-frozen Python/PyArrow worker, Bun's standalone
101
+
build of `~/Development/vgi-open-meteo`, and a `.tar.gz` containing the native
102
+
Rust example worker plus a metadata file. It expects the sibling vgi-python,
103
+
vgi-open-meteo, and vgi-rust repositories and the `uv`, `bun`, `cargo`, and
104
+
`tar` tools. Repository paths and cross-build targets are overrideable; see
105
+
`docs/database-worker-transport.md`. The target finishes with a two-process
106
+
restart test: one DuckDB process persists all three BLOBs, then a fresh process
107
+
with an empty cache reopens that registry and executes every worker.
108
+
95
109
### HTTP Transport
96
110
97
111
```bash
@@ -1041,6 +1055,12 @@ transport in `src/query_farm_telemetry.cpp`. Full field reference: [docs/telemet
1041
1055
|`vgi_trust_empty_kinds`| BOOLEAN | true | Trust worker assertions that `estimated_object_count[kind] == 0` means the kind is empty (skip `catalog_schema_contents_*` RPC). Set to false to force every RPC to fire — debug escape hatch for diagnosing worker bugs |
1042
1056
|`vgi_secret_default_ttl_seconds`| BIGINT | 300 | Default cache TTL for credentials fetched from an Orchard remote secret provider, when the server suggests none. Further capped per-credential by the credential's own expiry. Read at `ATTACH`, frozen per-provider. See *Remote Secret Provider*|
1043
1057
|`vgi_github_cache_dir`| VARCHAR |`""`| Cache directory for worker binaries downloaded from GitHub releases (`github://` / `github-auto://`). Empty → `${XDG_CACHE_HOME:-~/.cache}/vgi/releases`. Must be on an exec-capable filesystem. See [docs/github-transport.md](docs/github-transport.md)|
1058
+
|`vgi_worker_cache_dir`| VARCHAR |`""`| Cache directory for immutable `database://` worker packages. Empty follows `vgi_github_cache_dir`, then `${XDG_CACHE_HOME:-~/.cache}/vgi/releases`. Must be exec-capable. See [docs/database-worker-transport.md](docs/database-worker-transport.md)|
|`vgi_worker_cache_ttl_seconds`| UBIGINT | 2592000 (30 days) | Evict database-worker artifacts unused for this long; 0 disables TTL eviction. Catalogs and running/pooled workers hold cross-process leases and cannot be evicted. |
1061
+
|`vgi_worker_package_max_bytes`| UBIGINT | 536870912 (512 MiB) | Maximum stored/compressed `contents` BLOB accepted from a package table. |
1062
+
|`vgi_worker_package_max_extracted_bytes`| UBIGINT | 1073741824 (1 GiB) | Maximum decompressed size accepted while installing a database worker package. |
1063
+
|`vgi_worker_package_max_files`| UBIGINT | 10000 | Maximum archive entries accepted while installing a database worker package. |
1044
1064
|`vgi_result_cache`| BOOLEAN | true | Master switch for the **table-function result cache**. When a worker advertises `vgi.cache.*` metadata on its result's first batch, the complete result is cached and identical future scans are served without the worker round-trip. Double-gated: only advertised results are stored, and a catalog opts out via the `cache` ATTACH option |
1045
1065
|`vgi_result_cache_max_bytes`| UBIGINT | 268435456 (256 MB) | Global byte cap for the in-memory result cache (LRU eviction above it). Read per-query, so `SET` is runtime-effective |
1046
1066
|`vgi_result_cache_max_entry_bytes`| UBIGINT | 67108864 (64 MB) | Per-entry RAM cap: capture buffers up to this in RAM, then — if the disk tier is on (`vgi_result_cache_dir`+`disk_max_bytes`) — **spills the rest to a streaming disk blob** (RAM stays flat at ~this cap, result cached to disk); if the disk tier is **off**, capture aborts and the result streams uncached (`result_cache.abort reason=entry_too_large`). Also the serve threshold: a disk entry larger than this is served by streaming (never materialized), smaller ones are materialized + adopted into memory. See *Spill-to-disk capture*|
@@ -1097,6 +1117,7 @@ Catalogs may register additional settings at `ATTACH` time (e.g., `greeting`, `m
1097
1117
-`launch:<argv>` → **AF_UNIX** transport with the worker spawned via the launcher
1098
1118
-`oci://<image>[:tag]` (or `docker://` alias) → **container** transport: the worker runs inside an OCI container via the host runtime (docker/podman/nerdctl/Apple `container`), wired over stdin/stdout like a subprocess and pooled the same way. See [docs/container-transport.md](docs/container-transport.md)
1099
1119
- `github://owner/repo@tag/asset[#sha256=][#path=]` and `github-auto://owner/repo@tag[/prefix]` → **GitHub-release** transport (any subprocess-capable platform — POSIX **and** Windows; not Emscripten): download a worker executable from a GitHub release, SHA256-verify it, extract the full archive (`.tar.gz`/`.tar.zst`/`.zst`/`.gz`/bare via in-process Decompress; `.zip` via vendored miniz) into `${XDG_CACHE_HOME:-~/.cache}/vgi/releases`, and run it over the subprocess transport. All file I/O goes through DuckDB's cross-platform `FileSystem` (cross-process write-lock + atomic dir install); only the exec bit (`chmod`), tar symlinks, and macOS codesign stay POSIX. `github://` names the asset explicitly (+ optional `#sha256=` pin, enforced even on cache hit); `github-auto://` builds `{prefix=repo}-{tag}-{DuckDB-platform}.tar.gz` (`.zip` on Windows) and verifies against the published `.sha256` sidecar. Entrypoint = the single exec-bit member (tar) / single `.exe` (zip), or `#path=`. A DX convenience (overlaps `oci://`); SHA256-only (cosign provenance deferred); no allowlist; cwd inherited (publisher builds relocatable). See [docs/github-transport.md](docs/github-transport.md)
1120
+
-`database://catalog/schema/table/worker?package_version=version[#sha256=digest]` → **database-package resolver** (native subprocess platforms): query one committed row matching worker/platform/version through a dedicated DuckDB connection, verify the `contents` BLOB's SHA-256, safely extract/copy it into the shared immutable worker cache, then directly execute its entrypoint over the subprocess transport. Identifiers are quoted and row keys bound; URI components are percent-decoded. The content/format/entrypoint-keyed cache uses cross-process shared leases held by catalogs and running/pooled workers, so TTL/LRU/explicit cleanup cannot remove live code. `vgi_worker_package(...)` packages a file with `read_blob()` + `pragma_platform()`. See [docs/database-worker-transport.md](docs/database-worker-transport.md)
1100
1121
- `worker:<url>` → **in-browser SAB** transport (Emscripten/DuckDB-WASM only): the worker runs client-side in a Web Worker, exchanging Arrow batches over a SharedArrayBuffer duplex-ring channel in DuckDB's linear memory — **no server**. Reuses the subprocess `FunctionConnection` streaming paths (only the byte transport changes: `Atomics`-blocked SAB rings vs an OS pipe). Parallel scans work (`max_workers>1` → one serve pthread per slot; browser E2E proves `maxConcurrency=4`). Two emscripten-pthread footguns are load-bearing — JS ring stubs must read `wasmMemory.buffer` (not the stale cached `Module.HEAPU8` view) and re-publish the per-realm channel offset before each ring op — else intermittent scheduler-dependent hangs. Files: `src/vgi_webworker_function_connection.cpp`, `src/vgi_sab_stream.cpp`, `src/include/vgi_sab_abi.hpp`; host glue in `haybarn-wasm` (`lib/js-stubs.js` + `vgi-webworker-bridge.ts`); worker via `vgi-rust`. See [docs/wasm-worker-transport.md](docs/wasm-worker-transport.md) + [docs/sab_transport_abi.md](docs/sab_transport_abi.md)
1101
1122
1102
1123
The `launch:` and `unix://` paths share one warm worker process across every DuckDB instance that points at the same `(cmd, args, cwd, VGI_RPC_*-env)` tuple — coordinated system-wide via per-hash flock + AF_UNIX socket. See `docs/launcher-protocol.md` for the wire-protocol contract (state-dir layout, hash inputs, lockfile semantics) shared with the Python reference launcher in `vgi-rpc/vgi_rpc/launcher.py`.
@@ -1113,6 +1134,10 @@ The `launch:` and `unix://` paths share one warm worker process across every Duc
1113
1134
|`vgi_worker_pool_flush()`| Table | Clear all subprocess-pooled workers; returns one row with the count flushed (`flushed`). Has no effect on `launch:` / `unix://` workers. |
1114
1135
|`vgi_github_cache()`| Table | Diagnostic: one row per worker binary cached from a `github://` / `github-auto://` release LOCATION. Columns: `owner`, `repo`, `tag`, `asset`, `digest` (archive SHA256), `dir` (extracted directory), `entrypoint`, `age_seconds`. See [docs/github-transport.md](docs/github-transport.md)|
1115
1136
|`vgi_github_cache_flush()`| Table | Delete the on-disk GitHub-release worker cache; returns one row with the count of cached releases removed (`flushed`). |
1137
+
|`vgi_worker_package(path, worker_name, package_version, package_format := 'auto', entrypoint := NULL, platform := NULL)`| Table macro | Produce one canonical package-table row using `read_blob()` and `pragma_platform()`, including SHA-256 and `created_at`. Archives require an entrypoint. See [docs/database-worker-transport.md](docs/database-worker-transport.md)|
1138
+
|`vgi_worker_cache()`| Table | List database worker artifacts: identity/source/digest/format/entrypoint/directory, size, unused age, and whether a cross-process lease is active. |
|`vgi_worker_cache_flush()`| Table | Attempt to remove all database-worker artifacts. Lease-protected artifacts are retained and counted in `skipped_in_use`. |
1116
1141
|`vgi_clear_cache()`| Table | Clear cached catalog metadata (schemas, tables, functions, statistics) for all attached VGI catalogs. Also drops that catalog's **result-cache** entries |
1117
1142
|`vgi_result_cache(include_disk := false)`| Table | Diagnostic: one row per cached table-function result. Columns: `catalog`, `function`, `key_hash`, `scope`, `attached_data_version`, `implementation_version`, `catalog_version`, `at_unit`, `at_value`, `num_batches`, `num_substreams` (capture-thread count — `> 1` proves parallel capture across workers), `num_rows`, `total_bytes`, `age_seconds`, `ttl_seconds`, `stale`, `tier` (`memory`/`disk`), `etag`, `last_modified`, `revalidatable`, `hits`, `codec` (on-disk compression codec `none`/`zstd`/`lz4`; always `none` for memory-tier rows), `partition_label` (per-partition entry's tuple, e.g. `country=US`; empty for non-partition entries — see *Per-Partition Result Cache*). Defaults to the **in-memory** tier; `include_disk := true` also walks the on-disk refs so **spilled/disk-only** entries (invisible to the memory index until adopted) are listed with `tier='disk'`. See *Table-Function Result Cache*|
1118
1143
|`vgi_result_cache_flush()`| Table | Clear the in-memory result cache; returns one row with the count of entries flushed (`flushed`) |
@@ -1147,6 +1172,8 @@ The `launch:` and `unix://` paths share one warm worker process across every Duc
1147
1172
|`vgi_worker_pool_functions.cpp`| Pool diagnostic SQL functions |
1148
1173
|`vgi_github.cpp`|`github://` / `github-auto://` transport (subprocess-capable platforms incl. Windows): coordinate parsing, `github-auto://` convention name-building from `DuckDB::Platform()` (`.zip` on Windows, `.tar.gz` else), authenticated GitHub API GET (+ reuse of `HttpGetBytes` for CDN downloads), SHA256 verify-before-extract, full-tree USTAR + miniz `.zip` extractors with path sanitization, and the content-digest-keyed atomic-directory cache. File I/O via DuckDB's cross-platform `FileSystem` (`CreateLocal()`; cross-process write-lock); only `chmod`/tar-symlink/macOS-codesign stay POSIX (`#if VGI_POSIX_TRANSPORT`). Exposes `ResolveWorkerPath()` (called at both spawn sites: `EnsureWorkerSpawned` + `AttemptUnaryRpc`). See [docs/github-transport.md](docs/github-transport.md)|
0 commit comments