Skip to content

Commit 08cb0cf

Browse files
Provide different patch files for the panda_db schema changes and the postgres schema changes for scheduling cron jobs. Thanks to Xin!
1 parent 5d3004f commit 08cb0cf

File tree

3 files changed

+61
-7
lines changed

3 files changed

+61
-7
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# PanDA Database Schema Patch 0.0.30
2+
3+
**Version:** 0.0.30
4+
**Upgrade from:** 0.0.29
5+
**Date:** November 2025
6+
7+
## Overview
8+
9+
This patch includes updates to worker node metrics tracking, JEDI task error logging, and CPU benchmarking capabilities.
10+
11+
**⚠️ IMPORTANT VERSION FORMAT CHANGE:**
12+
Starting with version 0.0.30, the `pandadb_version` table format has changed from two components (JEDI, SERVER) to a single unified component (PanDA). This is an **intentional breaking change** to reflect that PanDA Server and JEDI are always upgraded together and must be at the same schema version.
13+
14+
**Before (0.0.29 and earlier):**
15+
```sql
16+
component | major | minor | patch
17+
-----------+-------+-------+-------
18+
JEDI | 0 | 0 | 29
19+
SERVER | 0 | 0 | 29
20+
(2 rows)
21+
```
22+
23+
**After (0.0.30 and later):**
24+
```sql
25+
component | major | minor | patch
26+
-----------+-------+-------+-------
27+
PanDA | 0 | 0 | 30
28+
(1 row)
29+
```
30+
31+
This change aligns with the SchemaChecker scripts in PanDA Server and JEDI that expect a single 'PanDA' component.
32+
33+
## Files in this Patch
34+
35+
1. **0.0.30.patch.sql** - Main database updates (run against `panda_db` database)
36+
2. **0.0.30.cron.patch.sql** - Cron job updates (run against database where `pg_cron` extension is installed)
37+
3. **0.0.30.README.md** - This documentation file
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
-- Cron job updates for patch 0.0.30
2+
-- This file contains cron-specific updates and must be run against the database where pg_cron is installed
3+
--
4+
-- IMPORTANT: pg_cron location varies by installation:
5+
-- Some installations have it in 'postgres' database, others may be in the 'panda_db' database
6+
--
7+
-- To check where pg_cron is installed:
8+
-- SELECT extname FROM pg_extension WHERE extname = 'pg_cron';
9+
--
10+
-- Run this file against the correct database:
11+
-- psql -U postgres -d postgres -f 0.0.30.cron.patch.sql (if pg_cron is in postgres)
12+
-- psql -U postgres -d panda_db -f 0.0.30.cron.patch.sql (if pg_cron is in panda_db)
13+
--
14+
-- Regular database updates are in 0.0.30.patch.sql
15+
16+
-- Drop the old cron schedule for the obsolete update_worker_node_map procedure
17+
-- This procedure has been replaced by update_worker_node_metrics
18+
SELECT cron.unschedule(
19+
(SELECT jobid FROM cron.job WHERE command = 'CALL doma_panda.update_worker_node_map()')
20+
);

schema/postgres/sqls/patches/0.0.30.patch.sql

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
-- patch to be used to upgrade from version 0.0.29
2+
-- This file contains regular table and procedure updates for panda_db database
3+
-- For cron job updates, see 0.0.30.cron.patch.sql
4+
25
BEGIN;
36

47
DROP VIEW doma_pandabigmon.jedi_tasks_ordered;
@@ -146,12 +149,6 @@ $$;
146149

147150
ALTER PROCEDURE doma_panda.update_worker_node_metrics() OWNER TO panda;
148151

149-
-- Drop the old cron schedule
150-
SELECT cron.unschedule(
151-
(SELECT jobid FROM cron.job WHERE command = 'CALL doma_panda.update_worker_node_map()')
152-
);
153-
154-
155152
-- Add columns
156153
ALTER TABLE doma_panda.worker_node
157154
ADD COLUMN cpu_model_normalized VARCHAR(128);
@@ -172,4 +169,4 @@ TRUNCATE TABLE doma_panda.pandadb_version;
172169

173170
INSERT INTO doma_panda.pandadb_version (component, major, minor, patch)
174171
VALUES ('PanDA', 0, 0, 30);
175-
commit;
172+
COMMIT;

0 commit comments

Comments
 (0)