Skip to content

Spike: DSM-backed shared memory — #21 cannot free RAM under static pg_shmem_init! #75

Description

@styk-tv

All of pgRDF's shared state is statically allocated at postmaster start:
pg_shmem_init! over PgLwLock / PgAtomic in src/storage/shmem_cache.rs,
with the dictionary cache a fixed [DictCacheSlot; SLOTS]. Two consequences:

  1. pgrdf must be in shared_preload_libraries or the shared surface is inert
    (src/lib.rs:50 gates on
    process_shared_preload_libraries_in_progress; src/storage/stats.rs:39
    notes the counters read zero without it).
  2. The allocation cannot shrink. It exists for the life of the postmaster.

Why this blocks #21 specifically

#21 (C4 · park / unpark graph — seal lifecycle) promises "free + reload
RAM/CPU/disk."
Under the current model, parking a graph cannot return the
dictionary-cache RAM
— the slots are sized once, at start, and stay. #21's
headline promise is not reachable as specced without a dynamic allocation
mechanism.

pgrx has carried storage/dsm_*.h bindings since 0.17.0. Dynamic shared memory
would let the dict cache and the staged-loader job control allocate and release
per-graph, which both makes #21's "free" real and removes the
shared_preload_libraries requirement as a hard precondition.

Scope — this is a spike, not an implementation

Output is a written finding on this issue, not a merged design.

Why P2

#21 is P4. The spike only needs to precede #21's implementation, not this run.

Relates

Blocks the "free" half of #21. styk-tv/pgCK#20 §3 records the same
shared_preload_libraries coupling on that side, where it is satisfied today but
becomes load-bearing as the identity and presence work lands.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2deferred / contingentcarveGraph-carve chain (C1-C6)enhancementImprovement to existing behaviour

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions