fix: instance health reflects in db state - #461
Conversation
Updated storedToDtabase to inspect the database's instance and update the database to degraded if instance states indicate this is appropriate. Delete database modified to check "from" state via the stored state rather than etcd to prevent mismatch. PLAT-333
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (3)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughChangesDatabase lifecycle
Priority: ⬇️ Low — Defer this database-state correction because its scope is limited to deriving instance-health status and guarding deletion transitions. Merge Risk: ⚪ Minimal · up to Available databases now report degraded status when an instance is unhealthy, while deletion continues to guard transitions using persisted state. The change includes coverage for the supported state combinations and is ready to merge. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
A rabbit checks each instance state Comment |
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
|
||
| prevState := db.State | ||
| // Use the raw stored state as the guard for this transition. | ||
| prevState, err := s.dbSvc.GetStoredDatabaseState(ctx, db.DatabaseID) |
There was a problem hiding this comment.
Looks good.
Minor: DeleteDatabase now calls GetStoredDatabaseState (post_init_handlers.go:479), which re-reads the same StoredDatabase record already fetched by GetDatabase just above. We could avoid the extra database round trip by carrying the raw stored state on Database (for example, a RawState field populated in storedToDatabase) and using db.RawState here instead. Not blocking.
Add a RawState field to Database, read that state in DeleteDatabase efficiently.
Summary
Updated storedToDtabase to inspect the database's instance and update the database to degraded if instance states indicate this is appropriate. Delete database modified to check "from" state via the stored state rather than etcd to prevent mismatch.
Changes
PLAT-333