Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 5b404fa

Browse files
author
Vladimir Ershov
committed
Merge commit '8dc4755a44ef549e6be85bc441657f6d2e4fc28f' into PGPROEE10_scheduler
2 parents 66295de + 8dc4755 commit 5b404fa

22 files changed

+185
-8
lines changed

contrib/pgpro_scheduler/src/bit_array.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* bit_array.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdlib.h>
210
#include "bit_array.h"
311
#include "postgres.h"

contrib/pgpro_scheduler/src/bit_array.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* bit_array.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_BITARRAY_H
210
#define PGPRO_SCHEDULER_BITARRAY_H
311

contrib/pgpro_scheduler/src/char_array.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* char_array.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdio.h>
210
#include <stdlib.h>
311
#include "postgres.h"

contrib/pgpro_scheduler/src/char_array.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* char_array.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef CHAR_ARRAY_H
210
#define CHAR_ARRAY_H
311

contrib/pgpro_scheduler/src/cron_string.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* cron_string.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdio.h>
210
#include <stdlib.h>
311
#include <string.h>

contrib/pgpro_scheduler/src/cron_string.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* cron_string.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef CRON_STRING_PARSE_H
210
#define CRON_STRING_PARSE_H
311

contrib/pgpro_scheduler/src/memutils.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* memutils.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include "postgres.h"
210
#include "utils/memutils.h"
311
#include "memutils.h"

contrib/pgpro_scheduler/src/memutils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* memutils.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_MEMUTILS_H
210
#define PGPRO_SCHEDULER_MEMUTILS_H
311

contrib/pgpro_scheduler/src/pgpro_scheduler.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* pgpro_scheduler.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#define ENABLE_LIST_COMPAT 1
210

311
#include "postgres.h"

contrib/pgpro_scheduler/src/pgpro_scheduler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* pgpro_scheduler.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_H
210
#define PGPRO_SCHEDULER_H
311

contrib/pgpro_scheduler/src/sched_manager_poll.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* sched_manager_poll.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdlib.h>
210
#include "postgres.h"
311
#include "string.h"

contrib/pgpro_scheduler/src/sched_manager_poll.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* sched_manager_poll.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_MANAGER_POLL_H
210
#define PGPRO_SCHEDULER_MANAGER_POLL_H
311

contrib/pgpro_scheduler/src/scheduler_executor.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_executor.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdlib.h>
210
#include <stdarg.h>
311
#include "postgres.h"

contrib/pgpro_scheduler/src/scheduler_executor.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_executor.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_EXECUTOR_H
210
#define PGPRO_SCHEDULER_EXECUTOR_H
311

contrib/pgpro_scheduler/src/scheduler_job.c

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_job.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdio.h>
210
#include <string.h>
311
#include <stdarg.h>
@@ -180,14 +188,15 @@ job_t *get_at_job_for_process(MemoryContext mem, char *nodename, char **error)
180188
get_job_sql = makeStringInfo();
181189
getNodesToSelect(&nodes, nodename);
182190

183-
appendStringInfo(get_job_sql, "select * from at_jobs_submitted s where \
184-
((not exists ( select * from at_jobs_submitted s2 where \
185-
s2.id = any(s.depends_on)) AND not exists \
186-
( select * from at_jobs_process p where p.id = any(s.depends_on)) AND \
187-
s.depends_on is NOT NULL and s.at IS NULL AND not exists \
188-
( select * from at_jobs_done d where d.id = any(s.depends_on) and \
189-
d.status=false) AND coalesce(s.at, now()) <= now()) OR ( s.at IS NOT NULL AND at <= now() and \
190-
(last_start_available is NULL OR last_start_available > now()))) and \
191+
appendStringInfo(get_job_sql, "select * \
192+
from at_jobs_submitted s \
193+
where (s.depends_on is null \
194+
or not exists (select * from at_jobs_submitted s2 where s2.id = any(s.depends_on)) \
195+
AND not exists(select * from at_jobs_process p where p.id = any(s.depends_on)) \
196+
AND not exists(select * from at_jobs_done d where d.id = any(s.depends_on) and d.status=false) \
197+
) \
198+
and coalesce(s.at, now()) <= now() \
199+
and (s.last_start_available is null or s.last_start_available>now()) and \
191200
node %s and not canceled order by at, submit_time \
192201
limit 1 FOR UPDATE SKIP LOCKED ", nodes.cond);
193202

contrib/pgpro_scheduler/src/scheduler_job.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_job.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_JOB_H
210
#define PGPRO_SCHEDULER_JOB_H
311

contrib/pgpro_scheduler/src/scheduler_manager.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_manager.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include <stdlib.h>
210
#include "postgres.h"
311

contrib/pgpro_scheduler/src/scheduler_manager.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_manager.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_MANAGER_H
210
#define PGPRO_SCHEDULER_MANAGER_H
311

contrib/pgpro_scheduler/src/scheduler_mtm.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_mtm.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifdef _WITH_MTM
210

311
/* This code is aimed to interact with Postgres Pro Multimaster extension

contrib/pgpro_scheduler/src/scheduler_mtm.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_mtm.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifdef _WITH_MTM
210
#ifndef SCHEDULER_MTM_H
311
#define SCHEDULER_MTM_H

contrib/pgpro_scheduler/src/scheduler_spi_utils.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_spi_utils.c
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#include "postgres.h"
210
#include "fmgr.h"
311
#include "executor/spi.h"

contrib/pgpro_scheduler/src/scheduler_spi_utils.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
/*-------------------------------------------------------------------------
2+
*
3+
* scheduler_spi_utils.h
4+
*
5+
* Copyright (c) 2017-2018, Postgres Professional
6+
*
7+
*-------------------------------------------------------------------------
8+
*/
19
#ifndef PGPRO_SCHEDULER_SPI_H
210
#define PGPRO_SCHEDULER_SPI_H
311

0 commit comments

Comments
 (0)