Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitef317bc

Browse files
author
Oleg Ivanov
committed
Merge commit '05c7c27fa6574301d374bbd0b6db3ef3b7b6ada5' into PGPROEE9_6_aqo
2 parentse1c0748 +05c7c27 commitef317bc

File tree

14 files changed

+129
-10
lines changed

14 files changed

+129
-10
lines changed

‎contrib/pgpro_scheduler/Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ OBJS = src/pgpro_scheduler.o src/cron_string.o src/sched_manager_poll.o \
66
$(WIN32RES)
77
EXTENSION = pgpro_scheduler
88
DATA = pgpro_scheduler--1.0.sql
9-
#SCRIPTS = bin/pgpro_scheduler
10-
#REGRESS= install_pgpro_scheduler cron_string
11-
#REGRESS_OPTS = --create-role=robot --user=postgres
12-
#CFLAGS=-ggdb -Og -g3 -fno-omit-frame-pointer
9+
REGRESS= install_pgpro_scheduler cron_string
10+
#REGRESS_OPTS = --user=postgres
11+
EXTRA_REGRESS_OPTS=--temp-config=$(top_srcdir)/$(subdir)/conf.add
1312

1413
ifdefUSE_PGXS
1514
PG_CONFIG = pg_config

‎contrib/pgpro_scheduler/conf.add

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shared_preload_libraries='pgpro_scheduler'
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
create user __temp_robot;
2+
select schedule.create_job(
3+
'{
4+
"name": "Test @reboot",
5+
"cron": "@reboot",
6+
"command": "show all",
7+
"run_as": "__temp_robot"
8+
}'
9+
);
10+
create_job
11+
------------
12+
1
13+
(1 row)
14+
15+
select schedule.create_job(
16+
'{
17+
"name": "Test 1",
18+
"cron": "* * * * *",
19+
"command": "select ''this is every minute job''",
20+
"run_as": "__temp_robot",
21+
"last_start_available": "2 hours"
22+
}'
23+
);
24+
create_job
25+
------------
26+
2
27+
(1 row)
28+
29+
select schedule.create_job(
30+
'{
31+
"name": "Test 2 4/4 2/4 * * *",
32+
"cron": "4/4 2/4 * * *",
33+
"command": "select pg_sleep(10)",
34+
"run_as": "__temp_robot"
35+
}'
36+
);
37+
create_job
38+
------------
39+
3
40+
(1 row)
41+
42+
select schedule.create_job(
43+
'{
44+
"name": "Test 3",
45+
"cron": "23 1 * * THU,SUN",
46+
"command": "select ''ok'' as ok"
47+
}'
48+
);
49+
create_job
50+
------------
51+
4
52+
(1 row)
53+
54+
select id,node,name,rule,do_sql,same_transaction, postpone,retry from schedule.cron order by id;
55+
id | node | name | rule | do_sql | same_transaction | postpone | retry
56+
----+--------+----------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+---------------------------------------+------------------+-----------+-------
57+
1 | master | Test @reboot | {"crontab": "@reboot", "onstart": 1} | {"show all"} | f | | 0
58+
2 | master | Test 1 | {"days": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], "hours": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23], "wdays": [0, 1, 2, 3, 4, 5, 6], "months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "crontab": "* * * * *", "minutes": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]} | {"select 'this is every minute job'"} | f | @ 2 hours | 0
59+
3 | master | Test 2 4/4 2/4 * * * | {"days": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], "hours": [2, 6, 10, 14, 18, 22], "wdays": [0, 1, 2, 3, 4, 5, 6], "months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "crontab": "4/4 2/4 * * *", "minutes": [4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56]} | {"select pg_sleep(10)"} | f | | 0
60+
4 | master | Test 3 | {"days": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31], "hours": [1], "wdays": [0, 4], "months": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], "crontab": "23 1 * * THU,SUN", "minutes": [23]} | {"select 'ok' as ok"} | f | | 0
61+
(4 rows)
62+
63+
drop user __temp_robot;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION pgpro_scheduler;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
createuser__temp_robot;
2+
selectschedule.create_job(
3+
'{
4+
"name": "Test @reboot",
5+
"cron": "@reboot",
6+
"command": "show all",
7+
"run_as": "__temp_robot"
8+
}'
9+
);
10+
11+
selectschedule.create_job(
12+
'{
13+
"name": "Test 1",
14+
"cron": "* * * * *",
15+
"command": "select''this is every minute job''",
16+
"run_as": "__temp_robot",
17+
"last_start_available": "2 hours"
18+
}'
19+
);
20+
21+
selectschedule.create_job(
22+
'{
23+
"name": "Test 2 4/4 2/4 * * *",
24+
"cron": "4/4 2/4 * * *",
25+
"command": "select pg_sleep(10)",
26+
"run_as": "__temp_robot"
27+
}'
28+
);
29+
30+
selectschedule.create_job(
31+
'{
32+
"name": "Test 3",
33+
"cron": "23 1 * * THU,SUN",
34+
"command": "select''ok'' as ok"
35+
}'
36+
);
37+
38+
select id,node,name,rule,do_sql,same_transaction, postpone,retryfromschedule.cronorder by id;
39+
40+
41+
dropuser __temp_robot;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE EXTENSION pgpro_scheduler;

‎contrib/pgpro_scheduler/src/cron_string.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include<stdarg.h>
55
#include"cron_string.h"
66
#include"postgres.h"
7+
#include"port.h"
78

89

910
char*cps_month_subst_data[12]= {"JAN","FEB","MAR","APR","MAY","JUN","JUL","AUG","SEP","OCT","NOV","DEC" };
@@ -18,7 +19,7 @@ void _cps_set_error(int num, const char *message, ...)
1819

1920
cps_error=num;
2021
va_start(arglist,message);
21-
vsnprintf(cps_error_buffer,512,message,arglist);
22+
pvsnprintf(cps_error_buffer,512,message,arglist);
2223
va_end(arglist);
2324
}
2425

‎contrib/pgpro_scheduler/src/pgpro_scheduler.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include"postgres.h"
2+
#include"port.h"
23

34
#include"miscadmin.h"
45
#include"postmaster/bgworker.h"
@@ -380,7 +381,7 @@ pg_scheduler_startup(void)
380381
{
381382
BackgroundWorkerworker;
382383

383-
elog(LOG,"Start PostgresPro scheduler");
384+
elog(LOG,"Start PostgresPro scheduler.");
384385

385386
worker.bgw_flags=BGWORKER_SHMEM_ACCESS |
386387
BGWORKER_BACKEND_DATABASE_CONNECTION;

‎contrib/pgpro_scheduler/src/scheduler_executor.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
#include"memutils.h"
3131
#include"utils/elog.h"
3232

33+
#include"port.h"
34+
3335
externvolatilesig_atomic_tgot_sighup;
3436
externvolatilesig_atomic_tgot_sigterm;
3537

@@ -462,7 +464,7 @@ int push_executor_error(executor_error_t *e, char *fmt, ...)
462464
intlen;
463465

464466
va_start(arglist,fmt);
465-
len=vsnprintf(buf,1024,fmt,arglist);
467+
len=pvsnprintf(buf,1024,fmt,arglist);
466468
va_end(arglist);
467469

468470
if(e->n==0)

‎contrib/pgpro_scheduler/src/scheduler_job.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include"utils/timestamp.h"
1010
#include"utils/builtins.h"
1111
#include"memutils.h"
12+
#include"port.h"
1213

1314
job_t*init_scheduler_job(job_t*j)
1415
{
@@ -100,7 +101,7 @@ job_t *set_job_error(job_t *j, const char *fmt, ...)
100101
charbuf[1024];
101102

102103
va_start(arglist,fmt);
103-
vsnprintf(buf,1024,fmt,arglist);
104+
pvsnprintf(buf,1024,fmt,arglist);
104105
va_end(arglist);
105106

106107
if(j->error)pfree(j->error);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp