fix(scanner): reject duplicate usage updates (#6445)

* fix(scanner): reject duplicate usage updates

* style: format decommission test imports

* fix(ci): remove unused decommission and healing facades

* fix(ci): cfg-gate test-only usage overlay import

---------

Co-authored-by: houseme <housemecn@gmail.com>
This commit is contained in:
cxymds
2026-08-24 14:17:11 +08:00
committed by GitHub
parent 16ca65ccab
commit 1c5c28842a
2 changed files with 55 additions and 12 deletions
+25 -12
View File
@@ -751,16 +751,29 @@ pub(super) async fn persist_and_publish_cache_snapshot(
}
pub(super) async fn send_data_usage_update(updates: &mpsc::Sender<DataUsageInfo>, data_usage_info: DataUsageInfo) -> Result<()> {
updates.send(data_usage_info).await.map_err(|e| {
error!(
target: "rustfs::scanner::io",
event = EVENT_SCANNER_DATA_USAGE_STREAM,
component = LOG_COMPONENT_SCANNER,
subsystem = LOG_SUBSYSTEM_IO,
state = "send_failed",
error = %e,
"Scanner data usage publish failed"
);
StorageError::other("scanner data usage receiver closed before update delivery")
})
match updates.try_send(data_usage_info) {
Ok(()) => Ok(()),
Err(mpsc::error::TrySendError::Closed(_)) => {
error!(
target: "rustfs::scanner::io",
event = EVENT_SCANNER_DATA_USAGE_STREAM,
component = LOG_COMPONENT_SCANNER,
subsystem = LOG_SUBSYSTEM_IO,
state = "send_failed",
"Scanner data usage publish failed because the receiver is closed"
);
Err(StorageError::other("scanner data usage receiver closed before update delivery"))
}
Err(mpsc::error::TrySendError::Full(_)) => {
error!(
target: "rustfs::scanner::io",
event = EVENT_SCANNER_DATA_USAGE_STREAM,
component = LOG_COMPONENT_SCANNER,
subsystem = LOG_SUBSYSTEM_IO,
state = "send_would_block",
"Scanner data usage publish rejected because an update is already queued"
);
Err(StorageError::other("scanner data usage update already queued"))
}
}
}