Skip to content
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

[persist] Follow up on some outstanding bugs #31005

Merged
merged 2 commits into from
Jan 13, 2025
Merged
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
30 changes: 12 additions & 18 deletions src/persist-client/src/internal/gc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ use prometheus::Counter;
use timely::progress::Timestamp;
use tokio::sync::mpsc::UnboundedSender;
use tokio::sync::{mpsc, oneshot, Semaphore};
use tracing::{debug, debug_span, error, warn, Instrument, Span};
use tracing::{debug, debug_span, warn, Instrument, Span};

use crate::async_runtime::IsolatedRuntime;
use crate::batch::PartDeletes;
use crate::cfg::GC_BLOB_DELETE_CONCURRENCY_LIMIT;

use mz_ore::cast::CastFrom;
use mz_ore::collections::HashSet;
use mz_ore::soft_assert_or_log;
use mz_persist::location::{Blob, SeqNo};
use mz_persist_types::{Codec, Codec64};

Expand Down Expand Up @@ -360,26 +361,19 @@ where
.rollups
.contains_key(&initial_seqno);

debug_assert!(
// this should never be true in the steady-state, but may be true the
// first time GC runs after fixing any correctness bugs related to our
// state version invariants. we'll make it an error so we can track
// any violations in Sentry, but opt not to panic because the root
// cause of the violation cannot be from this GC run (in fact, this
// GC run, assuming it's correct, should have fixed the violation!)
soft_assert_or_log!(
valid_pre_gc_state,
"rollups = {:?}, state seqno = {}",
"earliest state fetched during GC did not have corresponding rollup: rollups = {:?}, state seqno = {}",
states.state().collections.rollups,
initial_seqno
);

if !valid_pre_gc_state {
// this should never be true in the steady-state, but may be true the
// first time GC runs after fixing any correctness bugs related to our
// state version invariants. we'll make it an error so we can track
// any violations in Sentry, but opt not to panic because the root
// cause of the violation cannot be from this GC run (in fact, this
// GC run, assuming it's correct, should have fixed the violation!)
error!("earliest state fetched during GC did not have corresponding rollup: rollups = {:?}, state seqno = {}",
states.state().collections.rollups,
initial_seqno
);
}

report_step_timing(
&machine
.applier
Expand Down Expand Up @@ -426,7 +420,7 @@ where
// By our invariant, `states` should always begin on a rollup.
assert!(
gc_rollups.contains_seqno(&states.state().seqno),
"rollups = {:?}, state seqno = {}",
"must start with a present rollup before searching for blobs: rollups = {:#?}, state seqno = {}",
gc_rollups,
states.state().seqno
);
Expand Down Expand Up @@ -458,7 +452,7 @@ where
// to maintain our invariant.
assert!(
gc_rollups.contains_seqno(&states.state().seqno),
"rollups = {:?}, state seqno = {}",
"must start with a present rollup after searching for blobs: rollups = {:#?}, state seqno = {}",
gc_rollups,
states.state().seqno
);
Expand Down
3 changes: 1 addition & 2 deletions src/persist-client/src/internal/machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2633,8 +2633,7 @@ pub mod tests {
];

write1.expect_compare_and_append(&data[..1], 0, 2).await;
// quick check: each handle should have its own copy of state
assert!(write1.machine.seqno() > write2.machine.seqno());

// this handle's upper now lags behind. if compare_and_append fails to update
// state after an upper mismatch then this call would (incorrectly) fail
write2.expect_compare_and_append(&data[1..2], 2, 3).await;
Expand Down
Loading