大量问题:已登录的员工无法访问主题,手动升级失败,用户卡片无法打开,默认登录不起作用

你好。我之前曾发布过 一个类似的问题,但并未完全解决。目前我们的论坛正面临一些严重问题:

  1. 命令行升级失败。
    1. 我尝试过移除所有扩展,但问题依旧。

    2. 我创建了一个新实例,复制了旧实例的备份并通过命令行进行恢复,但最终以一些错误告终:

      ERROR:  could not create unique index "index_incoming_referers_on_path_and_incoming_domain_id"
      DETAIL:  Key (path, incoming_domain_id)=(/m/search, 18) is duplicated.
      EXCEPTION: psql failed: DETAIL:  Key (path, incoming_domain_id)=(/m/search, 18) is duplicated.
      /var/www/discourse/lib/backup_restore/database_restorer.rb:87: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:145:in `restore'
      /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/command.rb:27:in `run'
      /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/invocation.rb:127:in `invoke_command'
      /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor.rb:392:in `dispatch'
      /var/www/discourse/vendor/bundle/ruby/2.7.0/gems/thor-1.1.0/lib/thor/base.rb:485:in `start'
      script/discourse:286:in `<top (required)>'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:63:in `load'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:63:in `kernel_load'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/cli/exec.rb:28:in `run'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/cli.rb:494:in `exec'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/cli.rb:30:in `dispatch'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/cli.rb:24:in `start'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/exe/bundle:49:in `block in <top (required)>'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/lib/bundler/friendly_errors.rb:130:in `with_friendly_errors'
      /usr/local/lib/ruby/gems/2.7.0/gems/bundler-2.2.7/exe/bundle:37:in `<top (required)>'
      /usr/local/bin/bundle:23:in `load'
      /usr/local/bin/bundle:23: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/2021-08-30-124350' directory...
      Unpausing sidekiq...
      Marking restore as finished...
      Notifying 'system' of the end of the restore...
      Finished!
      [FAILED]
      Restore done.
      
    3. 随后我运行了 ./launcher rebuild app 以查看是否可行,但得到了类似的错误信息:

      rake aborted!
      StandardError: An error has occurred, this and all later migrations canceled:
      
      ERROR:  unsupported Unicode escape sequence
      DETAIL:  \u0000 cannot be converted to text.
      

      以及

      FAILED
      --------------------
      Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with 
      return #<Process::Status: pid 4162 exit 1>
      Location of failure: /pups/lib/pups/exec_command.rb:112:in `spawn'
      exec failed with the params {"cd"=>"$home", "hook"=>"db_migrate", "cmd"=>["su discourse -c 'bundle exec rake db:migrate'"]}
      c618c071d6a0240d55ce704cedd63d2ee4cf1df589810d2130049a78b69f327e
      
    4. 我还运行了 discourse-doctor,但无济于事。

  2. 我们无法通过用户名和密码正常登录,系统会报错。
    1. 只有其他登录方式(GitHub、Google 等)有效。
  3. 用户卡片无法显示。点击用户名时,卡片会尝试弹出但瞬间消失。
    1. 当您访问用户的个人资料页面(例如在新标签页中打开)时,会显示“哎呀,此页面不存在”的错误。
    2. 当用户尝试查看其偏好设置、消息等时,也会遇到“哎呀”错误页面。
    3. 我们可以通过管理界面查看用户的其他设置,但无法执行更改,例如界面设置或用户头像。
  4. 管理员无法查看主题或主页。
    1. 未登录时,网站可以正常查看。
    2. 其他用户可以登录并与论坛互动(创建主题、回复等)。
    3. 如果我们以管理员身份登录,会收到一条错误消息:

      哎呀

      驱动此讨论论坛的软件遇到了意外问题。对此造成的不便,我们深表歉意。

      有关该错误的详细信息已被记录,并生成了自动通知。我们将对此进行检查。

      无需采取进一步操作。但如果错误持续存在,您可以通过在网站的反馈类别中发布讨论主题,提供额外详情,包括复现错误的步骤。

任何帮助都将不胜感激。如果您有任何解决这些问题的思路,或者知道如何创建一个带有可用备份的新实例,请告诉我。

参考此链接,了解一个类似(但不同)的问题:Duplicate data explorer key blocking rebuild

检查当前数据库中是否存在相关的数据完整性问题,修复这些问题,然后创建备份。

@merefield,我并没有全面的知识,所以我通过数据探索器进行了检查,发现 incoming_referers 表中有一个名为 incoming_domain_id 的列,类型为 integer,它是到 incoming_domains 的外键。我应该着手处理这个问题吗?如果是,我该如何验证?

这看起来太乱了,如果你没有把握且数据至关重要,我建议找一位经验丰富的系统管理员来帮你恢复所有数据 Marketplace

你解决问题了吗?