[slopfix] refactor(universaldb,ups): single/multi-node udb over nats, remove ups postgres driver#5354
Conversation
|
This PR refactors UniversalDB's commit path from a Postgres-queue model to a NATS-based request/response model, and removes the UPS Postgres pub/sub driver entirely. It also migrates single-node vs. multi-node topology selection out of config and into a runtime startup gate. Net: −2515 / +1198 lines, removing a significant amount of Postgres-polling infrastructure in favour of NATS pub/sub. Update: re-reviewed the latest revision (head Findings1. Still a CLAUDE.md rule: "Reserve 2. NATS watermark publish failure is logged at if let Err(err) = nats.client.publish(nats.subjects.watermark(), ...).await {
tracing::debug!(?err, "failed to publish udb watermark");
}When this publish fails, follower nodes don't learn the new commit watermark and fall back to polling the lease row, widening conflict ranges and causing spurious rejections on follower commits, with no operator-visible signal at any log level above Related, same class: 3. Partial (or fully absent) NATS credentials silently connect unauthenticated let mut options = match (&config.username, &config.password) {
(Some(username), Some(password)) => { ConnectOptions::with_user_and_password(...) }
_ => async_nats::ConnectOptions::new(), // no warning logged
};Setting only 4. Step-down while a NATS commit request is in-flight leaves the follower with no error reply if jobs_tx.send(job).await.is_err() {
break; // channel closed on step-down; no NATS reply sent
}When 5. The 6. Hand-rolled A bespoke FNV-1a implementation derives the per-node NATS subject prefix from the node's Postgres row ID. If the constants are ever wrong or the function is "optimized", two engine versions would compute different subjects, and every multi-node commit would time out silently with no diagnostic beyond a 7. A development debug override for the new module was added to the compose template and regenerated into all flavours (14 occurrences). Single-node and 8. The function subscribes to the election subject, awaits one wakeup (or the Note on schema versioning
|
… remove ups postgres driver
077ad03 to
fc555e6
Compare
No description provided.