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

[wip] Debug alter table #31408

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
29 changes: 29 additions & 0 deletions src/storage-client/src/storage_collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,35 @@ where
.send(BackgroundCmd::DowngradeSince(persist_compaction_commands))
.expect("cannot fail to send");
}

// Assert table invariants
for (id, state) in &*collections {
match &state.description.data_source {
DataSource::Table {
primary: Some(mut primary_id),
} => {
let primary = loop {
let primary = collections.get(&primary_id).expect("must still exist");
if let DataSource::Table {
primary: Some(other),
} = &primary.description.data_source
{
primary_id = *other;
} else {
break primary;
}
};
assert!(
PartialOrder::less_equal(
&primary.read_capabilities.frontier(),
&state.read_capabilities.frontier(),
),
"primary ({primary_id}) since must be held back at least as much as secondary ({id})"
)
}
_ => {}
}
}
}

/// Remove any shards that we know are finalized
Expand Down