Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify mend region selection #1606

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions upstairs/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1782,11 +1782,11 @@ impl DownstairsClient {
* comparison with the other downstairs in this
* region set.
*/
let dsr = RegionMetadata {
generation: gen_numbers,
flush_numbers,
dirty: dirty_bits,
};
let dsr = RegionMetadata::new(
&gen_numbers,
&flush_numbers,
&dirty_bits,
);

if let Some(old_rm) = self.region_metadata.replace(dsr) {
warn!(self.log, "new RM replaced this: {:?}", old_rm);
Expand Down
54 changes: 21 additions & 33 deletions upstairs/src/downstairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -877,41 +877,29 @@ impl Downstairs {
.map(|c| c.region_metadata.as_ref().unwrap())
.enumerate()
{
let mf = rec.flush_numbers.iter().max().unwrap() + 1;
if mf > max_flush {
max_flush = mf;
}
let mg = rec.generation.iter().max().unwrap() + 1;
if mg > max_gen {
max_gen = mg;
// We log the first 12 pieces of extent metadata
const MAX_LOG: usize = 12;
let mut flush_log = Vec::with_capacity(MAX_LOG);
let mut gen_log = Vec::with_capacity(MAX_LOG);
let mut dirty_log = Vec::with_capacity(MAX_LOG);

for (i, m) in rec.iter().enumerate() {
max_flush = max_flush.max(m.flush + 1);
max_gen = max_gen.max(m.gen + 1);
if i < MAX_LOG {
flush_log.push(m.flush);
gen_log.push(m.gen);
dirty_log.push(m.dirty);
}
}
if rec.flush_numbers.len() > 12 {
info!(
self.log,
"[{}]R flush_numbers[0..12]: {:?}",
cid,
rec.flush_numbers[0..12].to_vec()
);
info!(
self.log,
"[{}]R generation[0..12]: {:?}",
cid,
rec.generation[0..12].to_vec()
);
info!(
self.log,
"[{}]R dirty[0..12]: {:?}",
cid,
rec.dirty[0..12].to_vec()
);
let slice = if rec.len() > MAX_LOG {
format!("[0..{MAX_LOG}]")
} else {
info!(
self.log,
"[{}]R flush_numbers: {:?}", cid, rec.flush_numbers
);
info!(self.log, "[{}]R generation: {:?}", cid, rec.generation);
info!(self.log, "[{}]R dirty: {:?}", cid, rec.dirty);
}
"".to_owned()
};
info!(self.log, "[{cid}]R flush_numbers{slice}: {flush_log:?}",);
info!(self.log, "[{cid}]R generation{slice}: {gen_log:?}",);
info!(self.log, "[{cid}]R dirty{slice}: {dirty_log:?}",);
}

info!(self.log, "Max found gen is {}", max_gen);
Expand Down
Loading
Loading