cargo fmt

This commit is contained in:
anastasia
2021-08-16 19:40:48 +03:00
parent f37cb21305
commit 921ec390bc
5 changed files with 43 additions and 28 deletions

View File

@@ -50,7 +50,12 @@ impl PageServerNode {
.unwrap()
}
pub fn init(&self, create_tenant: Option<&str>, enable_auth: bool, repository_format: Option<&str>) -> Result<()> {
pub fn init(
&self,
create_tenant: Option<&str>,
enable_auth: bool,
repository_format: Option<&str>,
) -> Result<()> {
let mut cmd = Command::new(self.env.pageserver_bin()?);
let mut args = vec![
"--init",

View File

@@ -157,11 +157,9 @@ impl Repository for LayeredRepository {
) -> Result<GcResult> {
STORAGE_TIME
.with_label_values(&["gc"])
.observe_closure_duration(|| self.gc_iteration_internal(
target_timelineid,
horizon,
compact,
))
.observe_closure_duration(|| {
self.gc_iteration_internal(target_timelineid, horizon, compact)
})
}
}
@@ -502,7 +500,10 @@ impl Timeline for LayeredTimeline {
fn get_relish_size(&self, rel: RelishTag, lsn: Lsn) -> Result<Option<u32>> {
if !rel.is_blocky() {
bail!("invalid get_relish_size request for non-blocky relish {}", rel);
bail!(
"invalid get_relish_size request for non-blocky relish {}",
rel
);
}
let lsn = self.wait_lsn(lsn)?;
@@ -561,11 +562,17 @@ impl Timeline for LayeredTimeline {
// FIXME: We should pass the LSN argument to the calls above, and avoid scanning
// dropped relations in the first place.
let mut res: Result<()> = Ok(());
all_rels.retain(|reltag|
match self.get_rel_exists(RelishTag::Relation(*reltag), lsn) {
Ok(exists) => { info!("retain: {} -> {}", *reltag, exists); exists },
Err(err) => { res = Err(err); false }
}
all_rels.retain(
|reltag| match self.get_rel_exists(RelishTag::Relation(*reltag), lsn) {
Ok(exists) => {
info!("retain: {} -> {}", *reltag, exists);
exists
}
Err(err) => {
res = Err(err);
false
}
},
);
res?;
@@ -597,12 +604,16 @@ impl Timeline for LayeredTimeline {
// FIXME: We should pass the LSN argument to the calls above, and avoid scanning
// dropped relations in the first place.
let mut res: Result<()> = Ok(());
all_rels.retain(|tag|
match self.get_rel_exists(*tag, lsn) {
Ok(exists) => { info!("retain: {} -> {}", *tag, exists); exists },
Err(err) => { res = Err(err); false }
}
);
all_rels.retain(|tag| match self.get_rel_exists(*tag, lsn) {
Ok(exists) => {
info!("retain: {} -> {}", *tag, exists);
exists
}
Err(err) => {
res = Err(err);
false
}
});
res?;
Ok(all_rels)
@@ -883,7 +894,6 @@ impl LayeredTimeline {
// Look up the correct layer.
let layers = self.layers.lock().unwrap();
if let Some(layer) = layers.get(rel, lsn) {
// If it's writeable, good, return it.
if !layer.is_frozen() {
return Ok(Arc::clone(&layer));

View File

@@ -326,12 +326,11 @@ impl Layer for InMemoryLayer {
// the drop LSN instead. The drop-LSN could be ahead of the
// caller-specified LSN!
let dropped = inner.drop_lsn.is_some();
let end_lsn =
if dropped {
inner.drop_lsn.unwrap()
} else {
cutoff_lsn
};
let end_lsn = if dropped {
inner.drop_lsn.unwrap()
} else {
cutoff_lsn
};
// Divide all the page versions into old and new at the 'end_lsn' cutoff point.
let mut before_page_versions;

View File

@@ -113,7 +113,9 @@ impl LayerMap {
} else {
trace!(
"found singleton layer for rel {}, {} {}",
rel, lsn, newer_lsn
rel,
lsn,
newer_lsn
);
continue;
}

View File

@@ -119,8 +119,7 @@ impl RelishTag {
| RelishTag::TwoPhase { .. } => true,
// and these don't
| RelishTag::ControlFile
| RelishTag::Checkpoint => false,
RelishTag::ControlFile | RelishTag::Checkpoint => false,
}
}