Re: BUG #18363: Assert !ReindexIsProcessingIndex falsified with expression index over select from table
Alexander Law <exclusion@gmail.com>
From: Alexander Lakhin <exclusion@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>, Michael Paquier <michael@paquier.xyz>
Cc: pgsql-bugs@lists.postgresql.org
Date: 2024-02-26T06:00:01Z
Lists: pgsql-bugs
Hello Tom and Michael, 25.02.2024 23:37, Tom Lane wrote: >> Surely, such an index will not work correctly anyway, but may be it makes >> sense to replace that Assert with ereport(ERROR). > Yeah, I guess so. We periodically get reports of the non-assert > failure, and this would let us issue a more on-point error message. > I'm slightly worried about the extra cost, but typically > pendingReindexedIndexes should be empty or at least short, so it's > probably negligible. Thank you for fixing that! I've also got the same error (but not the assert) with CREATE INDEX: CREATE TABLE t(i int PRIMARY KEY); CREATE FUNCTION f(c int) RETURNS INT IMMUTABLE LANGUAGE SQL AS 'SELECT i FROM t WHERE i = $1'; INSERT INTO t VALUES (1); CREATE INDEX ON t(f(i)); ERROR: could not read block 0 in file "base/16384/16391": read only 0 of 8192 bytes CONTEXT: SQL function "f" during startup It looks like currentlyReindexedIndex == 0 in this case, so ReindexIsProcessingIndex() doesn't guard against get_relation_info() -> _bt_getrootheight() -> _bt_getbuf() -> ReadBuffer() -> ... -> mdread(). Best regards, Alexander
Commits
-
Promote assertion about !ReindexIsProcessingIndex to runtime error.
- f5a465f1a074 17.0 landed
- c0b4dad38e84 12.19 landed
- 940489b46769 15.7 landed
- 8c785d354c61 16.3 landed
- 43cca9de9a0a 13.15 landed
- 09f09884c18d 14.12 landed