Repository navigation
Observability: warren.cache(), warren.backends(), warren.progress() (M10 steps 8–9) - #61
Merged
Merged
Conversation
…ds() M10 step 8 (DESIGN.md §5.7, §14 items 48 and 49). - activity: a slot per backend in pg_warren's own shared memory (a named DSM segment on PG 17/18, the preload on 15/16), written only by its backend with a change-count protocol, so writes take no lock and are legal at a statement's end. An exit adds the backend's counters to the header's totals and frees its slot in one change. - The cache counts lookups, hits, waits, loads, evictions and refusals by reason, once per statement and version or vector, and records what it holds privately and maps. - warren.cache() lists this backend's private cache; warren.backends() lists every backend's, then the cluster's totals, under pg_stat_activity's privacy rule. - The shared cache's wait for another backend's load reports the WarrenSharedLoad wait event on PG 17/18. - shared_memory: the room checks for segments, moved out of cache::shared into a leaf that activity uses too. The registry's format and shared_cache() are unchanged, so 0.6.0 keeps sharing across the upgrade without a restart on PG 17/18. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
The changelog, the README's status, and docs/limits.md's shared cache section, with its new example run by docs_examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
…nels M10 step 9, part 1 (DESIGN.md §5.7). `progress::Progress` reports a phase, units done of a total, and named counters; `Interrupts` hands it to long work (`None` by default), since both are the main thread's. - Lanczos reports `lanczos`: steps of max_iter, with the wanted pairs converged, restarts and the largest relative residual estimate. - Local moving reports `moving` (sweeps of max_sweeps, nodes moved) and refinement `refining` (communities refined of their number). Both run as one job on the pool, so the job counts into a `compute::tally::Tally` and the waiting thread reports it at each poll (`Reporting`). Proptests check that done only grows and never exceeds its total, and that reporting changes no result. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
M10 step 9 (DESIGN.md §5.7): a build reports CSRs built of the plan's, so the plan says how many there are, by its layout. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
M10 step 9 (DESIGN.md §5.7, §14 item 49). - Each activity slot gains a command frame and an operation frame (`activity::frame`), and slots are aligned to cache lines. - `activity::Running` opens a native call's operation and restores the one it interrupted when dropped; `phase`, `done` and `detail` report to it, directly or through warren-core's port (`PostgresInterrupts`). - Reporting: refresh and contract (reading nodes and edges, building, writing, promoting), compact, loads, moving vectors, eigen, distance, local moving and refinement. - `warren.report_progress` sets the command frame until the statement or its transaction ends, resolving its graph once per statement and user. - `warren.progress()` lists every backend's frames, with pg_stat_activity's privacy. - The library's iterative functions report each iteration, level or hop. - test/sql/progress.sql watches them from a second session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
DESIGN.md §5.7: what step 9 built and where it differs from the design (building and writing are one phase; compact's phases; contract's operation on the quotient), and the cost measured against main. The changelog, the README's status, and docs/compute.md's library section, with its example run by docs_examples. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
Conflicts: the changelog, the README's status and DESIGN.md's step list keep both sides; the upgrade script adds the quotas before observability; sql/pg_warren--0.6.0.sql regenerated with sql/schema-drift.sh --update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
…d DAG warren-core's `progress` port and `compute::tally`; pg_warren's `shared_memory` and `activity`, and `cache::introspection`; activity's place in the feature DAG. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
PR #61's security review (DESIGN.md §5.7): - progress() names a graph only to callers that may read it, as shared_cache(), cache() and info() do; NULL otherwise. - A slot's role is the authenticated user, pg_stat_activity's usesysid, whatever SET SESSION AUTHORIZATION sets. - report_progress checks its counts and registers the frame's end before it resolves and remembers its graph, so a refused report remembers nothing past its statement. - With no room for the table (PG 17/18), a backend looks again at most once per statement. - A slot is published only when its values change. - The exit callback is registered before the slot is claimed. - Readers retry through the adapter, which spins and, every 1,024 tries, checks for interrupts and sleeps 1 ms. - Parallel workers read the table but claim no slot. - PG 15/16 tables no longer carry the unused header lock and tranche. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
Conflicts: the loader's fill takes main's per-id-type sinks and still reports the bytes copied; the build's imports and intake keep main's batched mapping, with the row counts and CSR reporting around it; interrupts keeps main's pool module and the Progress adapter; imports of CachedIds beside activity's; DESIGN.md's "built so far" lists step 4 and step 9. sql/pg_warren--0.6.0.sql regenerated with sql/schema-drift.sh --update. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012Rxfe2L3iVjSwSBPdUu1Ke
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
M10 steps 8 and 9 (DESIGN.md §5.7 "Observability", §14 items 48 and 49). Where the implementation departs from the design, DESIGN.md §5.7 "Implemented (steps 8, 9)" records the decision.
Step 8: the activity table and cache counters
warren.cache(): this backend's private cache.warren.backends(): what each backend is doing.Step 9: progress
warren-coreport:progress::Progress, reached throughInterrupts::progress(). Lanczos, local moving and refinement report through it, and jobs on the compute pool count into atomics that the waiting thread reports at each 1 ms poll.load.warren.progress()shows the reported progress, andwarren.report_progress()lets the library's PL/pgSQL loops report their own.PERFORM 1takes 0.7 µs).progressisPARALLEL SAFE;report_progressisPARALLEL RESTRICTED, because it writes the leader's slot.Schema
The changes are in
sql/pg_warren--0.5.0--0.6.0.sql: the two new functions, plusCREATE OR REPLACEcopies of the 11 library functions that now callreport_progress. 0.5.0 is untouched. CLAUDE.md's module list and dependency diagram now includeactivity,shared_memoryandprogress.Measured cost
Measured against main 52c272c: release builds, PG 16 with the preload, a graph of 100k nodes and 300k edges. The machine was shared and loaded, so runs vary by ±15%.
degree, 1 client (tps)degree, 4 clients (tps)pagerank, 20 iterations (tps)All of these differences are within noise.
Tests
run.pyon PG 16: 54/54 in each ofpreload,on,offand--trusted.run.pyon PG 18: the progress, backends, docs-examples and killed-loader tests pass.dump.pyandupgrade.pypass.Generated by Claude Code