From: | Andrey Borodin <x4mmm(at)yandex-team(dot)ru> |
---|---|
To: | pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | CREATE INDEX CONCURRENTLY does not index prepared xact's data |
Date: | 2020-12-19 17:13:39 |
Message-ID: | 2E712143-97F7-4890-B470-4A35142ABC82@yandex-team.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
Hi hackers!
$subj.
Steps to reproduce:
create extension if not exists amcheck;
create table if not exists t1(i int);
begin;
insert into t1 values(1);
prepare transaction 'x';
create index concurrently i1 on t1(i);
commit prepared 'x';
select bt_index_check('i1', true);
I observe:
NOTICE: heap tuple (1,8) from table "t1" lacks matching index tuple within index "i1"
I expect: awaiting 'x' commit before index is created, correct index after.
This happens because WaitForLockersMultiple() does not take prepared xacts into account. Meanwhile CREATE INDEX CONCURRENTLY expects that locks are dropped only when transaction commit is visible.
This issue affects pg_repack and similar machinery based on CIC.
PFA draft of a fix.
Best regards, Andrey Borodin.
Attachment | Content-Type | Size |
---|---|---|
v1-0001-Wait-for-prepared-xacts-in-CREATE-INDEX-CONCURREN.patch | application/octet-stream | 5.1 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Victor Yegorov | 2020-12-19 17:22:14 | Re: CREATE INDEX CONCURRENTLY does not index prepared xact's data |
Previous Message | Colin 't Hart | 2020-12-18 20:18:01 | Re: BUG #16779: psql -e not showing queries |