Skip to content

Commit 96e6b7e

Browse files
Merge pull request #113 from PanDAWMS/v0.0.30
v0.0.30
2 parents 4e6e4b4 + e79839c commit 96e6b7e

6 files changed

Lines changed: 52 additions & 14 deletions

File tree

schema/oracle/ATLAS_PANDA.sql

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,7 @@
3434
-- IMPORTANT: Please always update to up2date version
3535
--------------------------------------------------------
3636

37-
INSERT INTO "ATLAS_PANDA"."PANDADB_VERSION" VALUES ('SERVER', 0, 0, 29);
38-
INSERT INTO "ATLAS_PANDA"."PANDADB_VERSION" VALUES ('JEDI', 0, 0, 29);
39-
37+
INSERT INTO "ATLAS_PANDA"."PANDADB_VERSION" VALUES ('PanDA', 0, 0, 30);
4038
--------------------------------------------------------
4139
-- DDL for Sequence FILESTABLE4_ROW_ID_SEQ
4240
--------------------------------------------------------
@@ -936,7 +934,7 @@ CREATE TABLE "ATLAS_PANDA"."GLOBAL_SHARES_AUDIT"
936934
"WORKQUEUE_ID" NUMBER(5,0),
937935
"PROGRESS" NUMBER(3,0),
938936
"FAILURERATE" NUMBER(3,0),
939-
"ERRORDIALOG" VARCHAR2(255 BYTE),
937+
"ERRORDIALOG" VARCHAR2(510 BYTE),
940938
"COUNTRYGROUP" VARCHAR2(20 BYTE),
941939
"PARENT_TID" NUMBER(12,0),
942940
"EVENTSERVICE" NUMBER(1,0),
@@ -5056,7 +5054,7 @@ BEGIN
50565054
JOIN ATLAS_PANDA.JEDI_Events PARTITION ('||p.PARTITION_NAME||') e
50575055
ON (t.JEDITASKID = e.JEDITASKID)
50585056
WHERE t.STATUS IN (''done'', ''finished'', ''aborted'', ''failed'', ''broken'')
5059-
AND t.MODIFICATIONTIME < sysdate - 90' into taskid_cnt;
5057+
AND t.MODIFICATIONTIME < sysdate - 30' into taskid_cnt;
50605058

50615059
if (rows_cnt = taskid_cnt and rows_cnt <> 0) then
50625060
--dbms_output.put_line('ALTER TABLE ATLAS_PANDA.JEDI_Events DROP PARTITION '||p.PARTITION_NAME||' update global indexes;');

schema/postgres/panda_db_init.sh

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ echo
2222

2323
# check schema version
2424
LATEST_VERSION=$(cat ${DIR}/version)
25-
CURRENT_VERSION=$(psql -d panda_db -U postgres -tc "SELECT major || '.' || minor || '.' || patch FROM doma_panda.pandadb_version WHERE component = 'SERVER'" || true)
25+
CURRENT_VERSION=$(psql -d panda_db -U postgres -tc "SELECT major || '.' || minor || '.' || patch FROM doma_panda.pandadb_version WHERE component = 'PanDA'" || true)
2626

2727
IFS='.' read -r MAJOR MINOR PATCH <<< "$LATEST_VERSION"
2828

@@ -45,8 +45,7 @@ else
4545
fi
4646
done
4747
# update version
48-
psql -d panda_db -U postgres -c "UPDATE doma_panda.pandadb_version set major='${MAJOR}', minor='${MINOR}', patch='${PATCH}' WHERE component = 'SERVER'"
49-
psql -d panda_db -U postgres -c "UPDATE doma_panda.pandadb_version set major='${MAJOR}', minor='${MINOR}', patch='${PATCH}' WHERE component = 'JEDI'"
48+
psql -d panda_db -U postgres -c "UPDATE doma_panda.pandadb_version set major='${MAJOR}', minor='${MINOR}', patch='${PATCH}' WHERE component = 'PanDA'"
5049
echo ========== updated to the latest schema "$LATEST_VERSION"
5150
exit 0
5251
fi
@@ -72,9 +71,7 @@ do
7271
done
7372

7473
echo ========== adding the schema version "$LATEST_VERSION"
75-
psql -d panda_db -U postgres -c "INSERT INTO doma_panda.pandadb_version (component, major, minor, patch) VALUES('SERVER', '${MAJOR}', '${MINOR}', '${PATCH}')"
76-
psql -d panda_db -U postgres -c "INSERT INTO doma_panda.pandadb_version (component, major, minor, patch) VALUES('JEDI', '${MAJOR}', '${MINOR}', '${PATCH}')"
77-
74+
psql -d panda_db -U postgres -c "INSERT INTO doma_panda.pandadb_version (component, major, minor, patch) VALUES('PanDA', '${MAJOR}', '${MINOR}', '${PATCH}')"
7875

7976
echo ========== post step
8077
psql -U postgres -d panda_db -f $DIR/post_step_panda.sql

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,47 @@
11
-- patch to be used to upgrade from version 0.0.29
2+
ALTER TABLE doma_panda.jeditasks
3+
ALTER COLUMN errordialog VARCHAR(510);
4+
5+
CREATE OR REPLACE PROCEDURE doma_panda.delete_jedi_events_proc () AS $body$
6+
DECLARE
7+
8+
rows_cnt bigint;
9+
taskid_cnt bigint;
10+
--row_sum bigint := 0;
11+
--part_cnt bigint := 1;
12+
p RECORD;
13+
14+
BEGIN
15+
EXECUTE 'alter session set ddl_lock_timeout=30';
16+
17+
for p in (select PARTITION_NAME from user_tab_partitions where table_name = 'JEDI_EVENTS') loop
18+
19+
EXECUTE 'SELECT COUNT(*) FROM doma_panda.JEDI_Events PARTITION ('||p.PARTITION_NAME||')' into STRICT rows_cnt;
20+
21+
EXECUTE 'SELECT COUNT(*)
22+
FROM doma_panda.JEDI_Tasks t
23+
JOIN doma_panda.JEDI_Events PARTITION ('||p.PARTITION_NAME||') e
24+
ON (t.JEDITASKID = e.JEDITASKID)
25+
WHERE t.STATUS IN (''done'', ''finished'', ''aborted'', ''failed'', ''broken'')
26+
AND t.MODIFICATIONTIME < sysdate - 30' into STRICT taskid_cnt;
27+
28+
if (rows_cnt = taskid_cnt and rows_cnt <> 0) then
29+
--dbms_output.put_line('ALTER TABLE doma_panda.JEDI_Events DROP PARTITION '||p.PARTITION_NAME||' update global indexes;');
30+
EXECUTE 'ALTER TABLE doma_panda.JEDI_Events DROP PARTITION '||p.PARTITION_NAME;
31+
--dbms_output.put_line(part_cnt||' '||p.PARTITION_NAME||' >>> '||rows_cnt);
32+
--row_sum := row_sum + taskid_cnt;
33+
--part_cnt := part_cnt + 1;
34+
end if;
35+
36+
end loop;
37+
--dbms_output.put_line(row_sum);
38+
END;
39+
$body$
40+
LANGUAGE PLPGSQL
41+
SECURITY DEFINER
42+
;
43+
ALTER PROCEDURE delete_jedi_events_proc () OWNER TO panda;
44+
245
-- Drop the old procedure
346
DROP PROCEDURE IF EXISTS doma_panda.update_worker_node_map();
447

schema/postgres/sqls/pg_PANDA_SCHEDULER_JOBS.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ BEGIN
689689
JOIN doma_panda.JEDI_Events PARTITION ('||p.PARTITION_NAME||') e
690690
ON (t.JEDITASKID = e.JEDITASKID)
691691
WHERE t.STATUS IN (''done'', ''finished'', ''aborted'', ''failed'', ''broken'')
692-
AND t.MODIFICATIONTIME < sysdate - 90' into STRICT taskid_cnt;
692+
AND t.MODIFICATIONTIME < sysdate - 30' into STRICT taskid_cnt;
693693

694694
if (rows_cnt = taskid_cnt and rows_cnt <> 0) then
695695
--dbms_output.put_line('ALTER TABLE doma_panda.JEDI_Events DROP PARTITION '||p.PARTITION_NAME||' update global indexes;');

schema/postgres/sqls/pg_PANDA_TABLE.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ CREATE TABLE jedi_tasks (
875875
workqueue_id integer,
876876
progress smallint,
877877
failurerate smallint,
878-
errordialog varchar(255),
878+
errordialog varchar(510),
879879
countrygroup varchar(20),
880880
parent_tid bigint,
881881
eventservice smallint,

schema/postgres/version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.29
1+
0.0.30

0 commit comments

Comments
 (0)