Skip to content

Persist: plumb incremental apply APIs through #33045

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
41 changes: 25 additions & 16 deletions src/persist-client/src/cli/admin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use crate::internal::compact::{CompactConfig, CompactReq, Compactor};
use crate::internal::encoding::Schemas;
use crate::internal::gc::{GarbageCollector, GcReq};
use crate::internal::machine::Machine;
use crate::internal::trace::{CompactionInput, FueledMergeRes};
use crate::internal::trace::FueledMergeRes;
use crate::rpc::{NoopPubSubSender, PubSubSender};
use crate::write::{WriteHandle, WriterId};
use crate::{
Expand Down Expand Up @@ -455,17 +455,17 @@ where
let req = CompactReq {
shard_id,
desc: req.desc,
inputs: req
.inputs
.into_iter()
.map(|b| Arc::unwrap_or_clone(b.batch))
.collect(),
inputs: req.inputs,
};
let parts = req.inputs.iter().map(|x| x.part_count()).sum::<usize>();
let parts = req
.inputs
.iter()
.map(|x| x.batch.part_count())
.sum::<usize>();
let bytes = req
.inputs
.iter()
.map(|x| x.encoded_size_bytes())
.map(|x| x.batch.encoded_size_bytes())
.sum::<usize>();
let start = Instant::now();
info!(
Expand Down Expand Up @@ -514,7 +514,7 @@ where
let (apply_res, maintenance) = machine
.merge_res(&FueledMergeRes {
output: res.output,
input: CompactionInput::Legacy,
input: res.input,
new_active_compaction: None,
})
.await;
Expand Down Expand Up @@ -749,14 +749,18 @@ pub async fn dangerous_force_compaction_and_break_pushdown<K, V, T, D>(
let (reqs, mut maintenance) = machine.spine_exert(fuel).await;
for req in reqs {
info!(
"force_compaction {} {} compacting {} batches in {} parts totaling {} bytes: lower={:?} upper={:?} since={:?}",
"force_compaction {} {} compacting {} batches in {} parts with {} runs totaling {} bytes: lower={:?} upper={:?} since={:?}",
machine.applier.shard_metrics.name,
machine.applier.shard_metrics.shard_id,
req.inputs.len(),
req.inputs.iter().flat_map(|x| &x.parts).count(),
req.inputs.iter().flat_map(|x| &x.batch.parts).count(),
req.inputs
.iter()
.map(|x| x.batch.runs().count())
.sum::<usize>(),
req.inputs
.iter()
.flat_map(|x| &x.parts)
.flat_map(|x| &x.batch.parts)
.map(|x| x.encoded_size_bytes())
.sum::<usize>(),
req.desc.lower().elements(),
Expand Down Expand Up @@ -801,13 +805,18 @@ pub async fn dangerous_force_compaction_and_break_pushdown<K, V, T, D>(

// NB: This check is intentionally at the end so that it's safe to call
// this method in a loop.
let num_batches = machine.applier.all_batches().len();
if num_batches < 2 {
let num_runs: usize = machine
.applier
.all_batches()
.iter()
.map(|x| x.runs().count())
.sum();
if num_runs <= 1 {
info!(
"force_compaction {} {} exiting with {} batches",
"force_compaction {} {} exiting with {} runs",
machine.applier.shard_metrics.name,
machine.applier.shard_metrics.shard_id,
num_batches
num_runs
);
return;
}
Expand Down
Loading