Compare commits

...

1 Commits

Author SHA1 Message Date
Bojan Serafimov
940ea0ab2a Remove incorrect error handler 2022-06-07 09:28:09 -04:00

View File

@@ -1859,41 +1859,37 @@ impl LayeredTimeline {
let target_file_size = self.get_checkpoint_distance(); let target_file_size = self.get_checkpoint_distance();
// Define partitioning schema if needed // 1. Partition the key space
if let Ok(pgdir) = let pgdir = tenant_mgr::get_local_timeline_with_load(self.tenant_id, self.timeline_id)?;
tenant_mgr::get_local_timeline_with_load(self.tenant_id, self.timeline_id) let (partitioning, lsn) = pgdir.repartition(
{ self.get_last_record_lsn(),
let (partitioning, lsn) = pgdir.repartition( self.get_compaction_target_size(),
self.get_last_record_lsn(), )?;
self.get_compaction_target_size(), let timer = self.create_images_time_histo.start_timer();
)?;
let timer = self.create_images_time_histo.start_timer();
// 2. Create new image layers for partitions that have been modified
// "enough".
let mut layer_paths_to_upload = HashSet::with_capacity(partitioning.parts.len());
for part in partitioning.parts.iter() {
if self.time_for_new_image_layer(part, lsn)? {
let new_path = self.create_image_layer(part, lsn)?;
layer_paths_to_upload.insert(new_path);
}
}
if self.upload_layers.load(atomic::Ordering::Relaxed) {
storage_sync::schedule_layer_upload(
self.tenant_id,
self.timeline_id,
layer_paths_to_upload,
None,
);
}
timer.stop_and_record();
// 3. Compact // 2. Create new image layers for partitions that have been modified
let timer = self.compact_time_histo.start_timer(); // "enough".
self.compact_level0(target_file_size)?; let mut layer_paths_to_upload = HashSet::with_capacity(partitioning.parts.len());
timer.stop_and_record(); for part in partitioning.parts.iter() {
} else { if self.time_for_new_image_layer(part, lsn)? {
debug!("Could not compact because no partitioning specified yet"); let new_path = self.create_image_layer(part, lsn)?;
layer_paths_to_upload.insert(new_path);
}
} }
if self.upload_layers.load(atomic::Ordering::Relaxed) {
storage_sync::schedule_layer_upload(
self.tenant_id,
self.timeline_id,
layer_paths_to_upload,
None,
);
}
timer.stop_and_record();
// 3. Compact
let timer = self.compact_time_histo.start_timer();
self.compact_level0(target_file_size)?;
timer.stop_and_record();
Ok(()) Ok(())
} }