display offset along with block number in vacuum errors

Поиск
Список
Период
Сортировка
От Mahendra Singh Thalor
Тема display offset along with block number in vacuum errors
Дата
Msg-id CAKYtNApK488TDF4bMbw+1QH8HJf9cxdNDXquhU50TK5iv_FtCQ@mail.gmail.com
обсуждение исходный текст
Ответы Re: display offset along with block number in vacuum errors  (Michael Paquier <michael@paquier.xyz>)
Re: display offset along with block number in vacuum errors  (Masahiko Sawada <masahiko.sawada@2ndquadrant.com>)
Re: display offset along with block number in vacuum errors  (Justin Pryzby <pryzby@telsasoft.com>)
Список pgsql-hackers
Hi hackers,
We discussed in another email thread[1], that it will be helpful if we can display offset along with block number in vacuum error. Here, proposing a patch to add offset along with block number in vacuum errors.

In commit b61d161(Introduce vacuum errcontext to display additional information), we added vacuum errcontext to display additional information(block number) so that in case of vacuum error, we can identify which block we are getting error.  Addition to block number, if we can display offset, then it will be more helpful for users. So to display offset, here proposing two different methods(Thanks Robert for suggesting these 2 methods):

Method 1: We can report the TID as well as the block number in  errcontext.
- errcontext("while scanning block %u of relation \"%s.%s\"",
-   errinfo->blkno, errinfo->relnamespace, errinfo->relname);
+ errcontext("while scanning block %u and offset %u of relation \"%s.%s\"",
+   errinfo->blkno, errinfo->offnum, errinfo->relnamespace, errinfo->relname);

Above fix requires more calls to update_vacuum_error_info(). Attaching v01_0001 patch for this method.

Method 2: We can improve the error messages by passing the relevant TID to heap_prepare_freeze_tuple and having it report the TID as part of the error message or in the error detail.
  ereport(ERROR,
  (errcode(ERRCODE_DATA_CORRUPTED),
- errmsg_internal("found xmin %u from before relfrozenxid %u",
+ errmsg_internal("for block %u and offnum %u, found xmin %u from before relfrozenxid %u",
+ ItemPointerGetBlockNumber(tid),
+ ItemPointerGetOffsetNumber(tid),
  xid, relfrozenxid)));

Attaching v01_0002 patch for this method.

Please let me know your thoughts.


Вложения

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Making CASE error handling less surprising
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Missing CFI in hlCover()?