Skip to content

manifest v2 for non co-located seg and meshes - #542

Open
akhileshh wants to merge 11 commits into
mainfrom
meshing-v2
Open

akhileshh wants to merge 11 commits into
mainfrom
meshing-v2

Conversation

@akhileshh

@akhileshh akhileshh commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Why

A table's watershed can live in a different location from its meshes, and that location holds no meshes.
PCG looked for every mesh under <watershed>/<mesh dir>, so such a table lost its meshes in the manifest, stitching, remeshing and find-path.
A copy of a table also had no way to show its source's meshes without copying them.

What changes

  • Mesh locations come from the table's mesh block. MeshMeta reads dir, initial_mesh_dir and dynamic_mesh_dir from custom_data["mesh"]; the last two may be absolute cloud URLs.
  • Setup writes only the mesh block and the shard spec. It merges its keys over an existing block, so a re-run keeps the keys it cannot set, and writes the spec beside the initial meshes. The watershed's info is no longer written, and dataset_info no longer takes mesh keys from it.
  • The graphene info publishes the table's mesh keys. mesh_dir, dynamic_mesh_dir, and mesh_metadata with the absolute initial and dynamic paths. dynamic_mesh_dir and mesh_metadata.unsharded_mesh_dir name the dynamic dir relative to <watershed>/<mesh dir> whenever it lies there, so a table repointed onto its own watershed, or away and back, stays readable by v1 clients.
  • Readers and writers use the table's own dirs. Stitching, remeshing, find-path's precise mode and the manifest read initial meshes from initial_path and dynamic meshes from dynamic_path; both manifest modes and the remesh worker read the shard spec beside the initial meshes.
  • A v2 manifest, negotiated by Accept: application/x.cave;manifest_version=2. Fragments are grouped by their absolute bucket, and every row carries exactly one seg id.
  • v1 clients are refused where they cannot reach the meshes. A v1 request for a table whose meshes sit outside <watershed>/<mesh dir> gets 406, naming the v2 header; "outside" compares whole path segments, so a sibling such as <mesh dir>_v2 counts as outside.
  • A table's watershed can be repointed. ChunkedGraphMeta.repoint_watershed pins the mesh block first, so the meshes stay where they are; save the meta with ChunkedGraph.update_meta. ws_cv reads the watershed's info directly, with no Redis cache.
  • Manifest cache entries expire after 3 days, and ManifestCache.clear_namespace clears a graph's keys.

Table copies

  • A copy keeps its source's initial meshes and writes its own dynamic dir, dynamic_<copy id>.
  • Its first open rewrites its meta once, listing the source's dynamic dir under inherited_dynamic.
  • A new node's creation time picks the dir checked first; a miss then checks the copy's own dir and only the inherited dirs newer than that pick.
  • An older dir is never checked: a restored copy reuses its source's node ids, so an older dir can hold another node's mesh under the same name.
  • The v2 manifest names each dynamic dir as its own bucket, so a copy needs a client that reads every bucket: feat(graphene): decode v2 mesh manifest seung-lab/neuroglancer#634.

Compatibility

  • A co-located table's v1 response is unchanged, and a table without inherited_dynamic reads exactly as before.
  • Manifest responses carry Vary: Accept and X-Manifest-Version.
  • meshgen.remeshing() no longer takes cv_sharded_mesh_dir.
  • A copy's first open writes its meta, so that open needs write access to the table.

Before merge

  • Revert cd3ff7d0, which serves minnie3_v1 from its new watershed for testing.

🤖 Generated with Claude Code

akhileshh and others added 11 commits November 24, 2026 15:54
- `MeshMeta` resolves `dir`, `initial_mesh_dir` and `dynamic_mesh_dir`
  from `custom_data["mesh"]`; either mesh dir may be a cloud URL.
- Setup writes the shard spec and the mesh block, never the
  watershed's info.
- `dataset_info` and the graphene info take mesh keys from the mesh
  block alone.

Co-Authored-By: Claude <noreply@anthropic.com>
- Stitching, remeshing and find-path read node meshes through
  `NodeMeshReader`, from `initial_path` and `dynamic_path`.
- The manifest's shard readers resolve `initial_path` through
  `shard_mesh_source`, a cloud-URL dir included.
- `remeshing()` drops `cv_sharded_mesh_dir`; its callers pass
  `MeshMeta`'s values.

Co-Authored-By: Claude <noreply@anthropic.com>
- `Accept: application/x.cave;manifest_version=2` gets fragments
  grouped by absolute bucket, with one seg id per row.
- A v1 request for a table that `needs_v2` gets `406`, naming the v2
  header; responses carry `Vary: Accept` and `X-Manifest-Version`.
- Manifest flags merge the query string and the body through `_flag`.

Co-Authored-By: Claude <noreply@anthropic.com>
- Every cached fragment and absence expires after
  `MANIFEST_TTL_SECONDS`, 3 days.
- `ManifestCache.clear_namespace` deletes a graph's keys by SCAN.

Co-Authored-By: Claude <noreply@anthropic.com>
- `MeshMeta.spec_dir` names the spec's dir, the parent of
  `initial_path`; `reader_anchor` derives from it.
- `verify=0` builds its shard readers through `shard_mesh_source`.
- The remesh worker looks for the spec in `spec_dir`, so a table
  whose watershed lives elsewhere still remeshes.

Co-Authored-By: Claude <noreply@anthropic.com>
- `setup_mesh_meta` merges its seven keys over the existing block,
  so `initial_mesh_dir` and other keys survive a re-run.
- The shard spec is written in `MeshMeta.spec_dir`, beside the
  initial meshes, never under a watershed that holds none.

Co-Authored-By: Claude <noreply@anthropic.com>
- ChunkedGraphMeta.repoint_watershed pins the mesh block first
- it persists nothing; ChunkedGraph.update_meta saves it
- ws_cv reads its watershed's info directly, with no Redis cache

Co-Authored-By: Claude <noreply@anthropic.com>
- every load of its meta repoints it in memory to the iarpa_microns path
- it pickles as stored, so no write changes its row; revert before merge

Co-Authored-By: Claude <noreply@anthropic.com>
- A copy reuses its source's initial meshes and writes its own dynamic dir.
- Its first open lists the source's dynamic dir as an inherited layer.
- A new node's creation time hints at the dir holding its mesh.
- A probe checks the hint, and a miss searches the own dir first.
- After the own dir, a miss searches inherited dirs newest first.
- Inside the server, a mesh found outside the own dir carries that dir.
- v2 groups rows by that dir, so clients see the same row format.
- Tables without inherited dirs read and cache exactly as before.

Co-Authored-By: Claude <noreply@anthropic.com>
- A copy's restored id counters reuse its source's ids, so an older dir may hold another node's mesh.
- A miss now searches the own dir and the inherited dirs newer than the hint.
- The copy's block is built beside its layer record, and its dir name has one home.

Co-Authored-By: Claude <noreply@anthropic.com>
- Publish the dynamic dir relative to the mesh root when it lies there.
- Share one whole-segment test of the mesh root with `needs_v2`.
- Refuse v1 for a sibling dir that only shares the root's prefix.

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant