0

如果在从 postgres 8.x 升级到 9.x 并使用--link 选项运行 pg_upgrade 后,我会“降级”回 8.x(意思是,我关闭 pg-9 守护进程并启动pg-8 守护进程)?

In particular, suppose that while I was in pg-9 I inserted some data into tables? Can I expect to find that data after I downgrade back to pg-8? Does it depend on whether the tables I inserted that data into were already in existence at the time of my pg_upgrade? And (call me perverse) suppose I reupgrade to pg-9, re-redowngrade to pg-8, and so on many times. Are there any guarantees, or am I taking my chances?

I've done some small-scale tests. What I find is that after the first downgrade, I'm back roughly to the data I had before I ran pg_upgrade. Roughly, not exactly. And with each upgrade-downgrade cycle, it seems to get more "roughly".

现在我可以忍受“粗略”的部分了。但是,我真正讨厌的是,如果在多次重新重新升级/降级之后,我最终得到了一个无法挽回的损坏数据库。应该担心吗?

最后,我确实知道 pg_dump,但由于时间和存储的原因,我想尽可能避免这种情况。

4

1 回答 1

2

你应该认为pg_upgrade不可逆转的一步。如果您希望能够撤消更改,请不要使用--link,以便旧数据库保持原位并保持不变。如果用户返回旧数据库,他们将丢失升级后所做的更改。

你真的应该提供一个用户可以使用的备份和恢复工具,以便他们可以进行备份,升级到新版本,如果不满意降级则恢复备份。要获得奖励积分,请使您的备份工具兼容生成向后兼容的备份,以便可以将来自 $newversion 的备份恢复到 $oldversion。

于 2013-04-26T02:24:29.990 回答