Skip to content
Snippets Groups Projects

Retried in database

Merged Kamil Trzcińśki requested to merge retried-in-database-mysql into master
All threads resolved!

What does this MR do?

This stores latest in the database. We update in transaction information about whether the build is latest. We don't need an index on that column, as we aim for 99% builds to be latest (retry is usually an exception).

This greatly simplifies and fastens a lot of SQL queries and job-stage-related views.

Supersedes https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10721 as we also need to run MySQL tests.

Are there points in the code the reviewer needs to double check?

Why was this MR needed?

Screenshots (if relevant)

Does this MR meet the acceptance criteria?

What are the relevant issue numbers?

Closes #25737 (closed)

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • added 1 commit

    Compare with previous version

  • Kamil Trzcińśki changed title from Retried in database mysql to Retried in database

    changed title from Retried in database mysql to Retried in database

  • Kamil Trzcińśki added 11 commits

    added 11 commits

    • 4557d08f...729c006f - 8 commits from branch master
    • bcc5a482 - Merge remote-tracking branch 'origin/master' into retried-in-database
    • 89f0d0d7 - Update migrations
    • 4d6a525a - Merge branch 'retried-in-database' into retried-in-database-mysql

    Compare with previous version

  • @ayufan Could you rebase the various commits down to a smaller number? This way we get rid of any intermediate commits (e.g. the removal of binding.pry).

  • Kamil Trzcińśki added 18 commits

    added 18 commits

    Compare with previous version

  • added 1 commit

    • 582d137c - Store retried in database for CI builds

    Compare with previous version

  • Kamil Trzcińśki added 69 commits

    added 69 commits

    Compare with previous version

  • added 1 commit

    • c608508e - Store retried in database for CI builds

    Compare with previous version

  • Kamil Trzcińśki added 177 commits

    added 177 commits

    Compare with previous version

  • Kamil Trzcińśki added 177 commits

    added 177 commits

    Compare with previous version

  • added 8 commits

    Compare with previous version

  • Kamil Trzcińśki added 50 commits

    added 50 commits

    Compare with previous version

  • username-removed-443319
  • added 1 commit

    • f774d377 - Make retried to be nullable

    Compare with previous version

  • Kamil Trzcińśki resolved all discussions

    resolved all discussions

  • mentioned in issue #32015 (moved)

  • @ayufan thanks, one typo.

    If this is to be picked into stable, please follow https://gitlab.com/gitlab-org/gitlab-ce/blob/master/PROCESS.md#after-the-7th and ensure the RMs are OK with this!

  • What is the status here @ayufan ? 😄

  • Author Maintainer

    @selfup Fixed.

  • Author Maintainer

    @smcgivern They are.

  • added 1 commit

    • 015ea79c - Make retried to be nullable

    Compare with previous version

  • username-removed-443319 resolved all discussions

    resolved all discussions

  • username-removed-443319 approved this merge request

    approved this merge request

  • username-removed-443319 enabled an automatic merge when the pipeline for 015ea79c succeeds

    enabled an automatic merge when the pipeline for 015ea79c succeeds

  • Kamil Trzcińśki resolved all discussions

    resolved all discussions

  • added 1 commit

    • f09dcbd9 - Make retried to be nullable

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • username-removed-642931 approved this merge request

    approved this merge request

  • username-removed-642931 enabled an automatic merge when the pipeline for 7eaab72b succeeds

    enabled an automatic merge when the pipeline for 7eaab72b succeeds

  • Retrying pipeline. Docker failures :/

    Edited by username-removed-642931
  • username-removed-642931 canceled the automatic merge

    canceled the automatic merge

  • This requires an EE MR to fix the compact check

    Cannot merge until both are passing 🤔

    Edited by username-removed-642931
  • Author Maintainer

    @stanhu @selfup

    This is false positive as not all changes are yet merged to EE. The changes from this MR apply cleanly to EE.

  • mentioned in commit 81df0034

  • Picked into 9-2-stable, will go into 9.2.0-rc1

  • mentioned in commit 0e175cf9

  • mentioned in issue #32146 (closed)

  • I believe this is causing the following error when using MySQL

    sudo -u git -H bundle exec rake db:migrate RAILS_ENV=production
    == 20170503004427 UpateRetriedForCiBuild: migrating ===========================
    -- exec_query("SELECT COUNT(*) AS count FROM `ci_builds` WHERE `ci_builds`.`retried` IS NULL")
       -> 0.0021s
    -- exec_query("SELECT  `ci_builds`.`id` FROM `ci_builds` WHERE `ci_builds`.`retried` IS NULL  ORDER BY `ci_builds`.`id` ASC LIMIT 1")
       -> 0.0003s
    -- exec_query("SELECT  `ci_builds`.`id` FROM `ci_builds` WHERE `ci_builds`.`id` >= 1 AND `ci_builds`.`retried` IS NULL  ORDER BY `ci_builds`.`id` ASC LIMIT 1 OFFSET 230")
       -> 0.0004s
    -- execute("UPDATE `ci_builds` SET `retried` = ((SELECT MAX(ci_builds2.id)\n  FROM ci_builds ci_builds2\n  WHERE ci_builds.commit_id=ci_builds2.commit_id\n    AND ci_builds.name=ci_builds2.name\n) != ci_builds.id) WHERE `ci_builds`.`id` >= 1 AND `ci_builds`.`id` < 231 AND `ci_builds`.`retried` IS NULL")
    rake aborted!
    StandardError: An error has occurred, all later migrations canceled:
    
    Mysql2::Error: You can't specify target table 'ci_builds' for update in FROM clause: UPDATE `ci_builds` SET `retried` = ((SELECT MAX(ci_builds2.id)
      FROM ci_builds ci_builds2
      WHERE ci_builds.commit_id=ci_builds2.commit_id
        AND ci_builds.name=ci_builds2.name
    ) != ci_builds.id) WHERE `ci_builds`.`id` >= 1 AND `ci_builds`.`id` < 231 AND `ci_builds`.`retried` IS NULL/home/git/gitlab/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/connection_adapters/abstract_mysql_adapter.rb:309:in `query'

    Happy to provide more information if needed. Thanks

  • mentioned in issue gitlab#9734

  • Please register or sign in to reply
    Loading