Skip to content

fix(replication): decode MinIO metrics wire format - #363

Merged
cxymds merged 1 commit into
mainfrom
cxymds/fix-2098-replication-metrics-wire
Sep 1, 2026
Merged

fix(replication): decode MinIO metrics wire format#363
cxymds merged 1 commit into
mainfrom
cxymds/fix-2098-replication-metrics-wire

Conversation

@cxymds

@cxymds cxymds commented Sep 1, 2026

Copy link
Copy Markdown
Member

Fixes rustfs/backlog#2098

Summary

  • decode the complete MinIO-compatible replication metrics v1 wire shape into the existing stable ReplicationMetrics model while retaining the legacy snake_case decoder
  • validate integer-valued counters directly from borrowed raw JSON tokens, avoiding f64 rounding and per-counter allocation
  • map timed failures from failed.totals, accept compatible queued.peak/queued.max forms, preserve unknown extensions, and mark unavailable latency explicitly
  • keep the output-v3 structure unchanged and preserve the pre-deserialization 8 MiB response bound
  • sanitize replication extension keys and values without quadratic collision handling

Compatibility and performance

  • one bounded response read followed by one explicit envelope parse; no untagged backtracking or whole-response Value DOM
  • serde_json enables only raw_value; ordinary workspace float parsing is unchanged
  • integer JSON tokens retain the full u64 range, while decimal/exponent tokens are converted exactly and fail closed on negative, fractional, non-number, underflowing, or overflowing values
  • limitInBits follows the minio-go wire semantics of bytes per second
  • MinIO wire omissions normalize to zero only for fields declared optional by the upstream contract; core discriminator and queue fields remain required
  • legacy serialization, human output, and output-v3 schema remain stable

Test evidence

  • red baseline: the captured RustFS fixture failed on main with missing field stats
  • captured 1-object / 20-byte RustFS response fixture plus legacy, omitempty, timed failure, peak/max, mixed-shape, unknown-extension, and exact numeric-boundary tests
  • signed mock Admin endpoint tests, including credential sanitization and declared/chunked 8 MiB overflow rejection
  • process-level human and JSON rc bucket replication status tests; JSON is validated against schemas/output_v3.json
  • two independent post-implementation expert reviews: approved for correctness, compatibility, and performance

Commands completed locally:

cargo fmt --all --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace

All completed with zero failures. A real RustFS black-box rerun will be attached after the PR artifact is available.

@cxymds
cxymds merged commit ff47e1f into main Sep 1, 2026
17 checks passed
@cxymds
cxymds deleted the cxymds/fix-2098-replication-metrics-wire branch September 1, 2026 15:00
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