Open mikehaertl opened 6 years ago
I had same error here when I trying to update from previos versions. But I think you need update your privileges:
Your database user is not allowed to create, drop, or execute triggers on the
table web_hooks.
If you are using PostgreSQL you can solve this by logging in to the GitLab
database (gitlabhq_galileo) using a super user and running:
ALTER gitlab WITH SUPERUSER
For MySQL you instead need to run:
GRANT ALL PRIVILEGES ON *.* TO gitlab@'%'
Now its working to me
@maltzsama Hmm, thanks. But my gitlab user in MySQL already has all privileges for the gitlab
database:
SHOW GRANTS for gitlab;
Result:
GRANT USAGE ON *.* TO 'gitlab'@'%'
GRANT ALL PRIVILEGES ON `gitlab`.* TO 'gitlab'@'%'
Anything else I could try?
I'm not sure. I tried to do my update based on 8.x, and after based on 9.x, and my tables was configured like that:
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, CREATE TEMPORARY TABLES, DROP, INDEX, ALTER, LOCK TABLES ON `gitlabhq_galileo`.* TO 'gitlab'@'%';
But when I tried to update I had the same error as you. So I reapply the privileges and than that's worked for me.
The error log on my docker logs gitlab
showed this information:
/home/git/gitlab/lib/gitlab/database/migration_helpers.rb:752:in `check_trigger_permissions!'
/home/git/gitlab/lib/gitlab/database/migration_helpers.rb:373:in `rename_column_concurrently'
/home/git/gitlab/db/migrate/20170511082759_rename_web_hooks_build_events_to_job_events.rb:12:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:611:in `exec_migration'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:592:in `block (2 levels) in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:591:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/connection_adapters/abstract/connection_pool.rb:292:in `with_connection'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:590:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:768:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:1023:in `block in execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:1071:in `ddl_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:1022:in `execute_migration_in_transaction'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:984:in `block in migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:980:in `each'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:980:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:823:in `up'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/migration.rb:801:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/tasks/database_tasks.rb:139:in `migrate'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.10/lib/active_record/railties/databases.rake:44:in `block (2 levels) in <top (required)>'
/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/rake-12.3.0/exe/rake:27:in `<top (required)>'
Caused by:
Your database user is not allowed to create, drop, or execute triggers on the
table web_hooks.
If you are using PostgreSQL you can solve this by logging in to the GitLab
database (gitlabhq_galileo) using a super user and running:
ALTER gitlab WITH SUPERUSER
For MySQL you instead need to run:
GRANT ALL PRIVILEGES ON *.* TO gitlab@'%'
Both queries will grant the user super user permissions, ensuring you don't run
into similar problems in the future (e.g. when new tables are created).
Ok, I think I found something. It seems that ALL PRIVILEGES
is not enough to create triggers in MySQL in some configurations. The user either needs SUPER
privileges or you have to set log_bin_trust_function_creators = 1
.
GitLab also has this note in their upgrade guide:
I will try to set log_bin_trust_function_creators = 1
later and report back if this helped.
Sidenote: It's weird that the GitLab guys have the same upgrade instructions over and over again. E.g. the note above is from 10.3 -> 10.4 but it's also contained in 10.2 -> 10.3 and older upgrade guides. Why all that noise? One of the reasons why I like sameer's image so much. ;)
I don't think, my problem is related to permissions as my error looks a little different.
I've created an issue with GitLab as I now have even more problems: I can't even create a backup with 10.3.2 anymore.
I've done an intermediate upgrade to 10.3.6. Now at least backups work again.
Upgrading to 10.4.2 still fails with the same error. I've also tried to set log_bin_trust_function_creators
but to no avail.
the same issue here:
ActiveRecord::StatementInvalid: Mysql2::Error: Lost connection to MySQL server during query: SELECT application_settings
.* FROM application_settings
ORDER BY application_settings
.id
DESC LIMIT 1
I've also added the MySQL query log to the Gitlab issue above. But it seems, they are not interested in fixing MySQL related bugs, so I repeat it here. Maybe someone has an idea. The last query is issued twice, maybe that's a sign.
I found some pages that mention reaping_frequency
as possible cause. But this is already disabled in GitLab for some time now AFAIK. So it's probably something else.
2018-01-31T14:36:40.130682Z 345 Connect gitlab@192.168.0.8 on gitlab using TCP/IP
2018-01-31T14:36:40.142067Z 345 Query SET NAMES utf8 COLLATE utf8_general_ci, @@SESSION.sql_auto_is_null = 0, @@SESSION.wait_ti
meout = 2147483, @@SESSION.sql_mode = 'STRICT_ALL_TABLES'
2018-01-31T14:36:40.145440Z 345 Query SHOW TABLES LIKE 'application_settings'
2018-01-31T14:36:40.149082Z 345 Query SHOW FULL FIELDS FROM `application_settings`
2018-01-31T14:36:40.172786Z 345 Query SHOW TABLES
2018-01-31T14:36:40.174938Z 345 Query SHOW CREATE TABLE `application_settings`
2018-01-31T14:36:40.308565Z 345 Query SELECT `application_settings`.* FROM `application_settings` ORDER BY `application_settin
gs`.`id` DESC LIMIT 1
2018-01-31T14:36:40.328810Z 345 Query SELECT `application_settings`.* FROM `application_settings` ORDER BY `application_settin
gs`.`id` DESC LIMIT 1
I wonder if it could have to do with the upgrade to Ubuntu Xenial as base image since 10.4.0. Maybe some Ruby related stuff fundamentally changed there?
https://github.com/sameersbn/docker-gitlab/blob/master/Changelog.md
@solidnerd Do you maybe have an idea what could cause the issues we have?
@ld0574 I wonder if it has to do with MySQL version. Which one do you have? Mine is 5.7.11.
@mikehaertl Mine is 5.7.21, Maybe mysql connector inside was out-dated
@mikehaertl I have at no clue at the moment. I personally don't use mysql as database backend. But I know that @splattael is using mysql as database backend.
@splattael Did the last update work for you ? And what is your mysql server version ?
@solidnerd I experienced some collation problems with MySQL (also 5.7.21) during the upgrade, but I think this was my own fault. Creating a backup works like a charm. No problems at all :/
I solved the problem by modify mysql's config file: max_connections
. @mikehaertl
Make sure max_connections > Number of Rails Process * Size of Connection Pool
@ld0574 Wow, this seems to indeed have fixed it. Thanks! I'm on 10.5.1 now. Without this change, the upgrade still failed.
But it makes absolutely no sense to me. I've increased the max_connections
from default 100 to 500. I've checked the number of connections before and after with show status like '%onn%';
. The Max_used_connections
is somewhere in the <10 range. So how could this possibly be the problem?
Has anyone tried the latest 11.0.1? Gitlab now does not work at all anymore for me. I get similar errors like above. See #1652. Does anyone else have this?
This issue has been automatically marked as stale because it has not had any activity for the last 60 days. It will be closed if no further activity occurs during the next 7 days. Thank you for your contributions.
I just tried to upgrade to 10.4.1 from 10.3.2 but the container was not started successfully.
It always stopped with an error after "Migrating database..." and then restarted the same process over and over.
The full error message was: