perf(ecstore): gate bounded GET metadata fanout (#5917)

Co-authored-by: heihutu <heihutu@gmail.com>
This commit is contained in:
houseme
2026-08-10 13:20:21 +08:00
committed by GitHub
parent 785ee719e7
commit 88e285c523
3 changed files with 299 additions and 23 deletions
+14 -2
View File
@@ -3834,18 +3834,19 @@ mod tests {
assert!(metadata_early_stop_permitted(true, true, false, "", false, false));
// observe=false (non-observed fanout) also disables early-stop.
assert!(!metadata_early_stop_permitted(true, false, false, "", false, false));
// Data reads are never eligible regardless of caller opt-in.
// Data reads require their own explicit rollout gate.
assert!(!metadata_early_stop_permitted(true, true, true, "", false, false));
},
);
}
#[test]
fn metadata_early_stop_rejects_data_reads() {
fn metadata_early_stop_requires_explicit_data_read_opt_in() {
temp_env::with_vars(
[
(ENV_RUSTFS_GET_METADATA_EARLY_STOP_ENABLE, Some("true")),
(ENV_RUSTFS_GET_METADATA_VERSION_EARLY_STOP_ENABLE, Some("true")),
(ENV_RUSTFS_GET_METADATA_DATA_READ_EARLY_STOP_ENABLE, None),
],
|| {
assert!(!should_allow_metadata_early_stop(true, "", false, false));
@@ -3854,6 +3855,17 @@ mod tests {
assert!(should_allow_metadata_early_stop(false, "version-id", false, false));
},
);
temp_env::with_vars(
[
(ENV_RUSTFS_GET_METADATA_EARLY_STOP_ENABLE, Some("true")),
(ENV_RUSTFS_GET_METADATA_VERSION_EARLY_STOP_ENABLE, Some("true")),
(ENV_RUSTFS_GET_METADATA_DATA_READ_EARLY_STOP_ENABLE, Some("true")),
],
|| {
assert!(should_allow_metadata_early_stop(true, "", false, false));
assert!(should_allow_metadata_early_stop(true, "version-id", false, false));
},
);
}
#[test]