gitlab Error 500 after updating when viewing proje

2019-03-30 14:59发布

dpkg-query -W gitlab gitlab 7.3.2-omnibus-1

We have gitlab 6.9.2 running on Ubuntu 14.04.1 LTS. After following the instructions found here https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/update.md

to update to 7.3.2, everything seemed fine however when trying to view a project we get error 500.

Everytime I try to access one of the pages I see this error when running sudo gitlab-ctl tail postgresql

ERROR:  relation "users_star_projects" does not exist at character 323
STATEMENT: SELECT a.attname, format_type(a.atttypid, a.atttypmod),
pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
FROM pg_attribute a 
LEFT JOIN pg_attrdef d
ON a.attrelid = d.adrelid AND a.attnum = d.adnum
WHERE a.attrelid = '"users_star_projects"'::regclass
AND a.attnum > 0 AND NOT a.attisdropped
ORDER BY a.attnum

Also I see this error listed in /var/log/gitlab/gitlab-rails/production.log:

Completed 500 Internal Server Error in 42ms

ActiveRecord::StatementInvalid (PG::Error: ERROR:  relation "users_star_projects" does not exist
LINE 5:                WHERE a.attrelid = '"users_star_projects"'::r...
                                          ^
:               SELECT a.attname, format_type(a.atttypid, a.atttypmod),
                     pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
                FROM pg_attribute a LEFT JOIN pg_attrdef d
                  ON a.attrelid = d.adrelid AND a.attnum = d.adnum
               WHERE a.attrelid = '"users_star_projects"'::regclass
                 AND a.attnum > 0 AND NOT a.attisdropped
               ORDER BY a.attnum
):
  app/models/user.rb:522:in `starred?'
  app/controllers/projects_controller.rb:63:in `show'

If there a way I can fix or add the missing relation?

1条回答
We Are One
2楼-- · 2019-03-30 15:20

I posted the issue on gitlab, which helped me fix the problem. https://gitlab.com/gitlab-org/omnibus-gitlab/issues/277

In case anyone else has this issue or comes across this I am posting a quick run down on how I fixed it. In my case I was missing some DB relations. So you can check that by running sudo gitlab-rake db:migrate:status If any of those say down, then they were not applied.

You can try to fix that by running sudo gitlab-ctl reconfigure in my case that did not fix the problem. I had to manually tell it to run the DB migrations with the following command sudo gitlab-rake db:migrate

After that when I ran sudo gitlab-rake db:migrate:status they were all up and I have no more 500 errors when using the website.

查看更多
登录 后发表回答