From: Andres Freund <andres@anarazel.de>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Kamigishi Rei <iijima.yun@koumakan.jp>
Cc: David Rowley <dgrowley@gmail.com>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: Andrew Gierth <andrew@tao11.riddles.org.uk>
Cc: PostgreSQL mailing lists <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #17245: Index corruption involving deduplicated entries
Date: Thu, 28 Oct 2021 14:31:03 -0700
Message-ID: <20211028213103.vkmdhx447clb6ph6@alap3.anarazel.de> (raw)
In-Reply-To: <CAH2-Wz=s5EMTPeXYO9vS9Pdtq8UkY77qAdmEQ4sL1UMODK8zEA@mail.gmail.com>
References: <b8cff91e-eb62-f8e1-3016-77b7deda7634@koumakan.jp>
<CA+hUKGLv2yaZp+y5hr7Occg-86y+5-+ZSDmWPzKV1NuBFSXzCw@mail.gmail.com>
<84f64b71-1320-591d-5101-560ae5487779@koumakan.jp>
<CAH2-WzmLapjJXL4ZNhJJYsbmUUGFJq5Jt2owkUDJhRWXehrgyQ@mail.gmail.com>
<CAH2-WzmD_mZDm1Sb1C=nqUWj3cLTDoamx9EL_Tpwws_Ur9eFww@mail.gmail.com>
<9076c0bd-e238-5f8d-1117-7f5549e35c33@koumakan.jp>
<CAH2-Wzm0GZnNgNeHx-W-4ogR1RB1gGk_efMiWuinXFyMWzjb=w@mail.gmail.com>
<CAH2-WznotEY2YXLBA44oqWLtQUTYHAKWnujCWmmWgthKhZ-97w@mail.gmail.com>
<4c0d2dff-9fa2-1db0-0d0f-c84aefddfaab@koumakan.jp>
<CAH2-Wz=s5EMTPeXYO9vS9Pdtq8UkY77qAdmEQ4sL1UMODK8zEA@mail.gmail.com>
Hi,
On 2021-10-28 10:16:35 -0700, Peter Geoghegan wrote:
> Your heap page (page 0 of the "page" heap relation) was very
> interesting. I saw that the TID that is incorrectly repeated in the
> index "page_len" is marked LP_UNUSED in the heap page. It's one of
> only two such TIDs/line pointers on your heap/table page, out of 61
> total, so I doubt that this is a coincidence. That's why I'm asking
> for more heap pages -- I would like to verify that this is a
> consistent thing, and not just a remarkable coincidence.
This makes me wonder if the issue could be that we're loosing writes / that
something is reading old page versions (e.g. due to filesystem bug). If both
heap and index are vacuumed, but the index write is lost, this'd be what we
see, right?
Another way this could happen is if we got the wrong relation size for either
index or table, and a vacuum scan doesn't scan the whole table or index.
I've not yet read the whole thread, but if not done, it seems like a good idea
to use pg_waldump and grep for changes to the relevant heap / index
pages. That might give us more information about what could have happened.
> Now this is looking like a problem in VACUUM (pruning?), not a CREATE
> INDEX thing. It looks like somehow an item that should be LP_DEAD ends
> up being LP_UNUSED during pruning. I have CC'd Andres, to get his
> thoughts on this.
Hm.
There were a fair bit of changes around the separation between heap and index
vacuuming in 14. I wonder if there's potentially something broken around
repeatedly vacuuming the heap without doing index vacuums or such.
It's also possible that there's something wrong in that darned path that
handles recently-dead tuples.
Greetings,
Andres Freund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: andres@anarazel.de, pg@bowt.ie, iijima.yun@koumakan.jp, dgrowley@gmail.com, thomas.munro@gmail.com, andrew@tao11.riddles.org.uk
Subject: Re: BUG #17245: Index corruption involving deduplicated entries
In-Reply-To: <20211028213103.vkmdhx447clb6ph6@alap3.anarazel.de>
References: <b8cff91e-eb62-f8e1-3016-77b7deda7634@koumakan.jp> <CA+hUKGLv2yaZp+y5hr7Occg-86y+5-+ZSDmWPzKV1NuBFSXzCw@mail.gmail.com> <84f64b71-1320-591d-5101-560ae5487779@koumakan.jp> <CAH2-WzmLapjJXL4ZNhJJYsbmUUGFJq5Jt2owkUDJhRWXehrgyQ@mail.gmail.com> <CAH2-WzmD_mZDm1Sb1C=nqUWj3cLTDoamx9EL_Tpwws_Ur9eFww@mail.gmail.com> <9076c0bd-e238-5f8d-1117-7f5549e35c33@koumakan.jp> <CAH2-Wzm0GZnNgNeHx-W-4ogR1RB1gGk_efMiWuinXFyMWzjb=w@mail.gmail.com> <CAH2-WznotEY2YXLBA44oqWLtQUTYHAKWnujCWmmWgthKhZ-97w@mail.gmail.com> <4c0d2dff-9fa2-1db0-0d0f-c84aefddfaab@koumakan.jp> <CAH2-Wz=s5EMTPeXYO9vS9Pdtq8UkY77qAdmEQ4sL1UMODK8zEA@mail.gmail.com> <20211028213103.vkmdhx447clb6ph6@alap3.anarazel.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox