On 2026-Nov-23, Aleksander Alekseev wrote:

> Hi,
> 
> > I revised the patch based on the discussion. Instead of introducing
> > a separate CopyBuf abstraction, v3 reuses the existing
> > StringInfoData mechanism.
> 
> I fail to understand the value of v3 except the fact that it saves 3
> lines of code. Arguably right now we have much larger problems e.g.
> actual bugs to fix and we better spend the time of the reviewers on
> these problems.

I agree that there are more important things to fix.  I thought using a
read-only StringInfo and getting rid of the global wasn't a completely
bad idea.  I was reading this patch thinking it could be a quick push,
but I realized that it's not trivial to see from eyeballing alone that
we don't call walrcv_receive() one more time before consuming the whole
buffer (which libpqrcv_receive warns against).  Admittedly, the same can
be said of the original code, so this is not a new concern.  Maybe a few
extra comments would make this business clearer.

Another thing I noticed is that minread is always 1 in current callers
of CopyGetData().  We used to have callers passing other values, but
that code's gone.  Not sure this insight buys us anything, as I don't
see changing it to hardcode a 1, although we could remove the parameter
in all the callers that pass a copy_data_source_cb to BeginCopyFrom ...
which is only the one being patched here, curiously.

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/


Reply via email to