当前位置: 首页 > news >正文

Gitlab升级14.0.12-->14.3.6遇到的gitlab-ctl reconfigure错误

问题描述

在按照官方文档升级路线11.0.2=>17.2.2的过程中,升级14.0.12–》14.3.6时遇到一个错误:

Running handlers:
There was an error running gitlab-ctl reconfigure:rails_migration[gitlab-rails] (gitlab::database_migrations line 51) had an error: Mixlib::ShellOut::ShellCommandFailed: bash[migrate gitlab-rails database] (/opt/gitlab/embedded/cookbooks/cache/cookbooks/gitlab/resources/rails_migration.rb line 16) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of "bash"  "/tmp/chef-script20240917-12026-tupa61" ----
。。。中间略过。。。。
-- execute("ALTER TABLE \"vulnerability_finding_evidence_sources\"\nADD CONSTRAINT \"check_86b537ba1a\" CHECK (char_length(\"name\") <= 2048),\nADD CONSTRAINT \"check_0fe01298d6\" CHECK (char_length(\"url\") <= 2048)\n")rake aborted!
StandardError: An error has occurred, all later migrations canceled:Expected batched background migration for the given configuration to be marked as 'finished', but it is 'paused':      {:job_class_name=>"CopyColumnUsingBackgroundMigrationJob", :table_name=>"ci_builds_metadata", :column_name=>"id", :job_arguments=>[["id"], ["id_convert_to_bigint"]]}Finalize it manualy by runningsudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id,'[["id"]\, ["id_convert_to_bigint"]]']

原因调查

查询chatgpt,这个错误与数据库迁移失败有关,根据错误日志显示,问题出在某个后台迁移任务未完成。GitLab 在进行某些大表的数据迁移时,会将任务分批次处理,而你的迁移任务被暂停了,导致后续的迁移被中止。

具体原因是 GitLab 的 CopyColumnUsingBackgroundMigrationJob 后台任务没有标记为“已完成”,而是处于“暂停”状态,任务没有被完全执行,因此阻止了后续迁移。这个问题通常发生在你升级 GitLab 版本时,GitLab 使用后台迁移任务处理大表(如 ci_builds_metadata 表)的数据,以避免在迁移过程中占用大量资源。

解决方案

1、检查数据库连接

sudo gitlab-rake db:migrate:status

结果显示,无法连接数据库。
2、重启数据库

sudo gitlab-ctl status postgresql
sudo gitlab-ctl start postgresql

3、执行

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,ci_builds_metadata,id,'[["id"], ["id_convert_to_bigint"]]']sudo gitlab-ctl reconfigure

又遇到了Redis无法连接错误:

Caused by:Redis::CannotConnectError: Error connecting to Redis on /var/opt/gitlab/redis/redis.socket (Errno::ENOENT) 

但是检查Redis服务,却是正常运行的。咨询chatgpt,有时候 Redis 启动过程中出现问题,可能导致 GitLab 其他组件无法正常启动。可以尝试重启所有 GitLab 组件。
4、执行如下步骤:

sudo gitlab-ctl restart
sudo gitlab-ctl reconfigure

又遇到错误,根据日志信息,执行:

sudo gitlab-rake gitlab:background_migrations:finalize[CopyColumnUsingBackgroundMigrationJob,taggings,id,'[["id"\, "taggable_id"]\, ["id_convert_to_bigint"\, "taggable_id_convert_to_bigint"]]']

然后再执行

sudo gitlab-ctl reconfigure

没有报错, 再执行:

sudo gitlab-rake db:migrate

没有错误,然后检查日志和服务,均已正常。
问题解决,记之。

http://www.lryc.cn/news/440531.html

相关文章:

  • JDBC导图
  • 飞思实验室与中飞院联合开发教学课程,校企联袂共绘教育蓝图
  • Telephony Call
  • Python--TCP/UDP通信
  • 【已解决】请教 “Sa-Token 集成 xxl-job,报错:非 web 上下文无法获取 HttpServletRequest” 如何解决
  • Redis——常用数据类型string
  • 架构设计:负责网络、定时、坐下、站起、重连等,支持多类游戏的无锁房间
  • 个人随想-gpt-o1大模型中推理链的一个落地实现
  • python解析ip范围,判断ip是否在ip范围内
  • Springboot错误日志切面,找到post请求体被消费后的数据
  • 【二十】【QT开发应用】listwidget右键菜单和删除item
  • LabVIEW机动车动态制动性能校准系统
  • Linux(CentOS8)服务器安装RabbitMQ
  • R语言进行无序多分类Logistic回归
  • Maven从入门到精通(三)
  • Red Hat 和 Debian Linux 对比
  • Axure设计之全屏与退出全屏交互实现
  • 如何测试出自己电脑的网络速度(网速)?
  • 如何利用AI进行有效的科技产品发布
  • 二层、三层网络基本原理
  • 全面掌握 Jest:从零开始的测试指南(上篇)
  • Go 交叉编译
  • goctl安装失败
  • DebateGPT:通过多智能体辩论监督微调大模型
  • 【最新综述】基于深度学习的超声自动无损检测(下)
  • kali——tshark的使用
  • TortoiseSVN图标不显示的解决
  • Oracle 11gR2打PSU补丁详细教程
  • 2.4 卷积1
  • OA项目值用户登入首页展示