Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ versions (0.x) may contain breaking changes; they are always listed under a

### Added

- **Graceful shutdown, Ballista's retry limits, and what losing a worker
does** (#31). `oxide-scheduler` handled no signal: `SIGTERM` killed it
(status 143) with every query it was running. It now refuses new queries
on `SIGTERM` or `SIGINT`, saying it is shutting down, gives the running
ones up to `--drain-timeout` (20 s) to finish, and exits 0.
`oxide-worker` already stopped gracefully through Ballista (no new tasks,
its scheduler runs its tasks elsewhere, then it waits for them) but waited
for ever; `--drain-timeout` now bounds the wait, and it exits 0 either
way. A second signal stops either at once. New scheduler flags
`--task-max-failures` and `--stage-max-failures` (Ballista's retry
limits, 4 and 1) and `--worker-timeout` (seconds a silent worker still
counts, 180), and worker flag `--heartbeat-interval` (60); the defaults
are Ballista's but for `--stage-max-failures`, which is 1 so that a lost
worker fails its queries instead of being retried (#148, under Changed).

- **`operator_stats()` on `GpuFilterExec`, `GpuHashJoinExec`,
`GpuAggregateExec` and `GpuVectorDistanceExec`** returns the counters
that exec instance has reported to its telemetry hub (`None` before it
Expand Down Expand Up @@ -457,6 +472,24 @@ versions (0.x) may contain breaking changes; they are always listed under a
partition coalescing are therefore not available on an OxideLake cluster
until the placement rule can run inside the adaptive planner.

- **A cluster no longer retries a query that loses a worker** (#148).
Ballista 55 recovers such a query by rolling back the stages that read the
lost worker's output and running them again, and in 55.0.0 that recovery
is not safe: a self-join that lost a worker mid-flight came back with 13
or 14 of its 100 groups twice, exit 0, in 12 runs of 15 (fixed upstream by
apache/datafusion-ballista#2677, unreleased), and a worker stopped with
`SIGTERM` mid-query left it hanging (apache/datafusion-ballista#2539,
#2698). `oxide-scheduler` now fails a query that held output on a worker
it loses, whether killed, stopped or silent past `--worker-timeout`, with
an error naming the worker (one killed in the middle of a transfer shows
as a broken shuffle stream instead), and `--stage-max-failures` defaults
to 1, so
a failed fetch from a lost worker ends the query too; a query whose tasks
on that worker had not finished anything still runs them again elsewhere.
**Migration:** a query that used to survive losing a worker now fails;
run it again. To get Ballista's stage retries back, pass
`--stage-max-failures 4`, which brings the bug back with them.

### Fixed

- **Cluster mode returns the right rows for `NOT IN (subquery)`** (#91).
Expand Down Expand Up @@ -672,6 +705,20 @@ versions (0.x) may contain breaking changes; they are always listed under a
current releases no longer pull the unmaintained `pin-utils`
(RUSTSEC-2026-0441).

- **A cluster process refuses to listen beyond a private network**
(#30). The scheduler's and workers' ports have no authentication or
encryption, and `oxide-scheduler --bind-host 0.0.0.0` started without a
word. Now `oxide-scheduler` and `oxide-worker` exit 1 when `--bind-host`
or `--metrics-host` is a public address or every address (`0.0.0.0`,
`::`), naming the risk and the way out: bind a loopback or private address
(10/8, 172.16/12, 192.168/16, fc00::/7), or pass `--allow-insecure-bind`
when a firewall or an authenticating proxy already decides who connects.
Either logs a warning whenever it listens beyond loopback. `oxide-worker
--bind-host` is new: the worker listened on `127.0.0.1` only, so a
scheduler on another machine could not reach it. TLS and authentication
are not built yet; README and SECURITY.md say what a production
deployment must put in front of the ports.

- **Three "unmaintained" notices are accepted, with their reasons**:
`chrono` (RUSTSEC-2026-0543) and `chrono-tz` (RUSTSEC-2026-0555), which
are arrow 59's date/time and timezone support under every DataFusion and
Expand Down
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,14 @@ test-metal: ## Metal package tests and macOS PTY tests with one dependency graph
# named with the prefix for exactly this. `--skip mixed_build` likewise: those
# #[ignore]d cli tests need the other-build workers that only
# `make test-mixed-build` builds (it runs them in CI), and fail loudly without
# them. The conformance suite is what this target is for.
# them. `--skip a_query_that_loses_a_worker_comes_back` too: that #[ignore]d
# cli test is the reproduction of Ballista 55's lost-worker rollback (#148),
# kept to show the bug is still there, so it is expected to fail until a
# Ballista release carries the fix. The conformance suite is what this
# target is for.
test-metal-device: ## reuse the Metal test graph for on-device conformance
@if swift -e 'import Metal; exit(MTLCreateSystemDefaultDevice() == nil ? 1 : 0)' 2>/dev/null; then \
OXIDE_BACKEND=metal $(CARGO) test $(METAL_TEST_ARGS) -- --ignored --skip termlens_cli --skip mixed_build; \
OXIDE_BACKEND=metal $(CARGO) test $(METAL_TEST_ARGS) -- --ignored --skip termlens_cli --skip mixed_build --skip a_query_that_loses_a_worker_comes_back; \
else \
echo "No Metal device on this runner — on-device conformance skipped."; \
fi
Expand Down
19 changes: 17 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ The end-to-end test in `crates/oxidelake-runtime/tests/cli.rs` spawns exactly th

A scheduler admits only workers of its own build: the same OxideLake release, built with `predict` if and only if the scheduler is. `cuda` and `metal` do not count, so a default-build scheduler with `--features cuda` workers is a supported cluster. A worker of another build is refused when it registers and exits non-zero naming both builds, and a query sent to a cluster whose workers were all refused fails at once with the same reason. The check guards against a mismatched deployment, not against an attacker: a worker declares its own build ([SECURITY.md](https://github.com/vyncint/oxidelake/blob/main/SECURITY.md)).

`SIGTERM` or `SIGINT` stops either binary gracefully, and a second signal stops it at once. A scheduler refuses new queries, saying it is shutting down, gives the running ones up to `--drain-timeout` to finish, and exits 0. A worker takes no new tasks and exits 0 once its running ones finish or `--drain-timeout` passes, and a query that held its output fails, naming it (below); keep the timeout under your supervisor's own limit (Kubernetes sends `SIGKILL` 30 s after `SIGTERM` by default). A worker that dies without a word is presumed lost once the scheduler's `--worker-timeout` passes with no heartbeat from it (the worker's `--heartbeat-interval`, which must be well under the timeout). Until then a query holding tasks on it waits, unless a shuffle fetch from it fails first: Ballista retries a fetch three times, three seconds apart, and then the query fails. The scheduler's port serves Ballista's `/healthz` (always `ok`) and `/readyz` (`ready: N executors registered`, or 503 before the first); a worker serves nothing over HTTP except `--metrics-port`.

**Production deployments.** The cluster's ports (the scheduler's one port for gRPC, REST and probes, each worker's Flight and gRPC ports, and any `--metrics-port`) have no authentication and no encryption: whoever can connect can run queries, and a query can read any file a worker can read. Keep them on a network that only the cluster's own hosts and trusted clients can reach, such as a private subnet or a VPN, behind a firewall. `oxide-scheduler` and `oxide-worker` refuse to listen on a public address, or on every address (`0.0.0.0`, `::`), unless `--allow-insecure-bind` says that something else, such as that firewall, already decides who can connect, and they log a warning whenever they listen beyond loopback. TLS and authentication in OxideLake itself are tracked in #30.

**A query that loses a worker fails, naming it** ([#148](https://github.com/vyncint/oxidelake/issues/148)). Ballista 55 would recover such a query by rolling back every stage that read the lost worker's output and running it again, and that recovery is not safe: the rolled-back stage keeps its partial outputs, so in our runs most such queries came back with some groups twice, with exit 0 (fixed upstream by [apache/datafusion-ballista#2677](https://github.com/apache/datafusion-ballista/pull/2677), merged after 55.0.0 and not yet released), and the tasks it cancels never return their slots, so a query can wait for capacity that does not come back (see [apache/datafusion-ballista#2539](https://github.com/apache/datafusion-ballista/issues/2539) and [#2698](https://github.com/apache/datafusion-ballista/issues/2698)). So `oxide-scheduler` fails any query that held output on a worker it loses, killed, stopped with `SIGTERM`, or silent past `--worker-timeout`, and `--stage-max-failures` defaults to 1, so a failed fetch from a lost worker ends the query too. The error names the worker, unless the worker was killed in the middle of sending shuffle data, which Ballista reports as a broken stream that fails the query just as cleanly; either way, run the query again. A query whose tasks on the lost worker had not finished anything is not failed: those tasks run again elsewhere. Raising `--stage-max-failures` brings Ballista's stage retries back, with the bug.

### DataFrame API

```rust
Expand Down Expand Up @@ -197,22 +203,31 @@ error, never a silent fallback.

| Knob | Default | What it does |
| --- | --- | --- |
| `--bind-host` | `127.0.0.1` | Address to bind. |
| `--bind-host` | `127.0.0.1` | Address to bind: loopback or private (10/8, 172.16/12, 192.168/16, fc00::/7). A public address or every address (`0.0.0.0`, `::`) is refused without `--allow-insecure-bind`, because the port is unauthenticated. |
| `--allow-insecure-bind` | off | Accepts a public or wildcard `--bind-host`/`--metrics-host`. Only when a firewall or an authenticating proxy already decides who can connect ([Production deployments](#cluster-mode)). |
| `--port` | `50050` | gRPC port. |
| `--cluster-backend` | `$OXIDE_CLUSTER_BACKEND`, then `cpu` | The capability the cluster declares, which is what placement rewrites against. |
| `--metrics-port` / `--metrics-host` | off / `127.0.0.1` | As for the worker. A scheduler plans but does not execute, so its counters are empty; the endpoint exists so every process is scraped the same way. |
| `--task-max-failures` | `4` | Times one task may fail before its query fails; `1` means no retry. A task lost with its worker runs again elsewhere without counting. Ballista's `task_max_failures`. |
| `--stage-max-failures` | `1` | Times a stage may fail because a shuffle fetch failed, its input lost with a worker, before its query fails. The default ends the query at the first such failure, naming the worker; a worker that is stopped or goes silent fails its queries whatever this says ([#148](https://github.com/vyncint/oxidelake/issues/148), [Cluster mode](#cluster-mode)). Raising it turns on Ballista 55's re-run of the stage, which can return duplicated rows with exit 0 or never finish. Ballista's `stage_max_failures`, whose own default is 4. |
| `--worker-timeout` | `180` | Seconds without a heartbeat before a worker is presumed lost and its tasks run elsewhere. A query holding tasks on a dead worker waits this long. |
| `--drain-timeout` | `20` | On `SIGTERM`/`SIGINT`, new queries are refused and the running ones get this many seconds to finish; then the scheduler exits 0. |

### `oxide-worker`

| Knob | Default | What it does |
| --- | --- | --- |
| `--scheduler-host` / `--scheduler-port` | `localhost` / `50050` | The scheduler to join. |
| `--bind-host` | `127.0.0.1` | Address the Flight and gRPC ports bind, under the scheduler's rule: loopback or private, anything else only with `--allow-insecure-bind`. The scheduler connects back to the address it sees the worker connect from, so bind the interface that faces it. |
| `--allow-insecure-bind` | off | As for the scheduler. |
| `--port` | `50051` | Arrow Flight port for shuffle data. |
| `--grpc-port` | `50052` | gRPC control port. |
| `--concurrent-tasks` | available parallelism | Tasks run at once. |
| `--work-dir` | a temporary directory | Where shuffle files go. |
| `--metrics-port` / `--metrics-host` | off / `127.0.0.1` | Serve Prometheus metrics at `/metrics` (needs `--features metrics`). Unauthenticated: bind it on a private interface. Without the feature the flag is refused, never ignored. |
| `--metrics-port` / `--metrics-host` | off / `127.0.0.1` | Serve Prometheus metrics at `/metrics` (needs `--features metrics`). Unauthenticated, so `--metrics-host` follows the `--bind-host` rule. Without the feature the flag is refused, never ignored. |
| `--backend` | `$OXIDE_BACKEND`, then detected | The backend this worker executes on. Selected before the first task, so it reaches the operators; a backend the machine cannot provide is a startup error. |
| `--heartbeat-interval` | `60` | Seconds between heartbeats to the scheduler; keep it well under the scheduler's `--worker-timeout`. |
| `--drain-timeout` | `20` | On `SIGTERM`/`SIGINT`, no new tasks are taken (the scheduler runs this worker's tasks elsewhere) and the running ones get this many seconds to finish; then the worker exits 0. |

### Environment

Expand Down
22 changes: 16 additions & 6 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,22 @@ OxideLake is an analytical engine intended to run **on infrastructure you
control**. Its security boundary is the machine or private network it runs on,
not the query interface.

- **Cluster mode has no authentication or transport encryption in v1.**
`oxide-scheduler` and `oxide-worker` speak plain gRPC and Arrow Flight and
will execute any plan a connected client submits, including reading any file
the worker process can read. Both bind to `127.0.0.1` by default; expose them
only on a trusted private network (or behind a mutually authenticated
proxy). TLS/auth is tracked as out of scope for v1 in `STATUS.md`.
- **Cluster mode has no authentication or transport encryption yet, so the
network is the boundary, and the binaries hold it.** `oxide-scheduler` and
`oxide-worker` speak plain gRPC and Arrow Flight and will execute any plan
a connected client submits, including reading any file the worker process
can read. Both bind to `127.0.0.1` by default, accept a private address,
and refuse a public one, or every address at once, unless
`--allow-insecure-bind` is given (#30).

**Production deployments.** The cluster's ports (the scheduler's one port for gRPC, REST and probes, each worker's Flight and gRPC ports, and any `--metrics-port`) have no authentication and no encryption: whoever can connect can run queries, and a query can read any file a worker can read. Keep them on a network that only the cluster's own hosts and trusted clients can reach, such as a private subnet or a VPN, behind a firewall. `oxide-scheduler` and `oxide-worker` refuse to listen on a public address, or on every address (`0.0.0.0`, `::`), unless `--allow-insecure-bind` says that something else, such as that firewall, already decides who can connect, and they log a warning whenever they listen beyond loopback. TLS and authentication in OxideLake itself are tracked in #30.

- **A lost worker fails its queries rather than risk wrong rows (#148).**
Ballista 55's recovery from a lost worker can return duplicated rows with
exit 0 (fixed upstream by apache/datafusion-ballista#2677, unreleased), so
`oxide-scheduler` fails a query that held output on a worker it loses, and
`--stage-max-failures` defaults to 1. Raising that limit turns Ballista's
stage retries, and the bug, back on.
- **Workers trust their scheduler.** Physical plans arrive over the network and
are decoded by `OxidePhysicalCodec`. Payloads are validated (magic, version,
column indices, types, dimensions, a cap on predicate size) so a malformed
Expand Down
Loading
Loading