Skip to content

v2.1.7#289

Merged
singaraiona merged 4 commits into
masterfrom
dev
Jun 24, 2026
Merged

v2.1.7#289
singaraiona merged 4 commits into
masterfrom
dev

Conversation

@singaraiona

Copy link
Copy Markdown
Collaborator

No description provided.

… partition

Three reported follow-up bugs:

1. `within` in a WHERE clause only accepted a constant vector literal.
   `(within sn (list lo hi))` / `(enlist lo hi)` — the natural way to use
   variable bounds — fell through to a domain error. The DAG lowering now
   also decomposes a 2-element `(list …)` / `(enlist …)` constructor at the
   AST level, compiling each bound expression individually, so runtime /
   variable bounds work. (`[lo hi]` stays a symbol-vector literal by design.)

2. `first`/`last` over an I64/F64 vector return a single-use lazy handle
   (AGG_VEC_VIA_DAG → ray_lazy_wrap). A lazy bound to a variable and read
   twice broke on the second read with `nyi`, because materialization
   consumes the deferred graph — e.g. `(let v (first xs)) (if (> v 0) v 0)`
   inside a compiled lambda. The interpreter's ray_let_fn already
   materializes at bind; the compiled paths did not. Fix, mirroring that
   invariant ("a bound local holds a concrete value"):
     - compiled `let` emits a new OP_FORCE before storing, materializing
       the value before it is duplicated/aliased;
     - OP_LOADENV materializes a lazy local on first read and stores the
       concrete back, covering lambda PARAMETERS (not forced at bind).
   first/last semantics (incl. null-skipping) are unchanged.

3. `.db.parted.tables` listed the table names from the FIRST (oldest)
   partition, so a table added in a later partition was invisible. It now
   reads the LAST (most recent) partition — partition dirs sort ascending —
   and guards against an empty partition set.

Tests: where_within (list/enlist variable bounds), agg/first & agg/last
(lazy reuse via let and via lambda param), db_get (last-partition table
discovery).
…v4 server

`(.ipc.open "localhost:PORT")` failed with "connection refused" while
`127.0.0.1:PORT` worked.  ray_sock_connect only attempted the FIRST
getaddrinfo result; `localhost` commonly resolves to ::1 (IPv6) first, and
the server binds IPv4-only (ray_sock_listen uses AF_INET), so the ::1
attempt is refused and the connect gave up instead of falling through to
127.0.0.1.

Iterate over every resolved address, creating a socket per candidate and
returning the first that connects (the standard getaddrinfo connect loop);
the last failure's errno is preserved so a genuine refused/timeout still
surfaces correctly.  The per-address connect logic (timeout-bounded
non-blocking or plain blocking) is factored into sock_connect_one.

Test: ipc_open_timeout opens "localhost:19998" against the IPv4 server and
round-trips a query.
…tions

`(.db.parted.fill "db_root")` ensures every partition of a parted db has
every table that appears in any partition: a partition missing a table gets
an EMPTY copy whose schema is taken from the most recent partition that has
it.  This keeps select-across-partitions from failing on a partition where a
table is absent (e.g. a table added partway through the db's life, or a
partition written before that table existed).

Returns a sorted SYM vector of the partition names that were filled (empty
when nothing needed fixing, so a repeat call is a no-op).  Registered
RESTRICTED since it writes to disk.

Implementation (src/store/part.c): factor the per-partition table-dir
enumeration out of ray_parted_tables into collect_table_dirs; ray_parted_fill
builds the union of table names across partitions, and for each table writes
an empty clone (built from the template partition's schema via
empty_table_like) into every partition lacking it, sharing the root .sym.

Tests: db_parted_fill (fill, idempotency, empty-copy row counts, error
paths); reserved_namespace updated for the new .db.parted entry.  Docs:
namespaces/db.md.
@singaraiona singaraiona merged commit 478f63b into master Jun 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant