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

Commit 6ad88b9

Browse files
author
Vladimir Ershov
committed
fix shutdown failure, reduce log garbage
1 parent 6cf00c3 commit 6ad88b9

File tree

4 files changed

+13
-14
lines changed

4 files changed

+13
-14
lines changed

src/pgpro_scheduler.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,12 @@ void reload_db_role_config(char *dbname)
8080
StartTransactionCommand();
8181
databaseid = get_database_oid(dbname, false);
8282

83-
elog(LOG, "start read");
8483
relsetting = heap_open(DbRoleSettingRelationId, AccessShareLock);
8584
snapshot = RegisterSnapshot(GetCatalogSnapshot(DbRoleSettingRelationId));
8685
ApplySetting(snapshot, databaseid, InvalidOid, relsetting, PGC_S_DATABASE);
8786
UnregisterSnapshot(snapshot);
8887
heap_close(relsetting, AccessShareLock);
8988
CommitTransactionCommand();
90-
elog(LOG, "got read");
9189
}
9290

9391
TimestampTz timestamp_add_seconds(TimestampTz to, int add)

src/sched_manager_poll.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,8 @@ int stopAllManagers(schd_managers_poll_t *poll)
114114
PGPROC *child;
115115
schd_manager_share_t *shared;
116116

117+
if(poll->n == 0) return 0;
118+
117119
elog(LOG, "Scheduler stops all managers");
118120

119121
for(i=0; i < poll->n; i++)
@@ -136,6 +138,7 @@ int stopAllManagers(schd_managers_poll_t *poll)
136138
{
137139
destroyManagerRecord(poll->workers[i]);
138140
}
141+
139142
pfree(poll->workers);
140143
poll->workers = NULL;
141144
poll->n = 0;

src/scheduler_executor.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,14 @@ void executor_worker_main(Datum arg)
147147
status = SchdExecutorError;
148148
if(error)
149149
{
150-
push_executor_error(&EE, "error on %d: %s", i+1, error);
150+
push_executor_error(&EE, "error in command #%d: %s",
151+
i+1, error);
151152
pfree(error);
152153
}
153154
else
154155
{
155-
push_executor_error(&EE, "error on %d: code: %d", i+1, ret);
156+
push_executor_error(&EE, "error in command #%d: code: %d",
157+
i+1, ret);
156158
}
157159
ABORT_SPI_SNAP();
158160
SetConfigOption("schedule.transaction_state", "failure", PGC_INTERNAL, PGC_S_SESSION);

src/scheduler_manager.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,9 @@ int refresh_scheduler_manager_context(scheduler_manager_ctx_t *ctx)
152152
scheduler_manager_slot_t **old;
153153

154154
N = get_scheduler_maxworkers();
155-
elog(LOG, "max-workers: %d", N);
156155
if(N != ctx->slots_len)
157156
{
158-
elog(LOG, "Change available workers number %d => %d", ctx->slots_len, N);
157+
elog(LOG, "Scheduler Manager %s: Change available workers number %d => %d", ctx->database, ctx->slots_len, N);
159158
}
160159

161160
if(N > ctx->slots_len)
@@ -315,8 +314,8 @@ scheduler_task_t *scheduler_get_active_tasks(scheduler_manager_ctx_t *ctx, int *
315314
}
316315
else if(ret != SPI_OK_SELECT)
317316
{
318-
elog(LOG, "Scheduler manager: %s: cannot get \"at\" tasks: error code %d",
319-
MyBgworkerEntry->bgw_name, ret);
317+
elog(LOG, "Scheduler manager %s: cannot get \"at\" tasks: error code %d",
318+
ctx->database, ret);
320319

321320
scheduler_manager_stop(ctx);
322321
return NULL;
@@ -1048,8 +1047,8 @@ int scheduler_vanish_expired_jobs(scheduler_manager_ctx_t *ctx)
10481047
move_ret = move_job_to_log(&expired[i], 0);
10491048
if(move_ret < 0)
10501049
{
1051-
elog(LOG, "Scheduler manager: cannot move job %d@%s:00 to log",
1052-
expired[i].cron_id, ts);
1050+
elog(LOG, "Scheduler manager %s: cannot move job %d@%s:00 to log",
1051+
ctx->database, expired[i].cron_id, ts);
10531052
ret--;
10541053
}
10551054
pfree(ts);
@@ -1235,7 +1234,7 @@ bool check_parent_stop_signal(scheduler_manager_ctx_t *ctx)
12351234
shared->setbyparent = false;
12361235
if(shared->status == SchdManagerStop)
12371236
{
1238-
elog(LOG, "Scheduler manager: receive stop signal from supervisor");
1237+
elog(LOG, "Scheduler manager %s: receive stop signal from supervisor", ctx->database);
12391238
return true;
12401239
}
12411240
}
@@ -1323,12 +1322,9 @@ void manager_worker_main(Datum arg)
13231322
if(rc & WL_POSTMASTER_DEATH) proc_exit(1);
13241323
if(got_sighup)
13251324
{
1326-
elog(LOG, "manager got sighup");
13271325
got_sighup = false;
13281326
ProcessConfigFile(PGC_SIGHUP);
1329-
elog(LOG, "DONE CONFIG");
13301327
reload_db_role_config(database);
1331-
elog(LOG, "DONE role");
13321328
refresh_scheduler_manager_context(ctx);
13331329
set_slots_stat_report(ctx);
13341330
}

0 commit comments

Comments
 (0)