Skip to content

Conversation

@DAlperin
Copy link
Member

Depends on #33044

Motivation

Tips for reviewer

Checklist

  • This PR has adequate test coverage / QA involvement has been duly considered. (trigger-ci for additional test/nightly runs)
  • This PR has an associated up-to-date design doc, is a design doc (template), or is sufficiently small to not require a design.
  • If this PR evolves an existing $T ⇔ Proto$T mapping (possibly in a backwards-incompatible way), then it is tagged with a T-proto label.
  • If this PR will require changes to cloud orchestration or tests, there is a companion cloud PR to account for those changes that is tagged with the release-blocker label (example).
  • If this PR includes major user-facing behavior changes, I have pinged the relevant PM to schedule a changelog post.

@DAlperin DAlperin requested review from a team, SangJunBak and ptravers as code owners July 15, 2025 21:09
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 6f74d0b to c60199e Compare July 17, 2025 02:51
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch from f035a90 to 23e21c8 Compare July 17, 2025 02:51
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from c60199e to 5779b4d Compare July 17, 2025 14:26
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch from 23e21c8 to f497c4a Compare July 17, 2025 14:26
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 5779b4d to 9f945f4 Compare July 17, 2025 14:34
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch from f497c4a to ae7312a Compare July 17, 2025 14:39
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 2 times, most recently from b75952b to 0d9a612 Compare July 17, 2025 15:08
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch 2 times, most recently from 2bb9775 to a15c651 Compare July 17, 2025 15:11
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 0d9a612 to 43e3595 Compare July 17, 2025 15:11
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch from a15c651 to 85910d2 Compare July 17, 2025 15:21
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 2 times, most recently from ac52cb3 to 1ddef6e Compare July 21, 2025 15:17
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch from 85910d2 to 0274b1f Compare July 21, 2025 15:17
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 1ddef6e to b4e20a7 Compare July 21, 2025 20:09
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch 2 times, most recently from ee85994 to 3c38325 Compare July 21, 2025 20:53
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 2 times, most recently from 2ac14ef to 0188a39 Compare July 21, 2025 20:55
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch 2 times, most recently from a97ff26 to a946d3c Compare July 23, 2025 14:12
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 2 times, most recently from a9fad35 to 955a883 Compare July 24, 2025 14:19
@DAlperin DAlperin force-pushed the dov/run-based-spine-replacement branch from a946d3c to aee2ad8 Compare July 24, 2025 14:19
Base automatically changed from dov/run-based-spine-replacement to main July 24, 2025 21:46
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 955a883 to e7388bb Compare July 24, 2025 21:48
@bkirwi
Copy link
Contributor

bkirwi commented Jul 29, 2025

Nightly with the flag enabled seems pretty red: https://buildkite.com/materialize/nightly/builds/12728

@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 3 times, most recently from 71825eb to efa44b0 Compare August 5, 2025 20:32
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 2 times, most recently from 2124c7f to 6d76e6d Compare August 7, 2025 02:07
Comment on lines 690 to 698
let (batch_ids, run_ids, descriptions): (BTreeSet<_>, BTreeSet<_>, Vec<_>) = runs.iter()
.map(|(run_id, desc, _, _)| (run_id.0, run_id.1.expect("run_id must be present"), *desc))
.multiunzip();

let input = if incremental_enabled {
match batch_ids.iter().exactly_one().ok() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every day I learn a new useful itertools thing

@def-
Copy link
Contributor

def- commented Aug 7, 2025

In the latest run: https://buildkite.com/materialize/test/builds/107434#01988262-f51c-46c1-9683-5103676fb135

#9 9.297 2025-08-07T02:42:51.793661Z  thread 'persist:003e' panicked at src/persist-client/src/internal/compact.rs:691:69:
#9 9.297 run_id must be present
#9 9.297    5: core::panicking::panic_fmt
#9 9.297    6: core::option::expect_failed
#9 9.297    7: <core::iter::adapters::map::Map<core::slice::iter::Iter<(&mz_persist_client::internal::compact::RunLocation, &differential_dataflow::trace::description::Description<mz_repr::timestamp::Timestamp>, &mz_persist_client::internal::state::RunMeta, &[mz_persist_client::internal::state::RunPart<mz_repr::timestamp::Timestamp>])>, <mz_persist_client::internal::compact::Compactor<(), (), mz_repr::timestamp::Timestamp, i64>>::compact_stream::{closure#0}::{closure#0}> as itertools::Itertools>::multiunzip::<(alloc::collections::btree::set::BTreeSet<mz_persist_client::internal::trace::SpineId>, alloc::collections::btree::set::BTreeSet<mz_persist_client::internal::state::RunId>, alloc::vec::Vec<&differential_dataflow::trace::description::Description<mz_repr::timestamp::Timestamp>>)>
#9 9.297    8: <async_stream::async_stream::AsyncStream<core::result::Result<mz_persist_client::internal::trace::FueledMergeRes<mz_repr::timestamp::Timestamp>, anyhow::Error>, <mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_stream::{closure#0}> as futures_core::stream::Stream>::poll_next
#9 9.297    9: <core::pin::Pin<&mut async_stream::async_stream::AsyncStream<core::result::Result<mz_persist_client::internal::trace::FueledMergeRes<mz_repr::timestamp::Timestamp>, anyhow::Error>, <mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_stream::{closure#0}>> as futures_util::stream::stream::StreamExt>::poll_next_unpin
#9 9.297   10: <futures_util::stream::stream::next::Next<core::pin::Pin<&mut async_stream::async_stream::AsyncStream<core::result::Result<mz_persist_client::internal::trace::FueledMergeRes<mz_repr::timestamp::Timestamp>, anyhow::Error>, <mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_stream::{closure#0}>>> as core::future::future::Future>::poll
#9 9.297   11: <tracing::instrument::Instrumented<<mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_and_apply::{closure#0}::{closure#5}> as core::future::future::Future>::poll
#9 9.297   12: <core::pin::Pin<alloc::boxed::Box<tracing::instrument::Instrumented<<mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_and_apply::{closure#0}::{closure#5}>>> as core::future::future::Future>::poll
#9 9.297   13: <tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<tracing::instrument::Instrumented<<mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_and_apply::{closure#0}::{closure#5}>>>> as core::future::future::Future>::poll
#9 9.297   14: <tokio::runtime::task::core::Core<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<tracing::instrument::Instrumented<<mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_and_apply::{closure#0}::{closure#5}>>>>, alloc::sync::Arc<tokio::runtime::scheduler::multi_thread_alt::handle::Handle>>>::poll
#9 9.297   15: <tokio::runtime::task::harness::Harness<tracing::instrument::Instrumented<core::pin::Pin<alloc::boxed::Box<tracing::instrument::Instrumented<<mz_persist_client::internal::compact::Compactor<mz_storage_types::sources::SourceData, (), mz_repr::timestamp::Timestamp, i64>>::compact_and_apply::{closure#0}::{closure#5}>>>>, alloc::sync::Arc<tokio::runtime::scheduler::multi_thread::handle::Handle>>>::poll
#9 9.297   16: <tokio::runtime::scheduler::multi_thread::worker::Context>::run_task
#9 9.297   17: <tokio::runtime::scheduler::multi_thread::worker::Context>::run
#9 9.297   18: <tokio::runtime::context::scoped::Scoped<tokio::runtime::scheduler::Context>>::set::<tokio::runtime::scheduler::multi_thread::worker::run::{closure#0}::{closure#0}, ()>
#9 9.297   19: tokio::runtime::context::runtime::enter_runtime::<tokio::runtime::scheduler::multi_thread::worker::run::{closure#0}, ()>
#9 9.297   20: tokio::runtime::scheduler::multi_thread::worker::run
#9 9.297   21: <tokio::runtime::blocking::task::BlockingTask<<tokio::runtime::scheduler::multi_thread::worker::Launch>::launch::{closure#0}> as core::future::future::Future>::poll
#9 9.297   22: <tracing::instrument::Instrumented<tokio::runtime::blocking::task::BlockingTask<<tokio::runtime::scheduler::multi_thread::worker::Launch>::launch::{closure#0}>> as core::future::future::Future>::poll
#9 9.297   23: <tokio::runtime::task::core::Core<tracing::instrument::Instrumented<tokio::runtime::blocking::task::BlockingTask<<tokio::runtime::scheduler::multi_thread::worker::Launch>::launch::{closure#0}>>, tokio::runtime::blocking::schedule::BlockingSchedule>>::poll
#9 9.297   24: <tokio::runtime::task::harness::Harness<tracing::instrument::Instrumented<tokio::runtime::blocking::task::BlockingTask<<tokio::runtime::scheduler::multi_thread::worker::Launch>::launch::{closure#0}>>, tokio::runtime::blocking::schedule::BlockingSchedule>>::poll
#9 9.297   25: <tokio::runtime::task::UnownedTask<tokio::runtime::blocking::schedule::BlockingSchedule>>::run
#9 9.297   26: <tokio::runtime::blocking::pool::Inner>::run
#9 9.297 note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch 6 times, most recently from bd3ff86 to 5c8d2de Compare August 11, 2025 03:18
@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 5c8d2de to f64d01d Compare August 11, 2025 03:33
Copy link
Contributor

@bkirwi bkirwi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool! Thank you for the followup!

Left a few nits. We've also discussed some possible cleanups that would make sense as a followup, but this seems overall in good shape...

}

/// A location in a spine, used to identify the Run that a batch belongs to.
/// If the Run is not known, the RunId is None.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✨ - thanks!

run_reserved_memory_bytes,
);
let total_chunked_runs = chunked_runs.len();
let mut applied = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mild preference for using chunked_runs.into_iter().enumerate() instead of the counter here... that way I don't have to check the control flow to see if it's incremented every iteration.

@DAlperin DAlperin force-pushed the dov/enable-incremental-apis branch from 3bdf7d7 to f64d01d Compare August 12, 2025 02:33
@DAlperin DAlperin merged commit b78383c into main Aug 12, 2025
312 of 317 checks passed
@DAlperin DAlperin deleted the dov/enable-incremental-apis branch August 12, 2025 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants