升级失败 PG::UniqueViolation -- 无法创建唯一索引 "unique_post_links_ccnew"

I’ve got a standard install that is failing to upgrade to 2.8.0.beta2 with this error:

PG::UniqueViolation: ERROR:  could not create unique index "unique_post_links_ccnew"

it’s from

I, [2021-06-25T18:35:47.756688 #1]  INFO -- : == 20210525112226 RemoveLengthConstrainFromTopicLinkUrl: migrating ============

It doesn’t look like a corrupt index.

Does this help?

[6] pry(main)> TopicLink.where(url: bad_url).pluck(:id, :topic_id, :post_id, :user_id)
=> [[15733, 14351, 63616, 911], [16131, 14505, 63986, 911], [27141, 14505, 63986, 1152]]

I ended up just appending a badX to the duplicate URLs and then it worked. I’m not quite clear what problems this might generate in the future…

根据我们的经验,早期版本的 Postgres 中存在大量所谓的“不可能”的索引损坏错误。您是否仍然遇到这种情况?

1 个赞

我好像自从升级到 pg12 后就没见过它了。

1 个赞

我们一直到 PG13,我认为这(损坏的索引)基本上为我们解决了问题,对吗 @sam

2 个赞

@saj 已解决此问题。我们已在基础架构中解决了它。大多数自托管者已设法解决。

我们过去用于升级开源映像中 PG 的机制,由于 PG 版本之间底层 libc 的更改,存在一些固有的安全问题。

我认为这个问题现在在更广泛的生态系统中已基本消失,尽管一些旧的升级可能仍会遇到它。修复我们现有的开源升级脚本并处理庞大的 PG 升级矩阵将是一场噩梦。

尽管如此,至少我们现在非常清楚问题的根源,并且能够更好地应对它。

2 个赞

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.