Function mz_storage_controller::persist_handles::read_only_table_worker::read_only_mode_table_worker
source · pub(crate) async fn read_only_mode_table_worker<T: Timestamp + Lattice + Codec64 + TimestampManipulation>(
rx: UnboundedReceiver<(Span, PersistTableWriteCmd<T>)>,
txns_handle: WriteHandle<SourceData, (), T, Diff>,
)
Expand description
Handles table updates in read only mode.
In read only mode, we write to tables outside of the txn-wal system. This is a gross hack, but it is a quick fix to allow us to perform migrations of the built-in tables in the new generation during a deployment. We need to write to the new shards for migrated built-in tables so that dataflows that depend on those tables can catch up, but we don’t want to register them into the existing txn-wal shard, as that would mutate the state of the old generation while it’s still running. We could instead create a new txn shard in the new generation for just system catalog tables, but then we’d have to do a complicated dance to move the system catalog tables back to the original txn shard during promotion, without ever losing track of a shard or registering it in two txn shards simultaneously.
This code is a nearly line-for-line reintroduction of the code that managed writing to tables before the txn-wal system. This code can (again) be deleted when we switch to using native persist schema migrations to perform mgirations of built-in tables.