mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-20 16:02:19 +00:00
backend: un-queue zombies left by missing row in v2_job_runtime (#5232)
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"db_name": "PostgreSQL",
|
||||
"query": "DELETE FROM _sqlx_migrations WHERE version=20250201145632",
|
||||
"describe": {
|
||||
"columns": [],
|
||||
"parameters": {
|
||||
"Left": []
|
||||
},
|
||||
"nullable": []
|
||||
},
|
||||
"hash": "67f671d3feb0c7beedd2e99740fec9c0f01b077026c0be08e87b9ba65fde5608"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
-- Add up migration script here
|
||||
-- Migrate `v2_job_queue` moved columns to `v2_job_runtime`:
|
||||
INSERT INTO v2_job_runtime (id, ping, memory_peak)
|
||||
SELECT id, __last_ping, __mem_peak
|
||||
FROM v2_job_queue
|
||||
-- Locked ones will sync within triggers
|
||||
FOR UPDATE SKIP LOCKED
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
@@ -0,0 +1,12 @@
|
||||
-- Add up migration script here
|
||||
UPDATE v2_job_queue SET
|
||||
running = false,
|
||||
started_at = NULL
|
||||
WHERE running = true AND NOT EXISTS (SELECT 1 FROM v2_job_runtime WHERE id = v2_job_queue.id);
|
||||
|
||||
INSERT INTO v2_job_runtime (id, ping, memory_peak)
|
||||
SELECT id, __last_ping, __mem_peak
|
||||
FROM v2_job_queue
|
||||
-- Locked ones will sync within triggers
|
||||
FOR UPDATE SKIP LOCKED
|
||||
ON CONFLICT (id) DO NOTHING;
|
||||
@@ -180,6 +180,14 @@ pub async fn migrate(db: &DB) -> Result<(), Error> {
|
||||
tracing::info!("Could not remove sqlx migration with version=20250131115248: {err:#}");
|
||||
}
|
||||
|
||||
// Remove the migration `v2_fix_no_runtime` in favor of `v2_fix_no_runtime_2`.
|
||||
if let Err(err) = sqlx::query!("DELETE FROM _sqlx_migrations WHERE version=20250201145632")
|
||||
.execute(db)
|
||||
.await
|
||||
{
|
||||
tracing::info!("Could not remove sqlx migration with version=20250201145632: {err:#}");
|
||||
}
|
||||
|
||||
match sqlx::migrate!("../migrations")
|
||||
.run_direct(&mut custom_migrator)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user