测试还原 - 不起作用

你好,你最喜欢的 bug 查找者、来打扰支持的用户又来了。

我今天下午在测试恢复时,两次都遇到了这个问题:

ERROR:  could not extend file "base/16384/3294755": wrote only 4096 of 8192 bytes at block 43985
HINT:  Check free disk space.
EXCEPTION: psql failed: HINT:  Check free disk space.
/var/www/discourse/lib/backup_restore/database_restorer.rb:92:in `restore_dump'
/var/www/discourse/lib/backup_restore/database_restorer.rb:26:in `restore'
/var/www/discourse/lib/backup_restore/restorer.rb:51:in `run'
script/discourse:149:in `restore'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/command.rb:27:in `run'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/invocation.rb:127:in `invoke_command'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor.rb:392:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.2.0/gems/thor-1.2.2/lib/thor/base.rb:485:in `start'
script/discourse:290:in `<top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:58:in `kernel_load'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:492:in `exec'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:34:in `dispatch'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/cli.rb:28:in `start'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:45:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.13/exe/bundle:33:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'
Trying to rollback...
Rolling back...
Cleaning stuff up...
Dropping functions from the discourse_functions schema...
Removing tmp '/var/www/discourse/tmp/restores/default/2023-08-19-145440' directory...
Unpausing sidekiq...
Marking restore as finished...
Notifying 'system' of the end of the restore...
Finished!
[FAILED]
Restore done.

特别提一下

Finished!
[FAILED]
Restore done.

这让我有点想笑 :roll_eyes:
我觉得这非常糟糕,从“还好”到“极其糟糕”的尺度上来说。

我在一个暂存环境(我们用于测试和随意摆弄的独立虚拟机)中进行了恢复,在执行了干净的:

  • launcher stop app
  • rm -rf /var/discourse/shared
  • launcher rebuild app

之后。我尝试恢复的是自动化恢复创建的最后一个备份,并备份在 S3 中。
然后通过邮件提供的链接下载,并按照此指南进行恢复:

备份文件是 10GB。在 VM 上,当我开始恢复时,大约有 110GB 的可用空间。

编辑:Discourse 版本 3.2.0.beta1-dev (fbf7b106cc)

您的磁盘空间不足。请确保此服务器上的可用空间至少是备份大小的 3 倍。

不。这是一个“提示”,意思是“这是一个常见问题”。

正如你回复的上一条帖子所述:

备份是 10GB。当我开始恢复时,虚拟机大约有 110GB 的可用空间。

(编辑了带有 GB 图像的版本,以便阅读)

进一步调查后,似乎备份的数据有问题,文件已损坏,或者烹饪过程弄乱了某些东西。

我将尝试下载另一个备份,看看备份文件之间是否存在相同的问题,以排除文件下载过程中出现问题的可能性。

更奇怪的是,加载该主题和该消息对于 discourse 来说根本没有任何问题。它加载并呈现都没有问题。

我已经手动干预并编辑了该帖子。现在正在启动手动备份以再次进行测试。