Re: amcheck (B-Tree integrity checking tool)

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: amcheck (B-Tree integrity checking tool)
Дата
Msg-id CAM3SWZROTT-Hxm3Qh_4DpNQG_=S=tCVnQPgkEOzU0uNOMjE0Ug@mail.gmail.com
обсуждение исходный текст
Ответ на Re: amcheck (B-Tree integrity checking tool)  (Peter Geoghegan <pg@heroku.com>)
Список pgsql-hackers
On Fri, Mar 11, 2016 at 1:09 PM, Peter Geoghegan <pg@heroku.com> wrote:
> Or, you could add code like this to comparetup_index_btree(), to
> simulate a broken opclass:
>
> diff --git a/src/backend/utils/sort/tuplesort.c
> b/src/backend/utils/sort/tuplesort.c
> index 67d86ed..23712ff 100644
> --- a/src/backend/utils/sort/tuplesort.c
> +++ b/src/backend/utils/sort/tuplesort.c
> @@ -3562,6 +3562,9 @@ comparetup_index_btree(const SortTuple *a, const
> SortTuple *b,
>         compare = ApplySortComparator(a->datum1, a->isnull1,
>
> b->datum1, b->isnull1,
>                                                                   sortKey);
> +
> +       if (random() <= (MAX_RANDOM_VALUE / 1000))
> +               compare = -compare;
>         if (compare != 0)
>                 return compare;


Note that this patch that I sketched would make CREATE INDEX produce
corrupt indexes, but the tool's verification itself would not be
affected. Although even if it was (even if _bt_compare() gave the same
wrong answers), it would still very likely detect corruption.

-- 
Peter Geoghegan



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: amcheck (B-Tree integrity checking tool)
Следующее
От: Andres Freund
Дата:
Сообщение: Re: Background Processes and reporting