Skip to content
Snippets Groups Projects

Add VulnerabilityStateTransition model

All threads resolved!

This model will be responsible for storing state transitions of a Vulnerability.

#325700 (closed)

Migration up

rake db:migrate:up:main VERSION=20220517182529
== 20220517182529 CreateVulnerabilityStateTransition: migrating ===============
-- create_table(:vulnerability_state_transitions, {})
   -> 0.0151s
== 20220517182529 CreateVulnerabilityStateTransition: migrated (0.0152s) ======

Migration down

rake db:migrate:down:main VERSION=20220517182529
== 20220517182529 CreateVulnerabilityStateTransition: reverting ===============
-- drop_table(:vulnerability_state_transitions)
   -> 0.0060s
== 20220517182529 CreateVulnerabilityStateTransition: reverted (0.0061s) ======
Edited by Marcos Rocha

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
  • Marcos Rocha changed milestone to %15.1

    changed milestone to %15.1

  • assigned to @mc_rocha

  • Suggested Reviewers (beta)

    The individuals below may be good candidates to participate in the review based on various factors.

    You can use slash commands in comments to quickly assign /assign_reviewer @user1.

    Suggested Reviewers
    @NikolayS, @adriel, @rymai, @kmann, @jdsalaro

    If you do not believe these suggestions are useful, please apply the label Bad Suggested Reviewer. You can also provide feedback for this feature on this issue: https://gitlab.com/gitlab-org/gitlab/-/issues/357923.

    Automatically generated by Suggested Reviewers Bot - an experimental ML-based recommendation engine created by ~"group::applied ml".

    Edited by GitLab Reviewer-Recommender Bot
  • 1 Warning
    :warning: b03199c7: Commits that change 30 or more lines across at least 3 files should describe these changes in the commit body. For more information, take a look at our Commit message guidelines.
    1 Message
    :book: This merge request adds or changes files that require a review from the Database team.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    This merge request requires a database review. To make sure these changes are reviewed, take the following steps:

    1. Ensure the merge request has database and databasereview pending labels. If the merge request modifies database files, Danger will do this for you.
    2. Prepare your MR for database review according to the docs.
    3. Assign and mention the database reviewer suggested by Reviewer Roulette.

    The following files require a review from the Database team:

    • db/docs/vulnerability_state_transitions.yml
    • db/migrate/20220517182529_create_vulnerability_state_transition.rb
    • db/migrate/20220517182529_create_vulnerability_state_transition.rb
    • db/schema_migrations/20220517182529
    • db/structure.sql
    • lib/gitlab/database/gitlab_schemas.yml
    • lib/gitlab/database/gitlab_schemas.yml

    Reviewer roulette

    Changes that require review have been detected!

    Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:

    Category Reviewer Maintainer
    backend Brett Walker (@digitalmoksha) (UTC-5) Alex Pooley (@alexpooley) (UTC+8)
    database João Pereira (@jdrpereira) (UTC+1) Krasimir Angelov (@krasio) (UTC+12)
    ~migration No reviewer available No maintainer available

    To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.

    Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.

    Generated by :no_entry_sign: Danger

  • Allure report

    allure-report-publisher generated test report!

    review-qa-blocking: :x: test report for 56d25e59

    expand test summary
    +-------------------------------------------------------------------+
    |                          suites summary                           |
    +----------------------+--------+--------+---------+-------+--------+
    |                      | passed | failed | skipped | flaky | result |
    +----------------------+--------+--------+---------+-------+--------+
    | Create               | 22     | 1      | 2       | 23    | ❌     |
    | Plan                 | 40     | 1      | 1       | 41    | ❌     |
    | Verify               | 11     | 1      | 1       | 12    | ❌     |
    | Version sanity check | 0      | 0      | 1       | 0     | ➖     |
    | Manage               | 35     | 1      | 2       | 38    | ❌     |
    | Configure            | 0      | 0      | 1       | 0     | ➖     |
    | Protect              | 2      | 0      | 0       | 2     | ❗     |
    | Package              | 0      | 0      | 1       | 0     | ➖     |
    +----------------------+--------+--------+---------+-------+--------+
    | Total                | 110    | 4      | 9       | 116   | ❌     |
    +----------------------+--------+--------+---------+-------+--------+
  • Marcos Rocha added 425 commits

    added 425 commits

    • a0cfe137...7b599774 - 422 commits from branch master
    • fea7a6b7 - Add VulnerabilityStateTransition model
    • 421fa78e - Move VulnerabilityStateTransition model to Vulnerabilities module
    • 0eebf32b - Add VulnerabilityStateTransition model

    Compare with previous version

  • Marcos Rocha added 35 commits

    added 35 commits

    • 0eebf32b...a434a913 - 31 commits from branch master
    • e31b8e56 - Add VulnerabilityStateTransition model
    • 393fe62d - Move VulnerabilityStateTransition model to Vulnerabilities module
    • 2ec7bc53 - Add VulnerabilityStateTransition model
    • f237cef3 - Add missing database documentation files

    Compare with previous version

  • Marcos Rocha added 35 commits

    added 35 commits

    • 0eebf32b...a434a913 - 31 commits from branch master
    • e31b8e56 - Add VulnerabilityStateTransition model
    • 393fe62d - Move VulnerabilityStateTransition model to Vulnerabilities module
    • 2ec7bc53 - Add VulnerabilityStateTransition model
    • f237cef3 - Add missing database documentation files

    Compare with previous version

  • Marcos Rocha requested review from @Quintasan

    requested review from @Quintasan

  • Database migrations

    1 Warnings
    :warning: 20220517182529 - CreateVulnerabilityStateTransition had a query that exceeded timing
    guidelines
    . Run time should not exceed 100ms, but it was 356.98ms. Please consider possible options
    to improve the query performance.
    CREATE TABLE "vulnerability_state_transitions" ("id"
    bigserial primary key, "vulnerability_id" bigint NOT NULL, "to_state" smallint NOT NULL,
    "from_state" smallint NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT
    NULL, CONSTRAINT "fk_rails_60e4899648" FOREIGN KEY ("vulnerability_id") REFERENCES "vulnerabilities"
    ("id") ON DELETE CASCADE)
    /*application:test,db_config_name:main,line:/lib/gitlab/database/migration_helpers/v2.rb:46:in
    `create_table'*/

    Migrations included in this change have been executed on gitlab.com data for testing purposes. For details, please see the migration testing pipeline (limited access).

    Migration Type Total runtime Result DB size change
    20220517182529 - CreateVulnerabilityStateTransition Regular 1.9 s :warning: +24.00 KiB
    Runtime Histogram for all migrations
    Query Runtime Count
    0 seconds - 0.01 seconds 0
    0.01 seconds - 0.1 seconds 1
    0.1 seconds - 1 second 1
    1 second - 5 minutes 0
    5 minutes + 0

    :warning: Migration: 20220517182529 - CreateVulnerabilityStateTransition

    • Type: Regular
    • Duration: 1.9 s
    • Database size change: +24.00 KiB
    Query Calls Total Time Max Time Mean Time Rows
    CREATE TABLE "vulnerability_state_transitions" ("id" bigserial primary key, "vulnerability_id" bigint NOT NULL, "to_state" smallint NOT NULL, "from_state" smallint NOT NULL, "created_at" timestamptz NOT NULL, "updated_at" timestamptz NOT NULL, CONSTRAINT "fk_rails_60e4899648" FOREIGN KEY ("vulnerability_id") REFERENCES "vulnerabilities" ("id") ON DELETE CASCADE) /*application:test,db_config_name:main,line:/lib/gitlab/database/migration_helpers/v2.rb:46:in `create_table'*/
    1 357.0 ms 357.0 ms 357.0 ms 0
    CREATE INDEX "index_vulnerability_state_transitions_on_vulnerability_id" ON "vulnerability_state_transitions" ("vulnerability_id") /*application:test,db_config_name:main,line:/lib/gitlab/database/migration_helpers/v2.rb:46:in `create_table'*/
    1 7.6 ms 7.6 ms 7.6 ms 0
    Histogram for CreateVulnerabilityStateTransition
    Query Runtime Count
    0 seconds - 0.01 seconds 0
    0.01 seconds - 0.1 seconds 1
    0.1 seconds - 1 second 1
    1 second - 5 minutes 0
    5 minutes + 0

    Background migrations


    Other migrations pending on GitLab.com
    Migration Type Total runtime Result DB size change

    Clone Details

    Clone ID Clone Created At Clone Data Timestamp Expected Removal Time
    database-testing-1214347 2022-05-20T08:13:01Z 2022-05-20T04:11:22Z 2022-05-20 20:14:56 +0000

    Artifacts


    Brought to you by gitlab-org/database-team/gitlab-com-database-testing. Epic

    • Resolved by Alex Pooley

      question to maintainer: If my Postgres foo is correct then I think that adding an index on (vulnerability_id, created_at DESC) would be beneficial here because:

      1. Indexes on foreign keys are mandatory
      2. We will most likely want to present the state transition from the latest one to the first one (ORDER BY created_at DESC)
      3. The same index would be used for queries like SELECT * FROM vulnerability_state_transitions WHERE vulnerability_in (1,2,3,...,n);

      That way we could drop index: true from the migration creating the table and would have one index left

  • Michał Zając removed review request for @Quintasan

    removed review request for @Quintasan

  • Adam Hegyi approved this merge request

    approved this merge request

  • :wave: @ahegyi, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.

    For more info, please refer to the following links:

  • mentioned in issue #363049 (closed)

  • additive schema change; no impact to data warehouse

  • Marcos Rocha changed the description

    changed the description

  • Marcos Rocha added 144 commits

    added 144 commits

    • f237cef3...2a8dee56 - 139 commits from branch master
    • 78cebca4 - Add VulnerabilityStateTransition model
    • 21d3bc1b - Move VulnerabilityStateTransition model to Vulnerabilities module
    • a6763085 - Add VulnerabilityStateTransition model
    • 76278c69 - Add missing database documentation files
    • a691d682 - Rename State Transition model

    Compare with previous version

  • Marcos Rocha requested review from @Quintasan

    requested review from @Quintasan

  • Marcos Rocha added 714 commits

    added 714 commits

    • a691d682...c9b29f3c - 709 commits from branch master
    • e7b346da - Add VulnerabilityStateTransition model
    • b03199c7 - Move VulnerabilityStateTransition model to Vulnerabilities module
    • 2f43c632 - Add VulnerabilityStateTransition model
    • 5cde4b98 - Add missing database documentation files
    • 56d25e59 - Rename State Transition model

    Compare with previous version

  • Michał Zając approved this merge request

    approved this merge request

  • Michał Zając removed review request for @Quintasan

    removed review request for @Quintasan

  • Michał Zając requested review from @alexpooley

    requested review from @alexpooley

  • Alex Pooley resolved all threads

    resolved all threads

  • Alex Pooley enabled an automatic merge when the pipeline for 0f747e98 succeeds

    enabled an automatic merge when the pipeline for 0f747e98 succeeds

  • merged

  • Alex Pooley mentioned in commit 4b769c4a

    mentioned in commit 4b769c4a

  • added workflowstaging label and removed workflowcanary label

  • Marcos Rocha mentioned in merge request !88875 (merged)

    mentioned in merge request !88875 (merged)

  • mentioned in issue #325700 (closed)

  • mentioned in issue #361650 (closed)

  • mentioned in issue #433505 (closed)

  • Please register or sign in to reply
    Loading