Concurrency bug in amcheck

Поиск
Список
Период
Сортировка
От Alexander Korotkov
Тема Concurrency bug in amcheck
Дата
Msg-id CAPpHfdt_OTyQpXaPJcWzV2N-LNeNJseNB-K_A66qG=L518VTFw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Concurrency bug in amcheck
Re: Concurrency bug in amcheck
Список pgsql-hackers
Hi!

I found concurrency bug in amcheck running on replica.  When
btree_xlog_unlink_page() replays changes to replica, deleted page is
left with no items.  But if amcheck steps on such deleted page
palloc_btree_page() expects it would have items.

(lldb_on_primary) b btbulkdelete

primary=# drop table test;
primary=# create table test as (select random() x from
generate_series(1,1000000) i);
primary=# create index test_x_idx on test(x);
primary=# delete from test;
primary=# vacuum test;

(lldb_on_replica) b bt_check_level_from_leftmost

replica=# select bt_index_check('test_x_idx');

# skip to internal level
(lldb_on_replica) c
(lldb_on_replica) b palloc_btree_page
# skip to non-leftmost page
(lldb_on_replica) c
(lldb_on_replica) c
# concurrently delete btree pages
(lldb_on_primary) c
# continue with pages
(lldb_on_replica) c

Finally replica gets error.
ERROR:  internal block 289 in index "test_x_idx" lacks high key and/or
at least one downlink

Proposed fix is attached.  Spotted by Konstantin Knizhnik,
reproduction case and fix from me.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Вложения

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

Предыдущее
От: Jeevan Ladhe
Дата:
Сообщение: Re: WIP/PoC for parallel backup
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: fixing old_snapshot_threshold's time->xid mapping