Skip to content
Snippets Groups Projects

CSV download for Merge Commits

Merged Aishwarya Subramanian requested to merge commit_history_csv into master
All threads resolved!

What does this MR do?

This MR adds the backend changes for group owners and admins to download a CSV copy of Merge Commits for a Group.

The download option will be present in the Compliance dashboard. FE MR: !38513 (merged)

It restricts the download file up to 15MB.

Mentions #213364 (closed)

Screenshots

Example CSV file: 119-merge-commits-1596485203.csv

Database changes

Query using MergeRequestFinder

Query
explain SELECT
    "merge_requests".*
FROM
    "merge_requests"
    INNER JOIN "projects" ON "projects"."id" = "merge_requests"."target_project_id"
    LEFT JOIN project_features ON projects.id = project_features.project_id
WHERE
    "projects"."namespace_id" = 9970
    AND (EXISTS (
            SELECT
                1
            FROM
                "project_authorizations"
            WHERE
                "project_authorizations"."user_id" = 4014344
                AND (project_authorizations.project_id = projects.id))
            OR projects.visibility_level IN (0, 10, 20))
    AND ("project_features"."merge_requests_access_level" > 0
        OR "project_features"."merge_requests_access_level" IS NULL)
    AND ("merge_requests"."state_id" IN (3))
ORDER BY
    "merge_requests"."id" ASC
LIMIT 1000

Plan execution: https://explain.depesz.com/s/GS3T

Execution Time:
Time: 4.693 s
  - planning: 2.370 ms
  - execution: 4.690 s
    - I/O read: 4.319 s
    - I/O write: 0.000 ms

Shared buffers:
  - hits: 6645 (~51.90 MiB) from the buffer pool
  - reads: 71478 (~558.40 MiB) from the OS file cache, including disk I/O
  - dirtied: 1492 (~11.70 MiB)
  - writes: 0

#database-lab: https://gitlab.slack.com/archives/CLJMDRD8C/p1597200797223700

Migration

== 20200810160031 AddIndexMergedStateOnMergeRequests: migrating ===============
-- transaction_open?()
   -> 0.0000s
-- index_exists?(:merge_requests, [:target_project_id, :iid, :state_id], {:where=>"state_id = 3", :name=>"index_merged_state_on_merge_requests", :algorithm=>:concurrently})
   -> 0.0099s
-- add_index(:merge_requests, [:target_project_id, :iid, :state_id], {:where=>"state_id = 3", :name=>"index_merged_state_on_merge_requests", :algorithm=>:concurrently})
   -> 0.0062s
== 20200810160031 AddIndexMergedStateOnMergeRequests: migrated (0.0166s) ======

Rollback

== 20200810160031 AddIndexMergedStateOnMergeRequests: reverting ===============
-- transaction_open?()
   -> 0.0000s
-- indexes(:merge_requests)
   -> 0.0177s
-- remove_index(:merge_requests, {:algorithm=>:concurrently, :name=>"index_merged_state_on_merge_requests"})
   -> 0.0064s
== 20200810160031 AddIndexMergedStateOnMergeRequests: reverted (0.0248s) ======

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Aishwarya Subramanian

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
  • Tan Le
  • Tan Le
  • Tan Le
  • Tan Le
  • Tan Le
  • Tan Le
  • unassigned @tancnle

  • added 373 commits

    Compare with previous version

  • added 1 commit

    • 089f3b92 - Backend changes for merge commit csv export

    Compare with previous version

  • added 1 commit

    • fcc76f35 - Backend changes for merge commit csv export

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    • 89054eee - Backend changes for merge commit csv export

    Compare with previous version

  • assigned to @tancnle and unassigned @asubramanian1

  • added 71 commits

    Compare with previous version

  • Aishwarya Subramanian changed the description

    changed the description

  • @nmilojevic1 - Would you mind reviewing the database changes when you get a chance? :pray:

  • Tan Le
  • Tan Le
  • Tan Le assigned to @asubramanian1 and unassigned @tancnle

    assigned to @asubramanian1 and unassigned @tancnle

  • added 152 commits

    Compare with previous version

  • added 1 commit

    • 0a766731 - Apply 2 suggestion(s) to 2 file(s)

    Compare with previous version

  • added 1 commit

    • ce213aaf - Backend changes for merge commit csv export

    Compare with previous version

  • added 1 commit

    • 9890d178 - Backend changes for merge commit csv export

    Compare with previous version

  • assigned to @tancnle and unassigned @asubramanian1

  • added 1 commit

    • 169cfc91 - Backend changes for merge commit csv export

    Compare with previous version

  • Tan Le
  • Tan Le approved this merge request

    approved this merge request

  • unassigned @tancnle

  • added 1 commit

    • a8b256f0 - Backend changes for merge commit csv export

    Compare with previous version

  • assigned to @dstull and unassigned @asubramanian1 and @nmilojevic1

  • Aishwarya Subramanian resolved all threads

    resolved all threads

  • unassigned @dstull

  • assigned to @mkozono and unassigned @asubramanian1

  • Michael Kozono
  • assigned to @asubramanian1 and unassigned @mkozono

  • added 2 commits

    • 464233ab - Backend changes for merge commit csv export
    • cdaccf53 - Reorganized query pattern

    Compare with previous version

  • added 770 commits

    Compare with previous version

  • Aishwarya Subramanian changed the description

    changed the description

  • Aishwarya Subramanian changed the description

    changed the description

  • added 1 commit

    • 9870d1d1 - Added indexes to optimize query

    Compare with previous version

  • assigned to @mkozono and unassigned @asubramanian1

  • added 1 commit

    Compare with previous version

  • Michael Kozono assigned to @dstull and unassigned @mkozono

    assigned to @dstull and unassigned @mkozono

  • Michael Kozono approved this merge request

    approved this merge request

  • assigned to @asubramanian1 and unassigned @dstull

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Aishwarya Subramanian changed the description

    changed the description

  • assigned to @sabrams and unassigned @dstull

  • Steve Abrams
  • Steve Abrams
  • unassigned @sabrams

  • added 1 commit

    • 5aa94adb - Improvised index for merge_requests

    Compare with previous version

  • added 1 commit

    Compare with previous version

  • Aishwarya Subramanian changed the description

    changed the description

  • assigned to @sabrams and unassigned @asubramanian1

  • Steve Abrams approved this merge request

    approved this merge request

  • added databasereviewed label and removed databasereview pending label

  • Steve Abrams assigned to @tigerwnz and unassigned @sabrams

    assigned to @tigerwnz and unassigned @sabrams

  • Tiger Watson assigned to @asubramanian1 and unassigned @tigerwnz

    assigned to @asubramanian1 and unassigned @tigerwnz

  • added 783 commits

    Compare with previous version

  • added 1 commit

    • 4a526800 - Backend changes for merge commit csv export

    Compare with previous version

  • mentioned in issue #236000

  • assigned to @mkozono and unassigned @asubramanian1

  • Michael Kozono resolved all threads

    resolved all threads

  • Michael Kozono mentioned in commit ff4ceff3

    mentioned in commit ff4ceff3

  • added workflowcanary label and removed workflowstaging label

  • added workflowproduction label and removed workflowcanary label

  • mentioned in issue #36750 (closed)

  • Please register or sign in to reply
    Loading