You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pipeline-manager: fix starting pipeline while clearing storage
Before it was possible to (early) start a pipeline while storage was
still clearing, and to clear storage while still awaiting the transition
of the resources status during early start. Only once the resources
status transitioned, was it no longer possible for storage status to
change.
Changes:
- No longer allow a pipeline to be (early) started when the storage is
still clearing, returning an error instead.
- No longer allow storage to be cleared during early start, returning an
error instead.
- Always allow any of the other resources statuses to transition to
`Stopping`, even if storage status does not match expectation.
The same for transitioning from `Stopping` to `Stopped`. This is a
fail-safe for if storage status ends up in an expected status due to
an internal error.
Signed-off-by: Simon Kassing <simon.kassing@feldera.com>
Copy file name to clipboardExpand all lines: crates/pipeline-manager/src/db/error.rs
+14-2Lines changed: 14 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -175,6 +175,7 @@ pub enum DBError {
175
175
},
176
176
StorageStatusImmutableUnlessStopped{
177
177
resources_status:ResourcesStatus,
178
+
resources_desired_status:ResourcesDesiredStatus,
178
179
current_status:StorageStatus,
179
180
new_status:StorageStatus,
180
181
},
@@ -199,6 +200,7 @@ pub enum DBError {
199
200
NoRuntimeStatusWhileProvisioned,
200
201
PreconditionViolation(String),
201
202
CannotStartWithUndismissedError,
203
+
CannotStartWhileClearingStorage,
202
204
DismissErrorRestrictedToFullyStopped,
203
205
InitialImmutableUnlessStopped,
204
206
InitialStandbyNotAllowed,
@@ -592,13 +594,14 @@ impl Display for DBError {
592
594
}
593
595
DBError::StorageStatusImmutableUnlessStopped{
594
596
resources_status,
597
+
resources_desired_status,
595
598
current_status,
596
599
new_status,
597
600
} => {
598
601
write!(
599
602
f,
600
-
"Cannot transition storage status from '{current_status}' to '{new_status}' with resources status '{resources_status}'. \
601
-
Storage status cannot be changed unless the pipeline is stopped."
603
+
"Cannot transition storage status from '{current_status}' to '{new_status}' with resources status '{resources_status}' and desired status '{resources_desired_status}'. \
604
+
Storage status cannot be changed unless the pipeline is fully stopped."
602
605
)
603
606
}
604
607
DBError::IllegalPipelineAction{
@@ -665,6 +668,13 @@ impl Display for DBError {
665
668
first call `/dismiss_error`, after which `/start?dismiss_error=false` is again possible."
666
669
)
667
670
}
671
+
DBError::CannotStartWhileClearingStorage => {
672
+
write!(
673
+
f,
674
+
"Cannot process `/start` if the `storage_status` is `Clearing`. \
675
+
Wait for the storage to become cleared before trying again."
// As a fail-safe, it's always possible to transition from any other status to Stopping and
194
+
// from Stopping to Stopped. This however should not occur (instead the first matches should
195
+
// have already caught them).
196
+
error!("The resources status transition {current_status:?} -> {new_status:?} (storage status: {storage_status:?}) is taking place. This is due to an internal error, and is permitted only in order to recover from an invalid status. Please file a bug report.");
0 commit comments