buzz icon indicating copy to clipboard operation
buzz copied to clipboard

feat(media): add configurable sharded writes

Open bradseiler opened this issue 4 months ago • 0 comments

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 avatar Jul 31 '26 21:07 bradseiler