mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-29 23:07:21 +00:00
WIP
This commit is contained in:
@@ -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> =
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user