Unverified Commit 9db10402 authored by Dimitri Fontaine's avatar Dimitri Fontaine Committed by GitHub
Browse files

Review the COPY arguments API to fix TRUNCATE calls. (#597)

The code to call TRUNCATE ONLY was only active for tables setup with COPY
partitioning (--split-tables-larger-than), and was forced to "false" for the
other tables.

The code also evolved in a way that it would build a sub-SELECT query with
the table attribute list as the "srcQname" argument to the pgsql.c internal
bits for the copy, making it impossible to then re-use that bit in the sql
command for the TRUNCATE operation.

To fix, implement a new way to prepare the COPY query bits and pieces so
that we can re-use the qualified table name in the TRUNCATE command and also
build a full COPY (SELECT a, b, c FROM ONLY t WHERE ...) TO STDOUT; query.

In passing, because of the way we are changing the summary files to use our
internal SQLite database instead, also push the TRUNCATE command of COPY
partitionned table to the COPY supervisor process. This is a better way to
solve the concurrency issues and make sure that TRUNCATE is done only once,
and also finished before any of the copy-data worker processes get started.
parent 30a87a7f
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment