Fix Error Message for allocate_recordbuf() Failure

Поиск
Список
Период
Сортировка
От Shoaib Lari
Тема Fix Error Message for allocate_recordbuf() Failure
Дата
Msg-id CAMGd8b_SYoLiozQY4YmdfUtZGB3S1XN4Bc0_xr8_2mbxok7A+A@mail.gmail.com
обсуждение исходный текст
Ответы Re: Fix Error Message for allocate_recordbuf() Failure  (Michael Paquier <michael.paquier@gmail.com>)
Список pgsql-hackers
Hello,

Attached is a patch for xlogreader.c for a more informative error message for allocate_recordbuf() failure.

The patch details are:

  • Project name.: None

  • Uniquely identifiable file name, so we can tell difference between your v1 and v24.:  src/backend/access/transam/xlogreader.c

  • What the patch does in a short paragraph.: 
The patch enhances the error message when memory cannot be allocated to extend the readRecordBuf.  The previous error message was implying an invalid (too long) record length and also did not specify how much memory we were trying to allocate when the memory allocation failure happened.

We have observed failed allocations in production systems where the reclength was only 344 bytes, but the extended allocation of 5 * Max(BLKSIZE, XLOG_BLCKSZ) failed due to out of memory. 

  • Whether the patch is for discussion or for application (see WIP notes below): for application.

  • Which branch the patch is against (ordinarily this will be master). For more on branches in PostgreSQL, see Using Back Branches.:  master

  • Whether it compiles and tests successfully, so we know nothing obvious is broken.:  Yes.  We ran make check and all 166 tests passed.

  • Whether it contains any platform-specific items and if so, has it been tested on other platforms.:  Nothing platform specific.

  • Confirm that the patch includes regression tests to check the new feature actually works as described.:  None.

  • Include documentation on how to use the new feature, including examples. See the documentation documentation for more information.:  None needed.

  • Describe the effect your patch has on performance, if any.:  None.

  • Try to include a few lines about why you chose to do things particular ways, rather than let your reviewer guess what was happening. This can be done as code comments, but it might also be an additional reviewers' guide, or additions to a README file in one of the code directories.:
Besides making the error message more informative, we had to modify allocate_recordbuf() to return the actual number of bytes that were being allocated.

  • If your patch addresses a Todo item, please give the name of the Todo item in your email. This is so that the reviewers will know that the item needs to be marked as done if your patch is applied.:  None.


Thank you.

Shoaib Lari
Вложения

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

Предыдущее
От: Joshua Bay
Дата:
Сообщение: Logical decoding
Следующее
От: Tom Lane
Дата:
Сообщение: Re: strange explain in upstream - subplan 1 twice - is it bug?