Expand description
Postgres-backed persistence for DDL-defined view definitions
(lakehouse_view_set_definitions).
Postgres-backed persistence for lakehouse_view_set_definitions.
[ViewDefinitionStore] is reduced to the single pool-backed [ViewDefinitionStore::list]
method [super::view_registry::ViewRegistry::reload] needs – its only implementors are
[PgViewDefinitionStore] and a test fake. The DDL executor
(rust/public/src/servers/view_ddl.rs) instead calls the free functions below directly,
against its own open sqlx::Transaction, so a CREATE/DROP’s existence check, upsert/delete
and dependent-protection re-read all run inside one transaction, alongside retire_partitions
on a DROP – with no trait indirection for methods a test fake could never implement.
Structs§
- PgView
Definition Store - The production, pool-backed implementation.
- View
Definition Row - One row of
lakehouse_view_set_definitions, exactly as read back.view_optionsis kept as its raw JSON text here (parsed into aViewOptionsonly byViewDefinitionRow::into_definition) so a row that fails to parse can still be reported by name rather than losing its identity.
Traits§
- View
Definition Store - The rows-in seam
super::view_registry::ViewRegistry::reloadneeds: every definition currently in force, ordered by(update_group, view_set_name)– the ordersuper::view_registry::build_factoryrelies on regardless of which caller fed it the rows.
Functions§
- delete_
tx - Deletes a row by name;
trueif a row was actually deleted. - list_tx
- The transaction-scoped counterpart of
ViewDefinitionStore::list, for a caller (the DDL executor) already holding an opensqlx::Transaction– so a pre-mutation read cannot miss a concurrent, uncommitted write from a sibling transaction, and a post-mutation read sees this transaction’s own write. - partition_
insert_ range - The exact insert-time range currently materialized for
view_set_name’s'global'instance –Nonewhen it has no partitions – forDROP’s call toretire_partitions. Deliberately exact rather than an unbounded range:retire_partitionsis hash-agnostic but still needs an explicit range to key its deletion on. - upsert_
tx - Inserts a new row, or – on a name collision – updates every column including
updated_at/updated_byexplicitly: the column defaults only fire onINSERT, andreload()’s digest is over(view_set_name, updated_at), so aREPLACEthat left it unset would go live only on the replacing node while every other replica kept serving/materializing the old definition.