Fix the error message when failing to restore the snapshot

Поиск
Список
Период
Сортировка
От Zhijie Hou (Fujitsu)
Тема Fix the error message when failing to restore the snapshot
Дата
Msg-id OS0PR01MB5716D408364F7DF32221C08D941FA@OS0PR01MB5716.jpnprd01.prod.outlook.com
обсуждение исходный текст
Ответы Re: Fix the error message when failing to restore the snapshot  (Amit Kapila <amit.kapila16@gmail.com>)
Список pgsql-hackers
Hi,

While testing the logical snapshot restore functionality, I noticed the
data size reported in the error message seems not correct.

I think it's because we used a const value here:

SnapBuildRestoreContents(int fd, char *dest, Size size, const char *path)
...
    readBytes = read(fd, dest, size);
    pgstat_report_wait_end();
    if (readBytes != size)
...
            ereport(ERROR,
                    (errcode(ERRCODE_DATA_CORRUPTED),
                     errmsg("could not read file \"%s\": read %d of %zu",
**                            path, readBytes, * sizeof(SnapBuild) *)));

I think we need to pass the size here.

Attach a small patch to fix this. BTW, the error message exists in HEAD ~ PG10.

Best Regards,
Hou zj


Вложения

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

Предыдущее
От: Chapman Flack
Дата:
Сообщение: Re: Extract numeric filed in JSONB more effectively
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: list of acknowledgments for PG16