Postgres Corruption Error:使用相同主键复制行

时间:2018-05-15 15:55:19

标签: postgresql duplicates corrupt

我最近遇到了Postgres错误(我的数据库已损坏),基本上,数据库上的某些行重复(以及主键)。在继续之前,这些是本文中提到的错误:

ERROR:  uncommitted xmin 393410960 from before xid cutoff 393413059 needs to be frozen

OR

ERROR:  failed to find parent tuple for heap-only tuple at (3,8) in table "your_table"

显然,xmin的{​​{1}}值,393410960的截止值和393413059的{​​{1}}值可能会有所不同

我如何得到这些错误:

如果你想得到这些错误(并且你有这个问题),你可以找到它们:

ctid

得到第二个错误:

(3,8)

不要恐慌!对此的解决方案如下:)

1 个答案:

答案 0 :(得分:1)

在您阅读本文之前,请注意我对数据丢失或损坏或由此引起的任何问题不承担任何责任!

我建议你备份一切!但是不要your_db=# VACUUM FULL your_table; ERROR: uncommitted xmin 393410960 from before xid cutoff 393413059 needs to be frozen 执行完整的文件系统备份。使用your_db=# REINDEX TABLE your_table; ERROR: failed to find parent tuple for heap-only tuple at (3,8) in table "your_table" 并将其放在其他地方。

也可能有其他解决方案,所以在做更多研究之前不要先做这个。但是,我可以说这对我有用。

因此,为了解决这个问题,我遵循了帖子中的建议:

http://www.postgresql-archive.org/BUG-10189-Limit-in-9-3-4-no-longer-works-when-ordering-using-a-composite-multi-type-index-td5802079.html

基本上,我所做的是以下内容:

pgdump

只有以rsync开头的行才是我写的。所以你可以看到我删除了有问题的行,然后运行了一个reindex。如果失败,则删除下一个违规行并重新索引,直到成功为止。

希望这有帮助。