This commit is contained in:
Christian Schwarz
2025-06-05 01:28:55 +02:00
parent eaa91291ae
commit 687fb25d41
2 changed files with 15 additions and 3 deletions
+7 -1
View File
@@ -20,7 +20,10 @@ pub struct World {
attachments: BTreeMap<TenantShardAttachmentId, NodeId>,
quiesced_timelines: BTreeMap<TenantTimelineId, Lsn>,
// ^
// either a timeline is in quiesced_timelines
// or it is in commit_lsns + remote_consistent_lsns
// v
commit_lsns: BTreeMap<TenantTimelineId, Lsn>,
remote_consistent_lsns: BTreeMap<TimelineAttachmentId, Lsn>,
}
@@ -56,6 +59,9 @@ pub struct RemoteConsistentLsnAdv {
impl World {
fn check_invariants(&self) {
if !cfg!(debug_assertions) {
return;
}
// quiescing
{
let quiesced_timelines: HashSet<TenantTimelineId> =
+8 -2
View File
@@ -160,6 +160,12 @@ fn quiescing_timeline_catchup() {
});
world.handle_commit_lsn_advancement(ttid, Lsn(23));
let advs = world.get_commit_lsn_advertisements();
validate_advertisements(advs, vec![(ps_id, vec![(ttid, Lsn(23))])]);
assert!(world.quiesced_timelines.is_empty());
world.handle_remote_consistent_lsn_advertisement(RemoteConsistentLsnAdv {
attachment: tenant_shard_attachment_id.timeline_attachment_id(timeline_id),
remote_consistent_lsn: Lsn(23),
});
assert!(world.quiesced_timelines.contains_key(&ttid));
}