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

Commit 36bf629

Browse files
author
Vladimir Ershov
committed
do not do truncate at start due to multimaster
1 parent 1b8cff0 commit 36bf629

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/scheduler_manager.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,16 +1617,23 @@ int scheduler_make_atcron_record(scheduler_manager_ctx_t *ctx)
16171617
void clean_at_table(scheduler_manager_ctx_t *ctx)
16181618
{
16191619
spi_response_t *r;
1620+
Oid argtypes[1] = {TEXTOID};
1621+
Datum args[1];
16201622
MemoryContext mem = init_mem_ctx("clean ctx");
16211623

1624+
args[0] = PointerGetDatum(cstring_to_text(ctx->nodename));
1625+
16221626
START_SPI_SNAP();
1623-
r = execute_spi(mem, "truncate at");
1627+
r = execute_spi_sql_with_args(mem,
1628+
"delete from at where node = $1", 1, argtypes, args, NULL);
16241629
if(r->retval < 0)
16251630
{
16261631
manager_fatal_error(ctx, 0, "Cannot clean 'at' table: %s", r->error);
16271632
}
16281633
destroy_spi_data(r);
1629-
r = execute_spi(mem, "update cron set _next_exec_time = NULL where _next_exec_time is not NULL");
1634+
r = execute_spi_sql_with_args(mem,
1635+
"update cron set _next_exec_time = NULL where _next_exec_time is not NULL and node = $1",
1636+
1, argtypes, args, NULL);
16301637
if(r->retval < 0)
16311638
{
16321639
manager_fatal_error(ctx, 0, "Cannot clean cron _next time: %s",

0 commit comments

Comments
 (0)