feat(get): observe shard locality cost (#3922)

* feat(get): observe shard locality cost

* fix(storage): avoid request counter underflow panic

* fix(storage): import put guard in concurrency tests
This commit is contained in:
houseme
2026-06-26 23:50:37 +08:00
committed by GitHub
parent 741b4dab7f
commit c0ddc14bb8
8 changed files with 414 additions and 33 deletions
+2 -1
View File
@@ -667,8 +667,9 @@ impl Default for ConcurrencyManager {
#[allow(unused_imports)]
mod integration_tests {
use super::super::io_schedule::{IoLoadLevel, IoPriority};
use super::super::request_guard::{GetObjectGuard, PutObjectGuard};
use super::super::request_guard::GetObjectGuard;
use super::ConcurrencyManager;
use crate::storage::storage_api::concurrency_consumer::PutObjectGuard;
use rustfs_concurrency::{AdmissionState, WorkloadAdmissionSnapshotProvider, WorkloadClass};
use rustfs_config::MI_B;
use rustfs_io_core::io_profile::{AccessPattern, StorageMedia};
@@ -95,12 +95,12 @@ impl Drop for GetObjectGuard {
// `elapsed()` method remains meaningful for tests and callers.
let duration_secs = self.start_time.elapsed().as_secs_f64();
// Use the caller-set status, or "unknown" if the result was never set
// (e.g., the future was cancelled or the guard dropped without explicit completion).
// (e.g., the future was canceled or the guard dropped without explicit completion).
let status = self.result.unwrap_or("unknown");
record_get_object_request_result(status, duration_secs);
if let Err(previous) =
ACTIVE_GET_REQUESTS.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| current.checked_sub(1))
ACTIVE_GET_REQUESTS.try_update(Ordering::Relaxed, Ordering::Relaxed, |current| current.checked_sub(1))
{
debug_assert_eq!(
previous, 0,
@@ -160,7 +160,7 @@ impl Drop for PutObjectGuard {
record_put_object_request_result(status, duration_secs);
if let Err(previous) =
ACTIVE_PUT_REQUESTS.fetch_update(Ordering::Relaxed, Ordering::Relaxed, |current| current.checked_sub(1))
ACTIVE_PUT_REQUESTS.try_update(Ordering::Relaxed, Ordering::Relaxed, |current| current.checked_sub(1))
{
debug_assert_eq!(
previous, 0,