Skip to content

Commit b112669

Browse files
authored
start updating quiesce for new Nexus handoff (#8875)
1 parent 9eade06 commit b112669

File tree

22 files changed

+1101
-451
lines changed

22 files changed

+1101
-451
lines changed

common/src/address.rs

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,9 @@ impl std::fmt::Display for IpVersion {
396396
///
397397
/// The first address in the range is guaranteed to be no greater than the last
398398
/// address.
399-
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
399+
#[derive(
400+
Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize, Ord, PartialOrd,
401+
)]
400402
#[serde(untagged)]
401403
pub enum IpRange {
402404
V4(Ipv4Range),
@@ -548,7 +550,16 @@ impl From<Ipv6Range> for IpRange {
548550
///
549551
/// The first address must be less than or equal to the last address.
550552
#[derive(
551-
Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize, JsonSchema,
553+
Clone,
554+
Copy,
555+
Debug,
556+
PartialEq,
557+
Eq,
558+
Deserialize,
559+
Serialize,
560+
JsonSchema,
561+
PartialOrd,
562+
Ord,
552563
)]
553564
#[serde(try_from = "AnyIpv4Range")]
554565
pub struct Ipv4Range {
@@ -612,7 +623,16 @@ impl TryFrom<AnyIpv4Range> for Ipv4Range {
612623
///
613624
/// The first address must be less than or equal to the last address.
614625
#[derive(
615-
Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize, JsonSchema,
626+
PartialOrd,
627+
Ord,
628+
Clone,
629+
Copy,
630+
Debug,
631+
PartialEq,
632+
Eq,
633+
Deserialize,
634+
Serialize,
635+
JsonSchema,
616636
)]
617637
#[serde(try_from = "AnyIpv6Range")]
618638
pub struct Ipv6Range {

dev-tools/omdb/src/bin/omdb/db.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5016,7 +5016,7 @@ async fn cmd_db_dns_diff(
50165016
// Load the added and removed items.
50175017
use nexus_db_schema::schema::dns_name::dsl;
50185018

5019-
let added = dsl::dns_name
5019+
let mut added = dsl::dns_name
50205020
.filter(dsl::dns_zone_id.eq(zone.id))
50215021
.filter(dsl::version_added.eq(version.version))
50225022
.limit(i64::from(u32::from(limit)))
@@ -5026,7 +5026,7 @@ async fn cmd_db_dns_diff(
50265026
.context("loading added names")?;
50275027
check_limit(&added, limit, || "loading added names");
50285028

5029-
let removed = dsl::dns_name
5029+
let mut removed = dsl::dns_name
50305030
.filter(dsl::dns_zone_id.eq(zone.id))
50315031
.filter(dsl::version_removed.eq(version.version))
50325032
.limit(i64::from(u32::from(limit)))
@@ -5042,6 +5042,11 @@ async fn cmd_db_dns_diff(
50425042
);
50435043
println!("");
50445044

5045+
// This is kind of stupid-expensive, but there aren't a lot of records
5046+
// here and it's helpful for this output to be stable.
5047+
added.sort_by_cached_key(|k| format!("{} {:?}", k.name, k.records()));
5048+
removed.sort_by_cached_key(|k| format!("{} {:?}", k.name, k.records()));
5049+
50455050
for a in added {
50465051
print_name("+", &a.name, a.records().context("parsing records"));
50475052
}
@@ -5097,7 +5102,8 @@ async fn cmd_db_dns_names(
50975102
}
50985103
});
50995104

5100-
for (name, records) in names {
5105+
for (name, mut records) in names {
5106+
records.sort();
51015107
print_name("", &name, Ok(records));
51025108
}
51035109
}

dev-tools/omdb/src/bin/omdb/nexus/quiesce.rs

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,20 +61,23 @@ async fn quiesce_show(
6161
.context("fetching quiesce state")?
6262
.into_inner();
6363
match quiesce.state {
64+
QuiesceState::Undetermined => {
65+
println!("has not yet determined if it is quiescing");
66+
}
6467
QuiesceState::Running => {
6568
println!("running normally (not quiesced, not quiescing)");
6669
}
67-
QuiesceState::WaitingForSagas { time_requested } => {
70+
QuiesceState::DrainingSagas { time_requested } => {
6871
println!(
6972
"quiescing since {} ({} ago)",
7073
humantime::format_rfc3339_millis(time_requested.into()),
7174
format_time_delta(now - time_requested),
7275
);
7376
println!("details: waiting for running sagas to finish");
7477
}
75-
QuiesceState::WaitingForDb {
78+
QuiesceState::DrainingDb {
7679
time_requested,
77-
duration_waiting_for_sagas,
80+
duration_draining_sagas,
7881
..
7982
} => {
8083
println!(
@@ -87,13 +90,34 @@ async fn quiesce_show(
8790
);
8891
println!(
8992
" previously: waiting for sagas took {}",
90-
format_duration_ms(duration_waiting_for_sagas.into()),
93+
format_duration_ms(duration_draining_sagas.into()),
94+
);
95+
}
96+
QuiesceState::RecordingQuiesce {
97+
time_requested,
98+
duration_draining_sagas,
99+
duration_draining_db,
100+
..
101+
} => {
102+
println!(
103+
"quiescing since {} ({} ago)",
104+
humantime::format_rfc3339_millis(time_requested.into()),
105+
format_time_delta(now - time_requested),
106+
);
107+
println!(
108+
" waiting for sagas took {}",
109+
format_duration_ms(duration_draining_sagas.into()),
110+
);
111+
println!(
112+
" waiting for db quiesce took {}",
113+
format_duration_ms(duration_draining_db.into()),
91114
);
92115
}
93116
QuiesceState::Quiesced {
94117
time_quiesced,
95-
duration_waiting_for_sagas,
96-
duration_waiting_for_db,
118+
duration_draining_sagas,
119+
duration_draining_db,
120+
duration_recording_quiesce,
97121
duration_total,
98122
..
99123
} => {
@@ -104,11 +128,15 @@ async fn quiesce_show(
104128
);
105129
println!(
106130
" waiting for sagas took {}",
107-
format_duration_ms(duration_waiting_for_sagas.into()),
131+
format_duration_ms(duration_draining_sagas.into()),
108132
);
109133
println!(
110134
" waiting for db quiesce took {}",
111-
format_duration_ms(duration_waiting_for_db.into()),
135+
format_duration_ms(duration_draining_db.into()),
136+
);
137+
println!(
138+
" recording quiesce took {}",
139+
format_duration_ms(duration_recording_quiesce.into()),
112140
);
113141
println!(
114142
" total quiesce time: {}",

0 commit comments

Comments
 (0)