mirror of
https://github.com/rustfs/rustfs.git
synced 2026-08-17 10:17:55 +00:00
perf(ecstore): add guarded encrypted multipart range seeks (#5145)
* perf(ecstore): seek encrypted multipart Range GETs to the covering part boundary on the Legacy rio v1 backend Phase A of https://github.com/rustfs/backlog/issues/1316. Encrypted Range GETs on the default (non rio-v2) backend previously planned storage_offset=0, storage_length=oi.size and discarded the decrypted prefix, so a small Range on a large SSE object read, erasure-decoded, and decrypted the whole object. Eligible multipart objects now seek to the covering part boundary using only the per-part size/actual_size metadata facts; the multipart decrypt reader already handles streams starting at any part boundary, so rio and the on-disk format are untouched. Single-part objects, compressed payloads, defective parts tables, and zero-length ranges keep the previous full read, and RUSTFS_ENCRYPTED_RANGE_SEEK=false restores it globally. A new histogram rustfs_get_encrypted_range_read_amplification plus a full|part_seek path counter record the physical/plaintext amplification at the ReadPlan decision point. * fix(ecstore): guard encrypted multipart range seeks * fix(io-metrics): align encrypted range metric names with the rustfs_io_ prefix Every other metric in rustfs-io-metrics uses the rustfs_io_ prefix; the two encrypted-range-seek metrics were the only exception. Rename before first release so dashboards never see the unprefixed names.
This commit is contained in:
@@ -878,6 +878,19 @@ pub fn record_get_object_codec_streaming_fallback(reason: &'static str) {
|
||||
counter!("rustfs_io_get_object_codec_streaming_fallback_total", "reason" => reason).increment(1);
|
||||
}
|
||||
|
||||
/// Record the read path chosen for one encrypted Range GET on the Legacy (rio v1) backend
|
||||
/// together with its read amplification — physical ciphertext bytes scheduled for the
|
||||
/// erasure layer divided by the plaintext bytes the client requested. Observed at the
|
||||
/// ReadPlan decision point (https://github.com/rustfs/backlog/issues/1316 Phase A).
|
||||
#[inline(always)]
|
||||
pub fn record_get_encrypted_range_read_amplification(path: &'static str, amplification: f64) {
|
||||
if !get_stage_metrics_enabled() {
|
||||
return;
|
||||
}
|
||||
counter!("rustfs_io_get_encrypted_range_read_path_total", "path" => path).increment(1);
|
||||
histogram!("rustfs_io_get_encrypted_range_read_amplification", "path" => path).record(amplification);
|
||||
}
|
||||
|
||||
/// Record the final codec-streaming rollout decision for a GET request.
|
||||
#[inline(always)]
|
||||
pub fn record_get_object_codec_streaming_decision(outcome: &'static str, object_class: &'static str, reason: &'static str) {
|
||||
|
||||
Reference in New Issue
Block a user