fix(heal): coalesce duplicate MRF intents

This commit is contained in:
马登山
2026-08-23 09:05:45 +08:00
parent 20d1266496
commit f4f9b315a6
12 changed files with 903 additions and 98 deletions
+3 -2
View File
@@ -1375,13 +1375,14 @@ impl FolderScanner {
// Single-flight (backlog#1894 axis A) — the
// recording mode and its guarantees are pinned by
// corrupt_metadata_recording below.
let mrf_accepted = rustfs_common::mrf_channel::try_send_mrf_intent(
let mrf_result = rustfs_common::mrf_channel::try_send_mrf_intent_typed(
rustfs_common::mrf_channel::MrfKind::MetadataCorruption,
&item.bucket,
&object,
None,
None,
);
match corrupt_metadata_recording(mrf_accepted) {
match corrupt_metadata_recording(mrf_result) {
CorruptMetadataRecording::LedgerOnly => {
// Recorded as Full (retry-later): admission
// for this target happens in the MRF
@@ -50,11 +50,12 @@ pub(super) enum CorruptMetadataRecording {
ImmediateAndLedger,
}
pub(super) fn corrupt_metadata_recording(mrf_accepted: bool) -> CorruptMetadataRecording {
if mrf_accepted {
CorruptMetadataRecording::LedgerOnly
} else {
CorruptMetadataRecording::ImmediateAndLedger
pub(super) fn corrupt_metadata_recording(result: rustfs_common::mrf_channel::MrfIngressResult) -> CorruptMetadataRecording {
match result {
rustfs_common::mrf_channel::MrfIngressResult::Enqueued | rustfs_common::mrf_channel::MrfIngressResult::Coalesced => {
CorruptMetadataRecording::LedgerOnly
}
rustfs_common::mrf_channel::MrfIngressResult::Dropped(_) => CorruptMetadataRecording::ImmediateAndLedger,
}
}
+14 -2
View File
@@ -48,8 +48,20 @@ fn scanner_alert_wire_names_match_canonical_event_names() {
/// the backstop survives regardless of delivery.
#[test]
fn corrupt_metadata_recording_maps_delivery_to_backstop() {
assert_eq!(corrupt_metadata_recording(true), CorruptMetadataRecording::LedgerOnly);
assert_eq!(corrupt_metadata_recording(false), CorruptMetadataRecording::ImmediateAndLedger);
assert_eq!(
corrupt_metadata_recording(rustfs_common::mrf_channel::MrfIngressResult::Enqueued),
CorruptMetadataRecording::LedgerOnly
);
assert_eq!(
corrupt_metadata_recording(rustfs_common::mrf_channel::MrfIngressResult::Coalesced),
CorruptMetadataRecording::LedgerOnly
);
assert_eq!(
corrupt_metadata_recording(rustfs_common::mrf_channel::MrfIngressResult::Dropped(
rustfs_common::mrf_channel::MrfDropReason::Full
)),
CorruptMetadataRecording::ImmediateAndLedger
);
}
fn cooldown_map_len() -> usize {