Skip to content

2.27.0.0-b409

@pkj415 pkj415 tagged this 04 Aug 22:44
Summary:
Before this change, `COPY FROM`/ `TO` commands were being retried by the query
layer for kConflict/ kReadRestart/ kAborted errors. This can lead to a
few issues:

(1) If data is streamed to a `COPY FROM` (e.g., from `STDIN`), then a retry
would start reading from where it left off. So, previous rows that weren't yet
committed and faced an error would be missed.

(2) A `COPY FROM` could face an issue in reading the data due to
incorrect format. For example, it might expect to read the header
on the retry but not find it.

(3) Even if a data file was specified to a `COPY FROM`, retries should
be avoided because `COPY FROM` is not atomic (it is split into
multiple transactions based on the `ROWS_PER_TRANSACTION` setting) when
outside a transaction block. So, we could end up retrying some rows that
were already committed.

Similar but slightly different issues apply to `COPY TO`.
Jira: DB-17719

Test Plan:
./yb_build.sh release --cxx-test pgwrapper_pg_copy-test --gtest_filter PgCopyTest.TestRetriesAreDisabledForCopy

Without the fix, the test fails with the `COPY file signature not recognized` error.

Reviewers: smishra, sanketh

Reviewed By: sanketh

Subscribers: yql

Differential Revision: https://phorge.dev.yugabyte.com/D45700
Assets 2
Loading