Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/spock_apply.c
Original file line number Diff line number Diff line change
Expand Up @@ -1226,6 +1226,13 @@ handle_insert(StringInfo s)
*/
xact_had_exception = true;
exception_command_counter++;

/*
* Clear the local tuple pointer if it was left over from a
* previous operation.
*/
exception_log_ptr[my_exception_log_index].local_tuple = NULL;

log_insert_exception(true, "Spock can't find relation", NULL,
NULL, NULL, "INSERT");
end_replication_step();
Expand Down Expand Up @@ -3259,6 +3266,12 @@ static void
execute_sql_command_error_cb(void *arg)
{
errcontext("during execution of queued SQL statement: %s", (char *) arg);
/*
* The errcontext above already includes the SQL statement, so clear
* debug_query_string to prevent it from appearing a second time in
* the LOG output.
*/
debug_query_string = NULL;
}

/*
Expand Down Expand Up @@ -3779,6 +3792,13 @@ spock_apply_main(Datum main_arg)
Assert(MySpockWorker->worker_type == SPOCK_WORKER_APPLY);
MyApplyWorker = &MySpockWorker->worker.apply;

/*
* The apply worker is not a regular backend and has no client query
* string. Initialize debug_query_string to NULL so that LOG reports
* do not print arbitrary memory contents.
*/
debug_query_string = NULL;

/* Setup synchronous commit according to the user's wishes */
SetConfigOption("synchronous_commit",
spock_synchronous_commit ? "local" : "off",
Expand Down