Skip to content

Incrementing taggings_count entries results in statement timeouts

https://sentry.gitlap.com/gitlab/gitlabcom/issues/18924/

PG::QueryCanceled: ERROR:  canceling statement due to statement timeout
CONTEXT:  while rechecking updated tuple (453,144) in relation "tags"

  config/initializers/ar_monkey_patch.rb:12:in `_create_record'
    super
  app/services/ci/create_pipeline_builds_service.rb:26:in `create_build'
    build = pipeline.builds.create(build_attributes)
  lib/gitlab/metrics/instrumentation.rb:156:in `block in create_build'
    trans.method_call_for(#{label.to_sym.inspect}).measure { super }
  lib/gitlab/metrics/method_call.rb:23:in `measure'
    retval = yield
  lib/gitlab/metrics/instrumentation.rb:156:in `create_build'
    trans.method_call_for(#{label.to_sym.inspect}).measure { super }
...
(172 additional frame(s) were not displayed)

ActiveRecord::StatementInvalid: PG::QueryCanceled: ERROR:  canceling statement due to statement timeout
CONTEXT:  while rechecking updated tuple (453,144) in relation "tags"
: UPDATE "tags" SET "taggings_count" = COALESCE("taggings_count", 0) + 1 WHERE "tags"."id" = 26114

ActiveRecord::StatementInvalid: PG::QueryCanceled: ERROR:  canceling statement due to statement timeout
CONTEXT:  while rechecking updated tuple (453,144) in relation "tags"
: UPDATE "tags" SET "taggings_count" = COALESCE("taggings_count", 0) + 1 WHERE "tags"."id" = 26114