Skip to content

Commit fc5e74a

Browse files
author
Vladimir Ershov
committed
Merge commit '8e8475aad70c0baf6a2711791539ffdde4e280aa' into PGPROEE9_6_scheduler
2 parents f775ad3 + 8e8475a commit fc5e74a

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

contrib/pgpro_scheduler/pgpro_scheduler--2.0.sql

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,14 @@ CREATE TABLE at_jobs_submitted(
2525
canceled boolean default false,
2626
submit_time timestamp with time zone default now()
2727
);
28-
CREATE INDEX at_jobs_submitted_node_at_idx on at_jobs_submitted (node, at);
28+
CREATE INDEX ON at_jobs_submitted(at,submit_time);
29+
CREATE INDEX ON at_jobs_submitted (last_start_available, node);
2930

3031
CREATE TABLE at_jobs_process(
3132
start_time timestamp with time zone default now()
3233
) INHERITS (at_jobs_submitted);
3334

35+
ALTER TABLE at_jobs_process ADD primary key (id);
3436
CREATE INDEX at_jobs_process_node_at_idx on at_jobs_process (node, at);
3537

3638
CREATE TABLE at_jobs_done(
@@ -39,6 +41,7 @@ CREATE TABLE at_jobs_done(
3941
done_time timestamp with time zone default now()
4042
) INHERITS (at_jobs_process);
4143

44+
ALTER TABLE at_jobs_done ADD primary key (id);
4245
CREATE INDEX at_jobs_done_node_at_idx on at_jobs_done (node, at);
4346

4447
CREATE TABLE cron(
@@ -64,6 +67,7 @@ CREATE TABLE cron(
6467
reason text,
6568
_next_exec_time timestamp with time zone
6669
);
70+
create index on cron (node);
6771

6872
CREATE TABLE at(
6973
start_at timestamp with time zone,

contrib/pgpro_scheduler/src/scheduler_manager.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,6 +1492,7 @@ void manager_worker_main(Datum arg)
14921492
ctx = initialize_scheduler_manager_context(database, seg);
14931493
clean_at_table(ctx);
14941494
set_slots_stat_report(ctx);
1495+
SetConfigOption("enable_seqscan", "off", PGC_USERSET, PGC_S_SESSION);
14951496

14961497
while(!got_sigterm)
14971498
{
@@ -1509,7 +1510,7 @@ void manager_worker_main(Datum arg)
15091510
if(!got_sighup && !got_sigterm)
15101511
{
15111512
terminate_main_loop = 0;
1512-
while(1)
1513+
while(!got_sighup && !got_sigterm)
15131514
{
15141515
wait = 0;
15151516
if(check_parent_stop_signal(ctx))
@@ -1521,11 +1522,12 @@ void manager_worker_main(Datum arg)
15211522
wait += scheduler_start_jobs(ctx, CronJob);
15221523
scheduler_check_slots(ctx, &(ctx->at));
15231524
scheduler_check_slots(ctx, &(ctx->cron));
1524-
set_slots_stat_report(ctx);
1525+
scheduler_make_atcron_record(ctx);
1526+
/* set_slots_stat_report(ctx); */
15251527
if(wait == 0) break;
15261528
}
15271529
if(terminate_main_loop) break;
1528-
scheduler_make_atcron_record(ctx);
1530+
set_slots_stat_report(ctx);
15291531
/* if there are any expired jobs to get rid of */
15301532
scheduler_vanish_expired_jobs(ctx, AtJob);
15311533
scheduler_vanish_expired_jobs(ctx, CronJob);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy