|From:||Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>|
|To:||Anastasia Lubennikova <a(dot)lubennikova(at)postgrespro(dot)ru>|
|Cc:||PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>|
|Subject:||Re: [BUG] Error in BRIN summarization|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
On 2020-Jul-23, Anastasia Lubennikova wrote:
> This error is caused by the problem with root_offsets array bounds. It
> occurs if a new HOT tuple was inserted after we've collected root_offsets,
> and thus we don't have root_offset for tuple's offnum. Concurrent insertions
> are possible, because brin_summarize_new_values() only holds ShareUpdateLock
> on table and no lock (only pin) on the page.
Excellent detective work, thanks.
> The draft fix is in the attachments. It saves root_offsets_size and checks
> that we only access valid fields.
I think this is more complicated than necessary. It seems easier to
solve this problem by just checking whether the given root pointer is
set to InvalidOffsetNumber, which is already done in the existing coding
of heap_get_root_tuples (only they spell it "0" rather than
InvalidOffsetNumber, which I propose to change). AFAIR this should only
happen in the 'anyvisible' mode, so I added that in an assert.
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
|Next Message||Thomas Munro||2020-08-12 00:24:52||Re: Improving connection scalability: GetSnapshotData()|
|Previous Message||Andres Freund||2020-08-12 00:19:38||Re: Improving connection scalability: GetSnapshotData()|