Keep num_covered_map_indexes in sync with history map if block listing flaky entries (#2542)

This commit is contained in:
Nils Bars 2024-09-24 03:31:32 +02:00 committed by GitHub
parent f0d85aaaa5
commit bacbffa6c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -212,11 +212,11 @@ where
.as_ref() .as_ref()
.to_vec(); .to_vec();
let history_map = &mut state let map_state = state
.named_metadata_map_mut() .named_metadata_map_mut()
.get_mut::<MapFeedbackMetadata<O::Entry>>(&self.map_name) .get_mut::<MapFeedbackMetadata<O::Entry>>(&self.map_name)
.unwrap() .unwrap();
.history_map; let history_map = &mut map_state.history_map;
if history_map.len() < map_first_len { if history_map.len() < map_first_len {
history_map.resize(map_first_len, O::Entry::default()); history_map.resize(map_first_len, O::Entry::default());
@ -228,6 +228,10 @@ where
.enumerate() .enumerate()
{ {
if *first != *cur && *history != O::Entry::max_value() { if *first != *cur && *history != O::Entry::max_value() {
// If we just hit a history map entry that was not covered before, but is now flagged as flaky,
// we need to make sure the `num_covered_map_indexes` is kept in sync.
map_state.num_covered_map_indexes +=
usize::from(*history == O::Entry::default());
*history = O::Entry::max_value(); *history = O::Entry::max_value();
unstable_entries.push(idx); unstable_entries.push(idx);
}; };