Back to Seaweedfs

Rust Volume Server Parity Plan

seaweed-volume/PARITY_PLAN.md

4.2315.4 KB
Original Source

Rust Volume Server Parity Plan

Generated: 2026-03-16

Goal

Make seaweed-volume a drop-in replacement for the Go volume server by:

  • comparing every Go volume-server code path against the Rust implementation,
  • recording file-level ownership and verification status,
  • closing verified behavior gaps one logic change per commit,
  • extending tests so regressions are caught by Go parity suites and Rust unit/integration tests.

Ground Truth

Primary Go sources:

  • weed/server/volume_server.go
  • weed/server/volume_server_handlers*.go
  • weed/server/volume_grpc_*.go
  • weed/server/constants/volume.go
  • weed/storage/store*.go
  • weed/storage/disk_location*.go
  • weed/storage/volume*.go
  • weed/storage/needle/*.go
  • weed/storage/idx/*.go
  • weed/storage/needle_map*.go
  • weed/storage/needle_map/*.go
  • weed/storage/super_block/*.go
  • weed/storage/erasure_coding/*.go

Supporting Go dependencies that affect drop-in behavior:

  • weed/command/volume.go
  • weed/security/*.go
  • weed/images/*.go
  • weed/stats/*.go

Primary Rust sources:

  • seaweed-volume/src/main.rs
  • seaweed-volume/src/config.rs
  • seaweed-volume/src/security.rs
  • seaweed-volume/src/images.rs
  • seaweed-volume/src/server/*.rs
  • seaweed-volume/src/storage/*.rs
  • seaweed-volume/src/storage/needle/*.rs
  • seaweed-volume/src/storage/idx/*.rs
  • seaweed-volume/src/storage/erasure_coding/*.rs
  • seaweed-volume/src/remote_storage/*.rs

Audit Method

For each Go file:

  1. Map it to the Rust file or files that should own the same behavior.
  2. Compare exported entry points, helper functions, state transitions, wire fields, and persistence side effects.
  3. Mark each file implemented, partial, missing, or needs verification.
  4. Link each behavior to an existing test or add a missing test.
  5. Only treat a gap as closed after code review plus local verification.

Acceptance Criteria

The Rust server is a drop-in replacement only when all of these hold:

  • HTTP routes, status codes, headers, and body semantics match Go.
  • gRPC RPCs match Go request validation, response fields, streaming behavior, and maintenance/read-only semantics.
  • Master heartbeat and topology metadata match Go closely enough that the Go master treats Rust and Go volume servers the same.
  • On-disk volume behavior matches Go for normal volumes, EC shards, tiering metadata, and readonly persistence.
  • Startup flags and operational endpoints that affect production deployment behave equivalently or are explicitly documented as unsupported.
  • Existing Go integration suites pass with VOLUME_SERVER_IMPL=rust.

File Matrix

HTTP server surface

Go fileRust counterpartStatusComparison focus
weed/server/volume_server.goseaweed-volume/src/main.rs, seaweed-volume/src/server/volume_server.rs, seaweed-volume/src/server/heartbeat.rspartialstartup wiring, routers, heartbeat, shutdown, metrics/debug listeners
weed/server/volume_server_handlers.goseaweed-volume/src/server/volume_server.rs, seaweed-volume/src/server/handlers.rsneeds verificationmethod dispatch, OPTIONS behavior, public/admin split
weed/server/volume_server_handlers_admin.goseaweed-volume/src/server/handlers.rsimplemented/status, /healthz, stats, server headers
weed/server/volume_server_handlers_helper.goseaweed-volume/src/server/handlers.rsneeds verificationJSON encoding, request parsing, helper parity
weed/server/volume_server_handlers_read.goseaweed-volume/src/server/handlers.rsneeds verificationJWT, conditional reads, range reads, proxy/redirect, chunk manifests, image transforms
weed/server/volume_server_handlers_ui.goseaweed-volume/src/server/handlers.rs, embedded assetspartialUI payload and HTML parity
weed/server/volume_server_handlers_write.goseaweed-volume/src/server/handlers.rs, seaweed-volume/src/images.rsneeds verificationmultipart parsing, metadata, compression, ts, delete semantics
weed/server/constants/volume.goseaweed-volume/src/server/heartbeat.rs, config defaultsneeds verificationheartbeat timing, constants parity

gRPC server surface

Go fileRust counterpartStatusComparison focus
weed/server/volume_grpc_admin.goseaweed-volume/src/server/grpc_server.rsneeds verificationreadonly/writable, allocate/delete/configure/mount/unmount
weed/server/volume_grpc_batch_delete.goseaweed-volume/src/server/grpc_server.rsimplementedbatch delete, EC delete path
weed/server/volume_grpc_client_to_master.goseaweed-volume/src/server/heartbeat.rspartialheartbeat fields, leader changes, metrics settings from master
weed/server/volume_grpc_copy.goseaweed-volume/src/server/grpc_server.rsneeds verificationfull copy streams
weed/server/volume_grpc_copy_incremental.goseaweed-volume/src/server/grpc_server.rsneeds verificationincremental copy binary search, timestamps
weed/server/volume_grpc_erasure_coding.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/storage/erasure_coding/*.rsneeds verificationshard read/write/delete/mount/unmount/rebuild
weed/server/volume_grpc_query.goseaweed-volume/src/server/grpc_server.rsneeds verificationquery validation and error parity
weed/server/volume_grpc_read_all.goseaweed-volume/src/server/grpc_server.rsneeds verificationread-all ordering and tail semantics
weed/server/volume_grpc_read_write.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/storage/*.rsneeds verificationblob/meta/page reads, write blob semantics
weed/server/volume_grpc_remote.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/remote_storage/*.rsneeds verificationremote fetch/write and tier metadata
weed/server/volume_grpc_scrub.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/storage/*.rsneeds verificationscrub result semantics
weed/server/volume_grpc_state.goseaweed-volume/src/server/grpc_server.rsimplementedGetState/SetState/Status
weed/server/volume_grpc_tail.goseaweed-volume/src/server/grpc_server.rsneeds verificationtail streaming and idle timeout
weed/server/volume_grpc_tier_download.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/remote_storage/*.rsneeds verificationtier download stream/error paths
weed/server/volume_grpc_tier_upload.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/remote_storage/*.rsneeds verificationtier upload stream/error paths
weed/server/volume_grpc_vacuum.goseaweed-volume/src/server/grpc_server.rs, seaweed-volume/src/storage/*.rsneeds verificationcompact/commit/cleanup progress and readonly transitions

Storage and persistence surface

Go file groupRust counterpartStatusComparison focus
weed/storage/store.go, store_state.goseaweed-volume/src/storage/store.rs, seaweed-volume/src/server/heartbeat.rspartialtopology metadata, disk tags, server id, state persistence
weed/storage/store_vacuum.goseaweed-volume/src/storage/store.rs, seaweed-volume/src/storage/volume.rsneeds verificationvacuum sequencing
weed/storage/store_ec.go, store_ec_delete.go, store_ec_scrub.goseaweed-volume/src/storage/store.rs, seaweed-volume/src/storage/erasure_coding/*.rsneeds verificationEC lifecycle and scrub behavior
weed/storage/disk_location.go, disk_location_ec.goseaweed-volume/src/storage/disk_location.rs, seaweed-volume/src/storage/store.rspartialdirectory UUIDs, tags, load rules, disk space checks
weed/storage/volume.go, volume_loading.goseaweed-volume/src/storage/volume.rsneeds verificationload/reload/readonly/remote metadata
weed/storage/volume_super_block.goseaweed-volume/src/storage/super_block.rs, seaweed-volume/src/storage/volume.rsimplementedsuper block parity
weed/storage/volume_read.go, volume_read_all.goseaweed-volume/src/storage/volume.rs, seaweed-volume/src/server/handlers.rsneeds verificationfull/meta/page reads, TTL, streaming
weed/storage/volume_write.goseaweed-volume/src/storage/volume.rs, seaweed-volume/src/server/write_queue.rsneeds verificationdedup, sync/async writes, metadata flags
weed/storage/volume_vacuum.goseaweed-volume/src/storage/volume.rsneeds verificationcompact and commit parity
weed/storage/volume_backup.goseaweed-volume/src/storage/volume.rs, seaweed-volume/src/server/grpc_server.rsneeds verificationbackup/search logic
weed/storage/volume_checking.goseaweed-volume/src/storage/volume.rs, seaweed-volume/src/storage/idx/mod.rs, seaweed-volume/src/server/grpc_server.rsneeds verificationscrub and integrity checks
weed/storage/volume_info.go, volume_info/volume_info.go, volume_tier.goseaweed-volume/src/storage/volume.rs, seaweed-volume/src/remote_storage/*.rsneeds verification.vif format and tiered file metadata
weed/storage/needle/*.goseaweed-volume/src/storage/needle/*.rsneeds verificationneedle parsing, CRC, TTL, multipart metadata
weed/storage/idx/*.goseaweed-volume/src/storage/idx/*.rsneeds verificationindex walking and binary search
weed/storage/needle_map*.go, needle_map/*.goseaweed-volume/src/storage/needle_map.rsneeds verificationmap kind parity, persistence, memory behavior
weed/storage/super_block/*.goseaweed-volume/src/storage/super_block.rsimplementedreplica placement and TTL metadata
weed/storage/erasure_coding/*.goseaweed-volume/src/storage/erasure_coding/*.rsneeds verificationEC shard placement, encode/decode, journal deletes

Supporting runtime surface

Go fileRust counterpartStatusComparison focus
weed/command/volume.goseaweed-volume/src/config.rs, seaweed-volume/src/main.rspartialflags, metrics/debug listeners, startup behavior
weed/security/*.goseaweed-volume/src/security.rs, seaweed-volume/src/main.rsimplementedJWT and TLS loading
weed/images/*.goseaweed-volume/src/images.rs, seaweed-volume/src/server/handlers.rsimplementedJPEG orientation and transforms
weed/stats/*.goseaweed-volume/src/metrics.rs, seaweed-volume/src/server/handlers.rspartialmetrics endpoints, push-gateway integration

Verified Gaps As Of 2026-03-08

The startup/runtime gaps that were verified in the initial audit are now closed:

  1. Heartbeat metadata parity Closed by 8ade1c51d and retained in current HEAD.

  2. Dedicated metrics/debug listener parity Closed by fbe0e5829.

  3. Master-provided metrics push settings Closed by fbe0e5829.

  4. Slow-read tuning parity Closed by 66e3900dc.

There are no remaining verified gaps from the initial startup/runtime audit. The broader line-by-line comparison batches below are still required to either confirm parity or surface new gaps.

Execution Status As Of 2026-03-16

The file-by-file comparison and verification work executed in this round was:

  1. Startup and harness alignment Compared weed/command/volume.go, test/volume_server/framework/cluster*.go, seaweed-volume/src/config.rs, and seaweed-volume/src/main.rs to ensure the Rust server is invoked with Go-compatible flags and is rebuilt from the current source during parity runs.

  2. HTTP admin surface Compared weed/server/volume_server_handlers_admin.go against seaweed-volume/src/server/handlers.rs with emphasis on /status payload shape, disk-status fields, and volume ordering.

  3. gRPC admin surface Compared weed/server/volume_grpc_admin.go against seaweed-volume/src/server/grpc_server.rs with emphasis on Ping, VolumeConfigure, readonly/writable flows, and error wrapping.

  4. Storage/index layout Compared Go index-entry defaults in weed/storage/types and weed/storage/idx/*.go against the Rust default feature set in seaweed-volume/Cargo.toml and the Rust index reader/writer paths to confirm default binaries use the same offset width.

  5. End-to-end parity verification Re-ran the Go HTTP and gRPC integration suites with VOLUME_SERVER_IMPL=rust after each fix to confirm wire-level compatibility.

Verified mismatches closed in this round

  • Rust parity runs could reuse a stale weed-volume binary across test invocations, hiding source and feature changes from the Go harness.
  • Rust defaulted to 5-byte index offsets, while the default Go go build path uses 4-byte offsets unless built with -tags 5BytesOffset.
  • Rust /status omitted Go fields in both Volumes and DiskStatuses, and did not sort volumes by Id.
  • Rust Ping treated an empty target as a self-ping and only performed a raw gRPC connect for filer targets; Go returns remote_time_ns=0 for the empty request and performs a real filer Ping RPC.
  • Rust VolumeNeedleStatus dropped stored TTL metadata and reported data_size instead of Go’s Size field.
  • Rust multipart uploads ignored form fields such as ts, ttl, and cm, and also ignored part-level Content-Encoding and Content-MD5.
  • Rust only treated dl=true and dl=1 as truthy, while Go accepts the full strconv.ParseBool set such as dl=t and dl=True.

Verification commands

  • VOLUME_SERVER_IMPL=rust go test -count=1 -timeout 1200s ./test/volume_server/http/...
  • VOLUME_SERVER_IMPL=rust go test -count=1 -timeout 1200s ./test/volume_server/grpc/...

Execution Plan

Batch 1: startup and heartbeat

  • Compare weed/command/volume.go, weed/server/volume_server.go, weed/server/volume_grpc_client_to_master.go, weed/storage/store.go, and weed/storage/disk_location.go.
  • Close metadata and startup parity gaps that affect master registration and deployment compatibility.
  • Add Rust unit tests for heartbeat payloads and config wiring.

Batch 2: HTTP read path

  • Compare volume_server_handlers_read.go, volume_server_handlers_helper.go, and related storage read functions line by line.
  • Verify JWT, path parsing, proxy/redirect, ranges, streaming, chunk manifests, image transforms, and response-header overrides.
  • Extend test/volume_server/http/... and Rust handler tests where parity is not covered.

Batch 3: HTTP write/delete path

  • Compare volume_server_handlers_write.go and write-related storage functions.
  • Verify multipart behavior, metadata, md5, compression, unchanged writes, delete edge cases, and timestamp handling.

Batch 4: gRPC admin and lifecycle

  • Compare volume_grpc_admin.go, volume_grpc_state.go, and volume_grpc_vacuum.go.
  • Verify readonly/writable flows, maintenance mode, status payloads, mount/unmount/delete/configure, and vacuum transitions.

Batch 5: gRPC data movement

  • Compare volume_grpc_read_write.go, copy*.go, read_all.go, tail.go, remote.go, and query.go.
  • Verify stream framing, binary search, idle timeout, and remote-storage semantics.

Batch 6: storage internals

  • Compare all weed/storage volume, needle, idx, needle map, and EC files line by line.
  • Focus on persistence rules, readonly semantics, TTL, recovery/scrub, backup, and memory/disk map behavior.

Commit Strategy

  • One commit for the audit/plan document if the document itself changes.
  • One commit per logic fix.
  • Every logic commit must include the smallest test addition that proves the new parity claim.