Column usage_stats_set_by_user_id not added through migrations
Summary
Upgrading from Gitlab-CE 10.8.5 to 11.10.4 fails to run migrations.
The column usage_stats_set_by_user_id (of the table application_settings) is expected to exist but does not. This leads to migrations failing.
Steps to reproduce
Install the omnibus of 10.8.5 and then upgrade it to the latest version (in this case 11.10.4).
What is the current bug behavior?
During the upgrade running the migrations fails. Gitlab services are running afterwards but Gitlab is not usable. It displays an 502 error page in the browser. Other tools trying to access gitlab fail because they can not communicate with the webservice.
Trying to manually run the migrations with gitlab-ctl upgrade
fails again with the same errors.
Running gitlab-ctl reconfigure
ran into the same error.
What is the expected correct behavior?
Migrations run without an error during the upgrade. Gitlab services are accessible afterwards.
Relevant logs and/or screenshots
Single migration run after the attempted migration during upgrade:
rake aborted! StandardError: An error has occurred, all later migrations canceled: PG::UndefinedColumn: ERROR: column "usage_stats_set_by_user_id" does not exist : CREATE INDEX CONCURRENTLY "index_application_settings_on_usage_stats_set_by_user_id" ON "application_settings" ("usage_stats_set_by_user_id" ) /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:149:in `add_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in `block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:254:in `disable_statement_timeout' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:68:in `add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb:11:in `up' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:56:in `block (3 levels) in ' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `' Caused by: ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "usage_stats_set_by_user_id" does not exist : CREATE INDEX CONCURRENTLY "index_application_settings_on_usage_stats_set_by_user_id" ON "application_settings" ("usage_stats_set_by_user_id" ) /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:149:in `add_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in `block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:254:in `disable_statement_timeout' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:68:in `add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb:11:in `up' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:56:in `block (3 levels) in ' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `' Caused by: PG::UndefinedColumn: ERROR: column "usage_stats_set_by_user_id" does not exist /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:149:in `add_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in `block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:254:in `disable_statement_timeout' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:68:in `add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb:11:in `up' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:56:in `block (3 levels) in ' /opt/gitlab/embedded/bin/bundle:23:in `load' /opt/gitlab/embedded/bin/bundle:23:in `' Tasks: TOP => db:migrate (See full trace by running task with --trace) == 20181030154446 AddMissingIndexesForForeignKeys: migrating ================== -- transaction_open?() -> 0.0000s -- index_name(:application_settings, {:column=>["usage_stats_set_by_user_id"]}) -> 0.0000s -- index_exists?(:application_settings, :usage_stats_set_by_user_id, {:algorithm=>:concurrently, :name=>"index_application_settings_on_usage_stats_set_by_user_id"}) -> 0.0017s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:application_settings, :usage_stats_set_by_user_id, {:algorithm=>:concurrently, :name=>"index_application_settings_on_usage_stats_set_by_user_id"}) -- execute("RESET ALL") -> 0.0002s
Complete migration run during upgrade
Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and the `Arel::Table` object was constructed manually. The easiest way to remove this warning is to use an `Arel::Table` object returned from calling `arel_table` on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. == 20171211131502 AddExternalClassificationAuthorizationSettingsToApplictionSettings: migrating -- transaction_open?() -> 0.0000s -- execute("SET statement_timeout TO 0") -> 0.0002s -- transaction() -- add_column(:application_settings, :external_authorization_service_enabled, :boolean, {:default=>nil}) -> 0.0024s -- change_column_default(:application_settings, :external_authorization_service_enabled, false) -> 0.0178s -> 0.0219s -- transaction_open?() -> 0.0000s -- exec_query("SELECT COUNT(*) AS count FROM "application_settings"") -> 0.0007s -- exec_query("SELECT "application_settings"."id" FROM "application_settings" ORDER BY "application_settings"."id" ASC LIMIT 1") -> 0.0005s -- exec_query("SELECT "application_settings"."id" FROM "application_settings" WHERE "application_settings"."id" >= 1 ORDER BY "application_settings"."id" ASC LIMIT 1 OFFSET 1") -> 0.0005s -- execute("UPDATE "application_settings" SET "external_authorization_service_enabled" = 'f' WHERE "application_settings"."id" >= 1") -> 0.0007s -- change_column_null(:application_settings, :external_authorization_service_enabled, false) -> 0.0006s -- execute("RESET ALL") -> 0.0002s -- add_column(:application_settings, :external_authorization_service_url, :string) -> 0.0007s -- add_column(:application_settings, :external_authorization_service_default_label, :string) -> 0.0007s == 20171211131502 AddExternalClassificationAuthorizationSettingsToApplictionSettings: migrated (0.0281s)== 20171218140451 AddExternalAuthorizationServiceClassificationLabelToProjects: migrating -- add_column(:projects, :external_authorization_classification_label, :string) -> 0.0024s == 20171218140451 AddExternalAuthorizationServiceClassificationLabelToProjects: migrated (0.0024s)
== 20180209115333 CreateChatopsTables: migrating ============================== -- create_table(:ci_pipeline_chat_data, {:id=>:bigserial}) -> 0.0564s -- add_foreign_key(:ci_pipeline_chat_data, :ci_pipelines, {:column=>:pipeline_id, :on_delete=>:cascade}) -> 0.0037s == 20180209115333 CreateChatopsTables: migrated (0.0602s) =====================
== 20180314100728 AddExternalAuthorizationServiceTimeoutToApplicationSettings: migrating -- add_column(:application_settings, :external_authorization_service_timeout, :float, {:default=>0.5}) -> 0.0212s == 20180314100728 AddExternalAuthorizationServiceTimeoutToApplicationSettings: migrated (0.0212s)
== 20180314145917 AddHeaderAndFooterBannersToAppearancesTable: migrating ====== -- add_column(:appearances, :header_message, :text) -> 0.0005s -- add_column(:appearances, :header_message_html, :text) -> 0.0003s -- add_column(:appearances, :footer_message, :text) -> 0.0003s -- add_column(:appearances, :footer_message_html, :text) -> 0.0003s -- add_column(:appearances, :message_background_color, :text) -> 0.0004s -- add_column(:appearances, :message_font_color, :text) -> 0.0003s == 20180314145917 AddHeaderAndFooterBannersToAppearancesTable: migrated (0.0023s)
== 20180315160435 AddExternalAuthMutualTlsFieldsToProjectSettings: migrating == -- add_column(:application_settings, :external_auth_client_cert, :text) -> 0.0005s -- add_column(:application_settings, :encrypted_external_auth_client_key, :text) -> 0.0004s -- add_column(:application_settings, :encrypted_external_auth_client_key_iv, :string) -> 0.0004s -- add_column(:application_settings, :encrypted_external_auth_client_key_pass, :string) -> 0.0004s -- add_column(:application_settings, :encrypted_external_auth_client_key_pass_iv, :string) -> 0.0004s == 20180315160435 AddExternalAuthMutualTlsFieldsToProjectSettings: migrated (0.0022s)
== 20180912111628 AddKnativeApplication: migrating ============================ -- create_table("clusters_applications_knative", {}) -> 0.0229s == 20180912111628 AddKnativeApplication: migrated (0.0230s) ===================
== 20180925200829 CreateUserPreferences: migrating ============================ -- create_table(:user_preferences, {}) -> 0.0157s == 20180925200829 CreateUserPreferences: migrated (0.0157s) ===================
== 20180927073410 AddIndexToProjectDeployTokensDeployTokenId: migrating ======= -- transaction_open?() -> 0.0000s -- index_name(:project_deploy_tokens, {:column=>["deploy_token_id"]}) -> 0.0000s -- index_exists?(:project_deploy_tokens, :deploy_token_id, {:algorithm=>:concurrently, :name=>"index_project_deploy_tokens_on_deploy_token_id"}) -> 0.0023s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:project_deploy_tokens, :deploy_token_id, {:algorithm=>:concurrently, :name=>"index_project_deploy_tokens_on_deploy_token_id"}) -> 0.0063s -- execute("RESET ALL") -> 0.0002s == 20180927073410 AddIndexToProjectDeployTokensDeployTokenId: migrated (0.0092s)
== 20181005110927 AddIndexToLfsObjectsFileStore: migrating ==================== -- transaction_open?() -> 0.0000s -- index_name(:lfs_objects, {:column=>["file_store"]}) -> 0.0000s -- index_exists?(:lfs_objects, :file_store, {:algorithm=>:concurrently, :name=>"index_lfs_objects_on_file_store"}) -> 0.0014s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:lfs_objects, :file_store, {:algorithm=>:concurrently, :name=>"index_lfs_objects_on_file_store"}) -> 0.0067s -- execute("RESET ALL") -> 0.0002s == 20181005110927 AddIndexToLfsObjectsFileStore: migrated (0.0087s) ===========
== 20181005125926 AddIndexToUploadsStore: migrating =========================== -- transaction_open?() -> 0.0000s -- index_name(:uploads, {:column=>["store"]}) -> 0.0000s -- index_exists?(:uploads, :store, {:algorithm=>:concurrently, :name=>"index_uploads_on_store"}) -> 0.0021s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:uploads, :store, {:algorithm=>:concurrently, :name=>"index_uploads_on_store"}) -> 0.0065s -- execute("RESET ALL") -> 0.0002s == 20181005125926 AddIndexToUploadsStore: migrated (0.0092s) ==================
== 20181006004100 ImportCommonMetricsNginxVts: migrating ====================== == 20181006004100 ImportCommonMetricsNginxVts: migrated (0.0698s) =============
== 20181008145341 StealEncryptColumns: migrating ============================== == 20181008145341 StealEncryptColumns: migrated (0.0065s) =====================
== 20181008145359 RemoveWebHooksTokenAndUrl: migrating ======================== -- remove_column(:web_hooks, :token, :string) -> 0.0008s -- remove_column(:web_hooks, :url, :string, {:limit=>2000}) -> 0.0003s == 20181008145359 RemoveWebHooksTokenAndUrl: migrated (0.0012s) ===============
== 20181008200441 RemoveCircuitBreaker: migrating ============================= -- column_exists?(:application_settings, :circuitbreaker_failure_count_threshold) -> 0.0114s -- remove_column(:application_settings, :circuitbreaker_failure_count_threshold) -> 0.0020s -- column_exists?(:application_settings, :circuitbreaker_failure_reset_time) -> 0.0109s -- remove_column(:application_settings, :circuitbreaker_failure_reset_time) -> 0.0009s -- column_exists?(:application_settings, :circuitbreaker_storage_timeout) -> 0.0109s -- remove_column(:application_settings, :circuitbreaker_storage_timeout) -> 0.0009s -- column_exists?(:application_settings, :circuitbreaker_access_retries) -> 0.0110s -- remove_column(:application_settings, :circuitbreaker_access_retries) -> 0.0009s -- column_exists?(:application_settings, :circuitbreaker_check_interval) -> 0.0104s -- remove_column(:application_settings, :circuitbreaker_check_interval) -> 0.0008s == 20181008200441 RemoveCircuitBreaker: migrated (0.0605s) ====================
== 20181009190428 CreateClustersKubernetesNamespaces: migrating =============== -- create_table(:clusters_kubernetes_namespaces, {:id=>:bigserial}) -> 0.0314s == 20181009190428 CreateClustersKubernetesNamespaces: migrated (0.0314s) ======
== 20181010133639 BackfillStoreProjectFullPathInRepo: migrating =============== == 20181010133639 BackfillStoreProjectFullPathInRepo: migrated (0.0404s) ======
== 20181010235606 CreateBoardProjectRecentVisits: migrating ===================Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and the
Arel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel.-- create_table(:board_project_recent_visits, {:id=>:bigserial}) -> 0.0239s -- add_index(:board_project_recent_visits, [:user_id, :project_id, :board_id], {:unique=>true, :name=>"index_board_project_recent_visits_on_user_project_and_board"}) -> 0.0040s == 20181010235606 CreateBoardProjectRecentVisits: migrated (0.0280s) ==========
== 20181013005024 RemoveKodingFromApplicationSettings: migrating ============== -- remove_column(:application_settings, :koding_enabled) -> 0.0005s -- remove_column(:application_settings, :koding_url) -> 0.0004s == 20181013005024 RemoveKodingFromApplicationSettings: migrated (0.0010s) =====
== 20181014203236 CreateClusterGroups: migrating ============================== -- create_table(:cluster_groups, {}) -> 0.0149s == 20181014203236 CreateClusterGroups: migrated (0.0149s) =====================
== 20181015155839 AddFinishedAtToDeployments: migrating ======================= -- add_column(:deployments, :finished_at, :datetime_with_timezone) -> 0.0017s == 20181015155839 AddFinishedAtToDeployments: migrated (0.0017s) ==============
== 20181016141739 AddStatusToDeployments: migrating =========================== -- transaction_open?() -> 0.0000s -- execute("SET statement_timeout TO 0") -> 0.0002s -- transaction() -- add_column(:deployments, :status, :integer, {:default=>nil, :limit=>2}) -> 0.0004s -- change_column_default(:deployments, :status, 2) -> 0.0023s -> 0.0039s -- transaction_open?() -> 0.0000s -- exec_query("SELECT COUNT(*) AS count FROM "deployments"") -> 0.0005s -- change_column_null(:deployments, :status, false) -> 0.0005s -- execute("RESET ALL") -> 0.0002s == 20181016141739 AddStatusToDeployments: migrated (0.0057s) ==================
== 20181016152238 CreateBoardGroupRecentVisits: migrating ===================== -- create_table(:board_group_recent_visits, {:id=>:bigserial}) -> 0.0350s -- add_index(:board_group_recent_visits, [:user_id, :group_id, :board_id], {:unique=>true, :name=>"index_board_group_recent_visits_on_user_group_and_board"}) -> 0.0071s == 20181016152238 CreateBoardGroupRecentVisits: migrated (0.0422s) ============
== 20181017001059 AddClusterTypeToClusters: migrating ========================= -- transaction_open?() -> 0.0000s -- execute("SET statement_timeout TO 0") -> 0.0003s -- transaction() -- add_column(:clusters, :cluster_type, :smallint, {:default=>nil}) -> 0.0008s -- change_column_default(:clusters, :cluster_type, 3) -> 0.0019s -> 0.0038s -- transaction_open?() -> 0.0000s -- exec_query("SELECT COUNT(*) AS count FROM "clusters"") -> 0.0006s -- change_column_null(:clusters, :cluster_type, false) -> 0.0006s -- execute("RESET ALL") -> 0.0002s == 20181017001059 AddClusterTypeToClusters: migrated (0.0057s) ================
== 20181019032400 AddShardsTable: migrating =================================== -- create_table(:shards, {}) -> 0.0240s == 20181019032400 AddShardsTable: migrated (0.0241s) ==========================
== 20181019032408 AddRepositoriesTable: migrating ============================= -- create_table(:repositories, {:id=>:bigserial}) -> 0.0175s -- add_column(:projects, :pool_repository_id, :bigint) -> 0.0016s -- add_index(:projects, :pool_repository_id, {:where=>"pool_repository_id IS NOT NULL"}) -> 0.0105s == 20181019032408 AddRepositoriesTable: migrated (0.0298s) ====================
== 20181019105553 AddProjectsPoolRepositoryIdForeignKey: migrating ============ -- transaction_open?() -> 0.0000s -- foreign_keys(:projects) -> 0.0033s -- execute("ALTER TABLE projects\nADD CONSTRAINT fk_6e5c14658a\nFOREIGN KEY (pool_repository_id)\nREFERENCES repositories (id)\nON DELETE SET NULL\nNOT VALID;\n") -> 0.0012s -- execute("SET statement_timeout TO 0") -> 0.0002s -- execute("ALTER TABLE projects VALIDATE CONSTRAINT fk_6e5c14658a;") -> 0.0013s -- execute("RESET ALL") -> 0.0002s == 20181019105553 AddProjectsPoolRepositoryIdForeignKey: migrated (0.0065s) ===
== 20181022135539 AddIndexOnStatusToDeployments: migrating ==================== -- transaction_open?() -> 0.0000s -- index_name(:deployments, {:column=>["project_id", "status"]}) -> 0.0000s -- index_exists?(:deployments, [:project_id, :status], {:algorithm=>:concurrently, :name=>"index_deployments_on_project_id_and_status"}) -> 0.0025s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:deployments, [:project_id, :status], {:algorithm=>:concurrently, :name=>"index_deployments_on_project_id_and_status"}) -> 0.0052s -- execute("RESET ALL") -> 0.0002s -- transaction_open?() -> 0.0000s -- index_name(:deployments, {:column=>["environment_id", "status"]}) -> 0.0000s -- index_exists?(:deployments, [:environment_id, :status], {:algorithm=>:concurrently, :name=>"index_deployments_on_environment_id_and_status"}) -> 0.0026s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:deployments, [:environment_id, :status], {:algorithm=>:concurrently, :name=>"index_deployments_on_environment_id_and_status"}) -> 0.0043s -- execute("RESET ALL") -> 0.0002s == 20181022135539 AddIndexOnStatusToDeployments: migrated (0.0158s) ===========
== 20181022173835 EnqueuePopulateClusterKubernetesNamespace: migrating ======== == 20181022173835 EnqueuePopulateClusterKubernetesNamespace: migrated (0.0006s)
== 20181023104858 AddArchiveBuildsDurationToApplicationSettings: migrating ==== -- add_column(:application_settings, :archive_builds_in_seconds, :integer, {:allow_null=>true}) -> 0.0006s == 20181023104858 AddArchiveBuildsDurationToApplicationSettings: migrated (0.0006s)
== 20181023144439 AddPartialIndexForLegacySuccessfulDeployments: migrating ==== -- transaction_open?() -> 0.0000s -- index_exists?(:deployments, :id, {:where=>"finished_at IS NULL AND status = 2", :name=>"partial_index_deployments_for_legacy_successful_deployments", :algorithm=>:concurrently}) -> 0.0029s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:deployments, :id, {:where=>"finished_at IS NULL AND status = 2", :name=>"partial_index_deployments_for_legacy_successful_deployments", :algorithm=>:concurrently}) -> 0.0051s -- execute("RESET ALL") -> 0.0002s == 20181023144439 AddPartialIndexForLegacySuccessfulDeployments: migrated (0.0086s)
== 20181025115728 AddPrivateCommitEmailHostnameToApplicationSettings: migrating -- add_column(:application_settings, :commit_email_hostname, :string, {:null=>true}) -> 0.0005s == 20181025115728 AddPrivateCommitEmailHostnameToApplicationSettings: migrated (0.0006s)
== 20181026091631 MigrateForbiddenRedirectUris: migrating ===================== -- transaction_open?() -> 0.0000s -- exec_query("SELECT COUNT() AS count FROM "oauth_applications" WHERE (("oauth_applications"."redirect_uri" ILIKE 'data://%' OR "oauth_applications"."redirect_uri" ILIKE 'vbscript://%') OR "oauth_applications"."redirect_uri" ILIKE 'javascript://%')") -> 0.0015s -- transaction_open?() -> 0.0000s -- exec_query("SELECT COUNT() AS count FROM "oauth_access_grants" WHERE (("oauth_access_grants"."redirect_uri" ILIKE 'data://%' OR "oauth_access_grants"."redirect_uri" ILIKE 'vbscript://%') OR "oauth_access_grants"."redirect_uri" ILIKE 'javascript://%')") -> 0.0014s == 20181026091631 MigrateForbiddenRedirectUris: migrated (0.0070s) ============
== 20181026143227 MigrateSnippetsAccessLevelDefaultValue: migrating =========== -- change_column_default(:project_features, :snippets_access_level, 20) -> 0.0031s -- change_column_null(:project_features, :snippets_access_level, false) -> 0.0006s == 20181026143227 MigrateSnippetsAccessLevelDefaultValue: migrated (0.0076s) ==
== 20181027114222 AddFirstDayOfWeekToUserPreferences: migrating =============== -- add_column(:user_preferences, :first_day_of_week, :integer) -> 0.0004s == 20181027114222 AddFirstDayOfWeekToUserPreferences: migrated (0.0005s) ======
== 20181028120717 AddFirstDayOfWeekToApplicationSettings: migrating =========== -- transaction_open?() -> 0.0000s -- execute("SET statement_timeout TO 0") -> 0.0002s -- transaction() -- add_column(:application_settings, :first_day_of_week, :integer, {:default=>nil})Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and the
Arel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. Arel performing automatic type casting is deprecated, and will be removed in Arel 8.0. If you are seeing this, it is because you are manually passing a value to an Arel predicate, and theArel::Table
object was constructed manually. The easiest way to remove this warning is to use anArel::Table
object returned from callingarel_table
on an ActiveRecord::Base subclass.If you're certain the value is already of the right type, change
attribute.eq(value)
toattribute.eq(Arel::Nodes::Quoted.new(value))
(you will be able to remove that in Arel 8.0, it is only required to silence this deprecation warning).You can also silence this warning globally by setting
$arel_silence_type_casting_deprecation
totrue
. (Do NOT do this if you are a library author)If you are passing user input to a predicate, you must either give an appropriate type caster object to the
Arel::Table
, or manually cast the value before passing it to Arel. rake aborted! StandardError: An error has occurred, all later migrations canceled:PG::UndefinedColumn: ERROR: column "usage_stats_set_by_user_id" does not exist : CREATE INDEX CONCURRENTLY "index_application_settings_on_usage_stats_set_by_user_id" ON "application_settings" ("usage_stats_set_by_user_id" ) /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:149:in
add_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in
block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:254:indisable_statement_timeout' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:68:in
add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb:11:inup' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:56:in
block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:inload' /opt/gitlab/embedded/bin/bundle:23:in
'Caused by: ActiveRecord::StatementInvalid: PG::UndefinedColumn: ERROR: column "usage_stats_set_by_user_id" does not exist : CREATE INDEX CONCURRENTLY "index_application_settings_on_usage_stats_set_by_user_id" ON "application_settings" ("usage_stats_set_by_user_id" ) /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:149:in
add_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in
block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:254:indisable_statement_timeout' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:68:in
add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb:11:inup' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:56:in
block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:inload' /opt/gitlab/embedded/bin/bundle:23:in
'Caused by: PG::UndefinedColumn: ERROR: column "usage_stats_set_by_user_id" does not exist /opt/gitlab/embedded/service/gitlab-rails/config/initializers/postgresql_opclasses_support.rb:149:in
add_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:69:in
block in add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:254:indisable_statement_timeout' /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/database/migration_helpers.rb:68:in
add_concurrent_index' /opt/gitlab/embedded/service/gitlab-rails/db/migrate/20181030154446_add_missing_indexes_for_foreign_keys.rb:11:inup' /opt/gitlab/embedded/service/gitlab-rails/lib/tasks/gitlab/db.rake:56:in
block (3 levels) in <top (required)>' /opt/gitlab/embedded/bin/bundle:23:inload' /opt/gitlab/embedded/bin/bundle:23:in
' Tasks: TOP => db:migrate (See full trace by running task with --trace)-> 0.0036s -- change_column_default(:application_settings, :first_day_of_week, 0) -> 0.0111s -> 0.0155s -- transaction_open?() -> 0.0000s -- exec_query("SELECT COUNT(*) AS count FROM "application_settings"") -> 0.0005s -- exec_query("SELECT "application_settings"."id" FROM "application_settings" ORDER BY "application_settings"."id" ASC LIMIT 1") -> 0.0003s -- exec_query("SELECT "application_settings"."id" FROM "application_settings" WHERE "application_settings"."id" >= 1 ORDER BY "application_settings"."id" ASC LIMIT 1 OFFSET 1") -> 0.0005s -- execute("UPDATE "application_settings" SET "first_day_of_week" = 0 WHERE "application_settings"."id" >= 1") -> 0.0009s -- change_column_null(:application_settings, :first_day_of_week, false) -> 0.0006s -- execute("RESET ALL") -> 0.0002s == 20181028120717 AddFirstDayOfWeekToApplicationSettings: migrated (0.0196s) ==
== 20181030135124 FillEmptyFinishedAtInDeployments: migrating ================= == 20181030135124 FillEmptyFinishedAtInDeployments: migrated (0.0040s) ========
== 20181030154446 AddMissingIndexesForForeignKeys: migrating ================== -- transaction_open?() -> 0.0000s -- index_name(:application_settings, {:column=>["usage_stats_set_by_user_id"]}) -> 0.0000s -- index_exists?(:application_settings, :usage_stats_set_by_user_id, {:algorithm=>:concurrently, :name=>"index_application_settings_on_usage_stats_set_by_user_id"}) -> 0.0008s -- execute("SET statement_timeout TO 0") -> 0.0002s -- add_index(:application_settings, :usage_stats_set_by_user_id, {:algorithm=>:concurrently, :name=>"index_application_settings_on_usage_stats_set_by_user_id"}) -- execute("RESET ALL") -> 0.0002s
Output of checks
(If you are reporting a bug on GitLab.com, write: This bug happens on GitLab.com)
Results of GitLab environment info
Expand for output related to GitLab environment info
# gitlab-rake gitlab:env:info System information System: Ubuntu 18.04 Current User: git Using RVM: no Ruby Version: 2.5.3p105 Gem Version: 2.7.6 Bundler Version:1.17.3 Rake Version: 12.3.2 Redis Version: 3.2.12 Git Version: 2.18.1 Sidekiq Version:5.2.5 Go Version: unknownGitLab information Version: 11.10.4 Revision: 62c464651d2 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: PostgreSQL DB Version: 9.6.11 URL: https://gitlab.uib.local HTTP Clone URL: https://gitlab.uib.local/some-group/some-project.git SSH Clone URL: git@gitlab.uib.local:some-group/some-project.git Using LDAP: yes Using Omniauth: yes Omniauth Providers:
GitLab Shell Version: 9.0.0 Repository storage paths:
- default: /var/opt/gitlab/git-data/repositories GitLab Shell path: /opt/gitlab/embedded/service/gitlab-shell Git: /opt/gitlab/embedded/bin/git
Results of GitLab application Check
Expand for output related to the GitLab application check
# gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...Checking GitLab Shell ...
GitLab Shell: ... GitLab Shell version >= 9.0.0 ? ... OK (9.0.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: FAILED: Failed to connect to internal API gitlab-shell self-check failed Try fixing it: Make sure GitLab is running; Check the gitlab-shell configuration file: sudo -u git -H editor /opt/gitlab/embedded/service/gitlab-shell/config.yml Please fix the error above and rerun the checks.
Checking GitLab Shell ... Finished
Checking Gitaly ...
Gitaly: ... default ... OK
Checking Gitaly ... Finished
Checking Sidekiq ...
Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1
Checking Sidekiq ... Finished
Checking Incoming Email ...
Incoming Email: ... Reply by email is disabled in config/gitlab.yml
Checking Incoming Email ... Finished
Checking LDAP ...
LDAP: ... Server: ldapmain LDAP authentication... Success LDAP users with access to your GitLab server (only showing the first 100 results) Checking LDAP ... Finished
Checking GitLab App ...
Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 16/1 ... yes 16/2 ... yes 16/3 ... yes 16/4 ... yes 16/5 ... yes 16/6 ... yes 16/7 ... yes 16/8 ... yes 16/9 ... yes 16/10 ... yes 16/11 ... yes 16/12 ... yes 16/13 ... yes 16/14 ... yes 16/15 ... yes 16/16 ... yes 16/18 ... yes 16/19 ... yes 16/20 ... yes 16/21 ... yes 16/22 ... yes 16/23 ... yes 16/24 ... yes 16/25 ... yes 16/26 ... yes 16/27 ... yes 16/28 ... yes 16/29 ... yes 16/30 ... yes 16/31 ... yes 16/32 ... yes 16/33 ... yes 16/34 ... yes 16/35 ... yes 16/36 ... yes 16/37 ... yes 16/38 ... yes 16/39 ... yes 16/40 ... yes 16/41 ... yes 16/42 ... yes 16/43 ... yes 16/44 ... yes 16/45 ... yes 16/46 ... yes 16/47 ... yes 16/48 ... yes 16/49 ... yes 16/50 ... yes 16/51 ... yes 16/52 ... yes 16/53 ... yes 16/54 ... yes 16/56 ... yes 16/57 ... yes 16/58 ... yes 16/59 ... yes 16/60 ... yes 16/61 ... yes 16/62 ... yes 16/63 ... yes 16/64 ... yes 16/65 ... yes 16/66 ... yes 16/67 ... yes 18/68 ... yes 19/69 ... yes 19/70 ... yes 19/71 ... yes 19/72 ... yes 19/73 ... yes 19/74 ... yes 19/75 ... yes 19/76 ... yes 19/77 ... yes 19/78 ... yes 19/79 ... yes 19/80 ... yes 19/81 ... yes 19/82 ... yes 19/83 ... yes 19/84 ... yes 19/85 ... yes 19/86 ... yes 19/87 ... yes 19/88 ... yes 19/89 ... yes 19/90 ... yes 19/91 ... yes 19/92 ... yes 19/93 ... yes 19/94 ... yes 19/95 ... yes 19/96 ... yes 19/97 ... yes 19/98 ... yes 19/99 ... yes 19/100 ... yes 19/101 ... yes 21/102 ... yes 21/103 ... yes 21/104 ... yes 21/105 ... yes 21/106 ... yes 21/107 ... yes 20/108 ... yes 20/109 ... yes 20/110 ... yes 20/111 ... yes 20/112 ... yes 16/113 ... yes 13/114 ... yes 13/115 ... yes 10/116 ... yes 10/117 ... yes 6/118 ... yes 6/119 ... yes 16/122 ... yes 4/123 ... yes 4/124 ... yes 4/125 ... yes 4/126 ... yes 4/127 ... yes 4/128 ... yes 4/129 ... yes 4/130 ... yes 4/131 ... yes 4/132 ... yes 4/133 ... yes 4/134 ... yes 4/135 ... yes 4/136 ... yes 6/137 ... yes 6/138 ... yes 6/139 ... yes 6/140 ... yes 4/141 ... yes 4/142 ... yes 6/143 ... yes 4/144 ... yes 6/145 ... yes 6/146 ... yes 6/147 ... yes 4/148 ... yes 6/149 ... yes 4/150 ... yes 6/151 ... yes 4/152 ... yes 4/154 ... yes 4/155 ... yes 4/156 ... yes 4/157 ... yes 4/158 ... yes 23/159 ... yes 4/160 ... yes 2/161 ... yes 4/162 ... yes 2/163 ... yes 4/164 ... yes 2/165 ... yes 4/166 ... yes 4/167 ... yes 4/168 ... yes 4/169 ... yes 4/171 ... yes 4/172 ... yes 4/173 ... yes 4/174 ... yes 4/175 ... yes 18/176 ... yes 13/177 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 18
Checking GitLab App ... Finished
Checking GitLab subtasks ... Finished
Possible fixes
We are missing the column usage_stats_set_by_user_id which has originally been introduced as part of https://gitlab.com/gitlab-org/gitlab-ce/commit/ed9550f8d3fbe106e0ffb7ef9cc246566044d4b4 I can not find any line indicating that the migrations adding this have been executed.
A possible solution might be requiring the migrations from 20180829101639 to run before any migrations referencing the columns added there (in this case 20181028120717)