Skip to content

feat(media): add configurable sharded writes - #4017

Closed
bradseiler wants to merge 2 commits into
seiler/media-upload-record-keysfrom
seiler/media-sharded-writes
Closed

feat(media): add configurable sharded writes#4017
bradseiler wants to merge 2 commits into
seiler/media-upload-record-keysfrom
seiler/media-sharded-writes

Conversation

@bradseiler

@bradseiler bradseiler commented Jul 31, 2026

Copy link
Copy Markdown

Summary

Add BUZZ_MEDIA_KEY_LAYOUT=legacy|dual|sharded and route image, file, video, and thumbnail writes through the hash-leading community layout.

The upgrade-safe default remains legacy: existing and self-hosted deployments continue flat-only writes and do not start double-writing merely by upgrading. The ENV setting is exposed in the root and production Compose examples and as Helm relay.mediaKeyLayout; the chart validates all three stages. The Helm documentation now gives the explicit legacy → dual → sharded migration and rollback constraints.

Dual mode writes the sharded primary before the flat rollback copy, and sidecars publish only after both succeed.

Related issue

Stacked on #4016 and #4015; requested in the linked Buzz channel thread.

Testing

  • bin/cargo test -p buzz-media (115 passed, 1 live-MinIO test ignored)
  • bin/cargo test -p buzz-relay --lib storage_sweep::tests (15 passed)
  • bin/cargo clippy -p buzz-media -p buzz-relay --all-targets -- -D warnings
  • bin/cargo fmt --check
  • Push hooks passed Rust suites and desktop Tauri checks

Rollout

  1. Upgrade with BUZZ_MEDIA_KEY_LAYOUT unset or legacy; all writes remain flat while compatibility readers deploy everywhere.
  2. After consumers are ready, explicitly select dual, monitor read-resolution/fallback and duplicate-layout metrics, and backfill/reconcile.
  3. After a full rollback window, select sharded.

Never roll a sharded-only writer back to a pre-#4015 binary. Returning sharded → dual does not itself recreate missing flat copies; verify backfill before relying on an old-version rollback.

@bradseiler
bradseiler force-pushed the seiler/media-upload-record-keys branch from aae4515 to 106166b Compare July 31, 2026 23:43
npub128x7j3pwgm4vs8yra3c42fcgcwcvh94g3luwzkqa376du2q6l0esqcrwch added 2 commits July 31, 2026 19:43
Co-authored-by: npub128x7j3pwgm4vs8yra3c42fcgcwcvh94g3luwzkqa376du2q6l0esqcrwch <51cde9442e46eac81c83ec71552708c3b0cb96a88ff8e1581d8fb4de281afbf3@buzz.block.builderlab.xyz>
Signed-off-by: npub128x7j3pwgm4vs8yra3c42fcgcwcvh94g3luwzkqa376du2q6l0esqcrwch <51cde9442e46eac81c83ec71552708c3b0cb96a88ff8e1581d8fb4de281afbf3@buzz.block.builderlab.xyz>
Keep self-hosted upgrades on legacy writes by default, expose the write-layout gate through Helm and Compose, and document the explicit legacy-to-dual-to-sharded migration sequence.

Co-authored-by: npub128x7j3pwgm4vs8yra3c42fcgcwcvh94g3luwzkqa376du2q6l0esqcrwch <51cde9442e46eac81c83ec71552708c3b0cb96a88ff8e1581d8fb4de281afbf3@buzz.block.builderlab.xyz>
Signed-off-by: npub128x7j3pwgm4vs8yra3c42fcgcwcvh94g3luwzkqa376du2q6l0esqcrwch <51cde9442e46eac81c83ec71552708c3b0cb96a88ff8e1581d8fb4de281afbf3@buzz.block.builderlab.xyz>
@bradseiler
bradseiler force-pushed the seiler/media-sharded-writes branch from 90b6980 to 6e231f7 Compare July 31, 2026 23:47
@bradseiler

Copy link
Copy Markdown
Author

Superseded by consolidated PR #4533, which includes the full phased read/write policy and Kubernetes-runnable backfill and legacy-deletion tools.

@bradseiler bradseiler closed this Aug 3, 2026
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