mirror of
https://github.com/neondatabase/neon.git
synced 2026-01-15 17:32:56 +00:00
@@ -23,8 +23,8 @@ pub fn start_background_loops(
|
||||
) {
|
||||
let tenant_id = tenant.tenant_id;
|
||||
// start two compaction threads
|
||||
let range = if ENABLE_TIERED_COMPACTION { 0..2 } else { 0..1 };
|
||||
for _ in range {
|
||||
let range = if ENABLE_TIERED_COMPACTION { 0..4 } else { 0..1 };
|
||||
for cpt_id in range {
|
||||
task_mgr::spawn(
|
||||
BACKGROUND_RUNTIME.handle(),
|
||||
TaskKind::Compaction,
|
||||
@@ -42,7 +42,9 @@ pub fn start_background_loops(
|
||||
_ = completion::Barrier::maybe_wait(background_jobs_can_start) => {}
|
||||
};
|
||||
compaction_loop(tenant, cancel)
|
||||
.instrument(info_span!("compaction_loop", tenant_id = %tenant_id))
|
||||
.instrument(
|
||||
info_span!("compaction_loop", tenant_id = %tenant_id, cpt_id = %cpt_id),
|
||||
)
|
||||
.await;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ use self::eviction_task::EvictionTaskTimelineState;
|
||||
use self::walreceiver::{WalReceiver, WalReceiverConf};
|
||||
|
||||
use super::config::TenantConf;
|
||||
use super::layer_cache::{DeleteGuardRead, LayerCache, DeleteGuardWrite};
|
||||
use super::layer_cache::{DeleteGuardRead, DeleteGuardWrite, LayerCache};
|
||||
use super::layer_map::BatchedUpdates;
|
||||
use super::remote_timeline_client::index::IndexPart;
|
||||
use super::remote_timeline_client::RemoteTimelineClient;
|
||||
@@ -4200,11 +4200,6 @@ impl Timeline {
|
||||
|
||||
drop(all_keys_iter); // So that deltas_to_compact is no longer borrowed
|
||||
|
||||
let mut compacting_tiers = self.compacting.lock().unwrap();
|
||||
for &tier in &tier_to_compact {
|
||||
compacting_tiers.remove(&tier);
|
||||
}
|
||||
|
||||
Ok(Some(CompactTieredPhase1Result {
|
||||
new_layers,
|
||||
new_tier_at: *tier_to_compact.last().unwrap(),
|
||||
@@ -4318,6 +4313,13 @@ impl Timeline {
|
||||
println!("after compaction:");
|
||||
layers.dump(false, ctx)?;
|
||||
|
||||
let mut compacting_tiers = self.compacting.lock().unwrap();
|
||||
for &tier in &removed_tiers {
|
||||
compacting_tiers.remove(&tier);
|
||||
}
|
||||
|
||||
info!("compaction complete, removed_tiers = {removed_tiers:?}, new_tier_at = {new_tier_at}");
|
||||
|
||||
drop_wlock(guard);
|
||||
|
||||
// Also schedule the deletions in remote storage
|
||||
|
||||
Reference in New Issue
Block a user