Re: sendFileWithContent() does not advance the source pointer

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Antonin Houska <ah(at)cybertec(dot)at>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: sendFileWithContent() does not advance the source pointer
Date: 2022-12-12 15:40:38
Message-ID: CA+TgmobxXJBp58e+UFqO8tCKPpmJzYOUrzrWJL3nzo=T_kh=Ow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 8, 2022 at 2:43 PM Antonin Houska <ah(at)cybertec(dot)at> wrote:
> When checking something else in the base backup code, I've noticed that
> sendFileWithContent() does not advance the 'content' pointer. The sink buffer
> is large enough (32kB) so that the first iteration usually processes the whole
> file (only special files are processed by this function), and thus that the
> problem is hidden.
>
> However it's possible to hit the issue: if there are too many tablespaces,
> pg_basebackup generates corrupted tablespace_map. Instead of writing all the
> tablespace paths it writes only some and then starts to write the contents
> from the beginning again.

Thanks for the report, analysis, and fix. I have committed your patch
and back-patched to v15.

--
Robert Haas
EDB: http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Joseph Koshakow 2022-12-12 15:55:36 Re: Date-Time dangling unit fix
Previous Message Jonathan S. Katz 2022-12-12 14:47:56 Re: Raising the SCRAM iteration count