TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Important PostgreSQL 14 update to avoid silent corruption of indexes

330 pointsby avi_vallarapualmost 3 years ago

9 comments

mattashiialmost 3 years ago
It is noted in the post, I&#x27;ll repeat it to be clear:<p>This corruption can only occur _during_ a (re)index with CONCURRENTLY specified, on rows that are modified during the reindex operation, and only for that index.<p>No other indexes are impacted, and an index can only be impacted when the updates on the table don&#x27;t update indexed columns.<p>Nevertheless, if you frequently run CIC, you could be having this issue -- right now you can detect the issue with amcheck, and fix it with a non-concurrent REINDEX of the index (yes, this locks the table).<p>Alternatively (not listed in the blog post, but possible if you can&#x27;t afford table locks), you should be able to safely CIC (without corruption) by doing manual snapshot control while concurrently reindexing the index (takes 3 database sessions):<p>In session 1 start a REPEATABLE READ read-only transaction. In session 2, start the concurrent (re)index. In session 3, monitor pg_stat_progress_create_index for session 2 to get to a &#x27;waiting for ...&#x27; phase.<p>When you detect the (re)index session arrives in a waiting phase, start a REPEATABLE READ transaction in this session, and then halt (commit or rollback doesn&#x27;t matter) the transaction in session 1. Now, we switch roles of sessions 1 and 3, and repeat this lock-step while the session that is (re)indexing hasn&#x27;t completed.
评论 #31688854 未加载
评论 #31688377 未加载
评论 #31692354 未加载
msk20almost 3 years ago
Looking at the file with changes <a href="https:&#x2F;&#x2F;github.com&#x2F;postgres&#x2F;postgres&#x2F;blob&#x2F;master&#x2F;src&#x2F;backend&#x2F;storage&#x2F;ipc&#x2F;procarray.c" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;postgres&#x2F;postgres&#x2F;blob&#x2F;master&#x2F;src&#x2F;backend...</a> , I have to say this source code repository is so well documented&#x2F;commented and structured, I really gives you a huge trust in postgres to be used in your stack.
评论 #31688813 未加载
评论 #31692098 未加载
评论 #31688547 未加载
评论 #31688502 未加载
cesarbalmost 3 years ago
A more official announcement seems to be at <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;message-id&#x2F;165473835807.573551.1512237163040609764%40wrigleys.postgresql.org" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;message-id&#x2F;165473835807.573551.15...</a>
taspeotisalmost 3 years ago
I think this is the fix: <a href="https:&#x2F;&#x2F;github.com&#x2F;postgres&#x2F;postgres&#x2F;commit&#x2F;e28bb885196916b0a3d898ae4f2be0e38108d81b" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;postgres&#x2F;postgres&#x2F;commit&#x2F;e28bb885196916b0...</a><p>Discussion: <a href="https:&#x2F;&#x2F;www.postgresql.org&#x2F;message-id&#x2F;17485-396609c6925b982d%40postgresql.org" rel="nofollow">https:&#x2F;&#x2F;www.postgresql.org&#x2F;message-id&#x2F;17485-396609c6925b982d...</a>
boiler_up800almost 3 years ago
It’s impressive that this is a single revert. That speaks to how the development of Postgres is done atomically.<p>Also not surprised to see it was the EDB team with the expertise to fix it. Their model is a little outdated but they have a lot of experts working there.
评论 #31690545 未加载
optimalsolveralmost 3 years ago
I&#x27;m running 12.11. Do I need to do anything?
评论 #31692832 未加载
评论 #31692170 未加载
avi_vallarapualmost 3 years ago
pg_amcheck can be helpful for validation if its a b-tree index
评论 #31692468 未加载
cfernhoutalmost 3 years ago
Awesome update!
TedShilleralmost 3 years ago
I love Postgres. But when I look at the bug list of every release it makes me scared. The types of bugs they have are indicative of a poor development process.
评论 #31689262 未加载
评论 #31689155 未加载
评论 #31691853 未加载
评论 #31689233 未加载
评论 #31696916 未加载
评论 #31689030 未加载