Skip to content

Commit

Permalink
resolve some comments
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Chi Z <[email protected]>
  • Loading branch information
skyzh committed Dec 5, 2024
1 parent 15f26fe commit 4d4686d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pageserver/src/tenant/timeline/compaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1774,7 +1774,9 @@ impl Timeline {
let mut compact_jobs = Vec::new();
// For now, we simply use the key partitioning information; we should do a more fine-grained partitioning
// by estimating the amount of files read for a compaction job. We should also partition on LSN.
let partition = self.partitioning.lock().await;
let Ok(partition) = self.partitioning.try_lock() else {
bail!("failed to acquire partition lock");
};
let ((dense_ks, sparse_ks), _) = &*partition;
// Truncate the key range to be within user specified compaction range.
fn truncate_to(
Expand Down Expand Up @@ -1816,7 +1818,7 @@ impl Timeline {
let layer_map = guard.layer_map()?;
let mut current_start = None;
// Split compaction job to about 2GB each
const GC_COMPACT_MAX_SIZE_MB: u64 = 4 * 1024; // 2GB, TODO: should be configuration in the future
const GC_COMPACT_MAX_SIZE_MB: u64 = 4 * 1024; // 4GB, TODO: should be configuration in the future
let ranges_num = split_key_ranges.len();
for (idx, (start, end)) in split_key_ranges.into_iter().enumerate() {
if current_start.is_none() {
Expand All @@ -1839,7 +1841,7 @@ impl Timeline {
.min()
.expect("at least one layer in the resuult?");
let end = extended_end.max(end);
debug!(
info!(
"splitting compaction job: {}..{}, estimated_size={}",
start, end, total_size
);
Expand Down

0 comments on commit 4d4686d

Please sign in to comment.