Re: BUG #15636: PostgreSQL 11.1 pg_basebackup backup to a CIFSdestination throws fsync error at end of backup

Поиск
Список
Период
Сортировка
От Thomas Munro
Тема Re: BUG #15636: PostgreSQL 11.1 pg_basebackup backup to a CIFSdestination throws fsync error at end of backup
Дата
Msg-id CAEepm=1VJQ82z2BYxMLWJHJ3SPx7ckGwZUgRYPAoa=5btT1Fxg@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #15636: PostgreSQL 11.1 pg_basebackup backup to a CIFS destination throws fsync error at end of backup  (PG Bug reporting form <noreply@postgresql.org>)
Список pgsql-bugs
On Fri, Feb 15, 2019 at 10:15 AM PG Bug reporting form
<noreply@postgresql.org> wrote:
>                                 pg_basebackup: could not fsync file
> "/cifs/backups/<backupDirectoryName>/basebkp/base/1": Invalid argument
>                                 pg_basebackup: could not fsync file

Hmm, it looks like your system gives EINVAL when you try to fsync a
directory.  Perhaps we should teach fsync__fname() about that here:

        /*
         * Some OSes don't allow us to fsync directories at all, so we
can ignore
         * those errors. Anything else needs to be reported.
         */
        if (returncode != 0 && !(isdir && errno == EBADF))
        {
                fprintf(stderr, _("%s: could not fsync file \"%s\": %s\n"),
                                progname, fname, strerror(errno));
                (void) close(fd);
                return -1;
        }

EINVAL actually makes more sense to me than EBADF for a filesystem
that can't fsync directories.  From POSIX: EINVAL = "The fildes
argument does not refer to a file on which this operation is
possible." vs EBADF "The fildes argument is not a valid descriptor."
It *is* a valid descriptor, it's just not a valid operation
(apparently).

Quick googling on the topic tells me that CIFS directory operations
are "synchronous", so fsync'ing isn't necessary.  However, they only
made it silently do nothing in a recent version:

https://github.com/torvalds/linux/commit/6e70c267e68d77679534dcf4aaf84e66f2cf1425

Presumably before that you get EINVAL because there is no handler
registered.  The commit message even mentions that this was breaking
stuff like us.

-- 
Thomas Munro
http://www.enterprisedb.com


В списке pgsql-bugs по дате отправления:

Предыдущее
От: PG Bug reporting form
Дата:
Сообщение: BUG #15636: PostgreSQL 11.1 pg_basebackup backup to a CIFS destination throws fsync error at end of backup
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Segmentation Fault in logical decoding get/peek API