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

Commit 35af5fb

Browse files
author
Vladimir Ershov
committed
fix resubmit at null
1 parent 8dc4755 commit 35af5fb

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

src/scheduler_job.c

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -588,10 +588,34 @@ int set_at_job_done(job_t *job, char *error, int64 resubmit, char **set_error)
588588
spi_response_t *r2;
589589
spi_response_t *r3;
590590

591-
const char *get_sql = "select * from at_jobs_process where id = $1";
592-
const char *insert_sql = "insert into at_jobs_done values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21)";
591+
592+
593+
594+
const char *get_sql = "\
595+
select \
596+
id, node, name, comments, at, do_sql, params, depends_on, \
597+
executor, owner, last_start_available, attempt, resubmit_limit, \
598+
postpone, max_run_time, canceled, submit_time, start_time \
599+
from at_jobs_process where id = $1";
600+
601+
const char *insert_sql = "\
602+
insert into at_jobs_done \
603+
(id, node, name, comments, at, do_sql, params, depends_on, \
604+
executor, owner, last_start_available, attempt, resubmit_limit, \
605+
postpone, max_run_time, canceled, submit_time, start_time, \
606+
status, reason, done_time) \
607+
values ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, \
608+
$15, $16, $17, $18, $19, $20, $21)";
593609
const char *delete_sql = "delete from at_jobs_process where id = $1";
594-
const char *resubmit_sql = "insert into at_jobs_submitted values($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17)";
610+
611+
const char *resubmit_sql = "\
612+
insert into at_jobs_submitted \
613+
(id, node, name, comments, at, do_sql, params, depends_on, \
614+
executor, owner, last_start_available, attempt, resubmit_limit, \
615+
postpone, max_run_time, canceled, submit_time) \
616+
values \
617+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, \
618+
$15, $16, $17)";
595619

596620
oldpath = set_schema(NULL, true);
597621

@@ -636,7 +660,7 @@ int set_at_job_done(job_t *job, char *error, int64 resubmit, char **set_error)
636660
{
637661
if(canceled)
638662
{
639-
this_error = _mcopy_string(CurrentMemoryContext, "job was canceled while processing: cannot resubmit");
663+
this_error = _mcopy_string(CurrentMemoryContext, "job was cancelled while processing: cannot resubmit");
640664
sql = insert_sql;
641665
n = 21;
642666

@@ -649,6 +673,7 @@ int set_at_job_done(job_t *job, char *error, int64 resubmit, char **set_error)
649673
sql = resubmit_sql;
650674
values[4] = TimestampTzGetDatum(timestamp_add_seconds(0, resubmit));
651675
values[11] = Int64GetDatum(job->attempt + 1);
676+
nulls[4] = nulls[11] = ' ';
652677
n = 17;
653678
}
654679
else

0 commit comments

Comments
 (0)