Skip to content
Snippets Groups Projects

Add trigram indexes on email columns for self-managed instances

All threads resolved!
  • Please check this box if this contribution uses AI-generated content (including content generated by GitLab Duo features) as outlined in the GitLab DCO & CLA

What does this MR do and why?

This MR adds trigram indexes on email columns for self-managed instances which are needed for partial email search feature, see - !147204 (comment 1895356618)

Migrations

bin/rails db:migrate

Result
main: == [advisory_lock_connection] object_id: 124500, pg_backend_pid: 28926
main: == 20240507161859 AddTrigramIndexOnPublicEmailForUsers: migrating =============
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0405s
main: -- index_exists?(:users, :public_email, {:name=>"index_users_on_public_email_trigram", :using=>:gin, :opclass=>{:public_email=>:gin_trgm_ops}, :algorithm=>:concurrently})
main:    -> 0.0234s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0005s
main: -- add_index(:users, :public_email, {:name=>"index_users_on_public_email_trigram", :using=>:gin, :opclass=>{:public_email=>:gin_trgm_ops}, :algorithm=>:concurrently})
main:    -> 0.0437s
main: -- execute("RESET statement_timeout")
main:    -> 0.0012s
main: == 20240507161859 AddTrigramIndexOnPublicEmailForUsers: migrated (0.1911s) ====

main: == [advisory_lock_connection] object_id: 124500, pg_backend_pid: 28926 main: == [advisory_lock_connection] object_id: 124740, pg_backend_pid: 28928 main: == 20240507162033 AddTrigramIndexOnEmailForUsers: migrating =================== main: -- transaction_open?(nil) main: -> 0.0000s main: -- view_exists?(:postgres_partitions) main: -> 0.0014s main: -- index_exists?(:users, :email, {:name=>"index_users_on_email_trigram", :using=>:gin, :opclass=>{:email=>:gin_trgm_ops}, :algorithm=>:concurrently}) main: -> 0.0399s main: -- execute("SET statement_timeout TO 0") main: -> 0.0007s main: -- add_index(:users, :email, {:name=>"index_users_on_email_trigram", :using=>:gin, :opclass=>{:email=>:gin_trgm_ops}, :algorithm=>:concurrently}) main: -> 0.0097s main: -- execute("RESET statement_timeout") main: -> 0.0007s main: == 20240507162033 AddTrigramIndexOnEmailForUsers: migrated (0.0767s) ==========

main: == [advisory_lock_connection] object_id: 124740, pg_backend_pid: 28928 main: == [advisory_lock_connection] object_id: 124840, pg_backend_pid: 28930 main: == 20240507162310 AddTrigramIndexOnEmailForEmails: migrating ================== main: -- transaction_open?(nil) main: -> 0.0000s main: -- view_exists?(:postgres_partitions) main: -> 0.0012s main: -- index_exists?(:emails, :email, {:name=>"index_emails_on_email_trigram", :using=>:gin, :opclass=>{:email=>:gin_trgm_ops}, :algorithm=>:concurrently}) main: -> 0.0115s main: -- execute("SET statement_timeout TO 0") main: -> 0.0024s main: -- add_index(:emails, :email, {:name=>"index_emails_on_email_trigram", :using=>:gin, :opclass=>{:email=>:gin_trgm_ops}, :algorithm=>:concurrently}) main: -> 0.0071s main: -- execute("RESET statement_timeout") main: -> 0.0006s main: == 20240507162310 AddTrigramIndexOnEmailForEmails: migrated (0.0567s) =========

main: == [advisory_lock_connection] object_id: 124840, pg_backend_pid: 28930

bin/rails db:rollback:main

Result
main: == [advisory_lock_connection] object_id: 124160, pg_backend_pid: 28467
main: == 20240507162310 AddTrigramIndexOnEmailForEmails: reverting ==================
main: -- transaction_open?(nil)
main:    -> 0.0000s
main: -- view_exists?(:postgres_partitions)
main:    -> 0.0345s
main: -- indexes(:emails)
main:    -> 0.0080s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- remove_index(:emails, {:algorithm=>:concurrently, :name=>"index_emails_on_email_trigram"})
main:    -> 0.0050s
main: -- execute("RESET statement_timeout")
main:    -> 0.0004s
main: == 20240507162310 AddTrigramIndexOnEmailForEmails: reverted (0.0730s) =========

main: == 20240507162033 AddTrigramIndexOnEmailForUsers: reverting =================== main: -- transaction_open?(nil) main: -> 0.0000s main: -- view_exists?(:postgres_partitions) main: -> 0.0006s main: -- indexes(:users) main: -> 0.0141s main: -- remove_index(:users, {:algorithm=>:concurrently, :name=>"index_users_on_email_trigram"}) main: -> 0.0019s main: == 20240507162033 AddTrigramIndexOnEmailForUsers: reverted (0.0272s) ==========

main: == 20240507161859 AddTrigramIndexOnPublicEmailForUsers: reverting ============= main: -- transaction_open?(nil) main: -> 0.0000s main: -- view_exists?(:postgres_partitions) main: -> 0.0007s main: -- indexes(:users) main: -> 0.0112s main: -- remove_index(:users, {:algorithm=>:concurrently, :name=>"index_users_on_public_email_trigram"}) main: -> 0.0019s main: == 20240507161859 AddTrigramIndexOnPublicEmailForUsers: reverted (0.0234s) ====

main: == [advisory_lock_connection] object_id: 124160, pg_backend_pid: 28467

Edited by Zakir Dzhamaliddinov

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

    • 38e4cc8d - Review fixes - add indexes for JiHu version

    Compare with previous version

  • Zakir Dzhamaliddinov reset approvals from @tigerwnz by pushing to the branch

    reset approvals from @tigerwnz by pushing to the branch

  • :x: Error: Database testing pipeline failure

    Failed pipeline ID: 3324825

    The database testing pipeline has failed for pipeline ID 3324825. Please reach out in #database or to a database maintainer to help troubleshoot.

    Why aren't details of the failure posted here?

    Because migration testing pipelines use production data, and this merge request is public. Production data may contain sensitive information, so we only expose this data in job artifacts and output from the pipeline itself.

    Why don't I have access to this pipeline?

    Because migration testing pipelines use production data, sensitive information could be leaked in job logs. As a result, the reports are limited to:

    Can I just re-run the pipeline?

    Possibly yes, if the errors were caused by an incident (or services being slow) and re-running could fix it. If you're doing something slow, remember:

    • Migration testing jobs time out after 10 hours. Synchronous work on a big table can reach this limit, and re-running will mean you wait another 10 hours for it.
    • Migration sampling runs 30 minutes per background migration. If you add 20 background migrations, you will hit the timeout. Consider breaking multiple background migrations apart into separate merge requests.

    If you think re-running might fix it, re-trigger the pipeline by running the manual job db:gitlabcom-database-testing.

  • :tools: Generated by gitlab_quality-test_tooling.


    :snail: Slow tests detected in this merge request. These slow tests might be related to this merge request's changes.

    Click to expand
    Job File Name Duration Expected duration
    #6975007706 spec/features/admin/users/users_spec.rb#L175 Admin::Users GET /admin/users when blocking/unblocking a user shows confirmation and allows blocking and unblocking 64.82 s < 50.13 s
    #6975007889 spec/features/admin/users/users_spec.rb#L175 Admin::Users GET /admin/users when blocking/unblocking a user shows confirmation and allows blocking and unblocking 64.96 s < 50.13 s
    #6975007802 spec/features/admin/users/users_spec.rb#L175 Admin::Users GET /admin/users when blocking/unblocking a user shows confirmation and allows blocking and unblocking 67.9 s < 50.13 s
    #6975942591 spec/features/admin/users/users_spec.rb#L175 Admin::Users GET /admin/users when blocking/unblocking a user shows confirmation and allows blocking and unblocking 65.2 s < 50.13 s
    #6975942515 spec/features/admin/users/users_spec.rb#L175 Admin::Users GET /admin/users when blocking/unblocking a user shows confirmation and allows blocking and unblocking 66.59 s < 50.13 s
    #6975942554 spec/features/admin/users/users_spec.rb#L175 Admin::Users GET /admin/users when blocking/unblocking a user shows confirmation and allows blocking and unblocking 67.26 s < 50.13 s
  • A deleted user added rspec:slow test detected label
  • added pipelinetier-1 label and removed pipelinetier-3 label

  • E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for 38e4cc8d

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Plan        | 54     | 0      | 2       | 0     | 56    | ✅     |
    | Create      | 125    | 0      | 10      | 0     | 135   | ✅     |
    | Govern      | 64     | 0      | 1       | 0     | 65    | ✅     |
    | Package     | 19     | 0      | 12      | 0     | 31    | ✅     |
    | Verify      | 31     | 0      | 1       | 0     | 32    | ✅     |
    | Data Stores | 31     | 0      | 0       | 0     | 31    | ✅     |
    | Monitor     | 8      | 0      | 0       | 0     | 8     | ✅     |
    | Release     | 5      | 0      | 0       | 0     | 5     | ✅     |
    | Manage      | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Analytics   | 1      | 0      | 1       | 0     | 2     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 338    | 0      | 28      | 0     | 366   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-package-and-test: :white_check_mark: test report for 38e4cc8d

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Govern      | 129    | 0      | 10      | 0     | 139   | ✅     |
    | Create      | 318    | 0      | 36      | 0     | 354   | ✅     |
    | Data Stores | 22     | 0      | 0       | 0     | 22    | ✅     |
    | Verify      | 10     | 0      | 0       | 0     | 10    | ✅     |
    | Plan        | 44     | 0      | 4       | 0     | 48    | ✅     |
    | Package     | 6      | 0      | 8       | 0     | 14    | ✅     |
    | Release     | 2      | 0      | 0       | 0     | 2     | ✅     |
    | Monitor     | 8      | 0      | 0       | 0     | 8     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 539    | 0      | 58      | 0     | 597   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • Tiger Watson approved this merge request

    approved this merge request

  • added pipelinetier-3 label and removed pipelinetier-1 label

  • Krasimir Angelov approved this merge request

    approved this merge request

  • added databaseapproved label and removed databasereviewed label

  • Krasimir Angelov resolved all threads

    resolved all threads

  • Krasimir Angelov enabled an automatic merge when all merge checks for 38e4cc8d pass

    enabled an automatic merge when all merge checks for 38e4cc8d pass

  • @zzaakiirr, how was your code review experience with this merge request? Please tell us how we can continue to iterate and improve:

    1. React with a :thumbsup: or a :thumbsdown: on this comment to describe your experience.
    2. Create a new comment starting with @gitlab-bot feedback below, and leave any additional feedback you have for us in the comment.

    Subscribe to the GitLab Community Newsletter for contributor-focused content and opportunities to level up.

    Thanks for your help! :heart:

    This message was generated automatically. You're welcome to improve it.

  • Hello @zzaakiirr :wave:

    The database team is looking for ways to improve the database review process and we would love your help!

    If you'd be open to someone on the database team reaching out to you for a chat, or if you'd like to leave some feedback asynchronously, just post a reply to this comment mentioning:

    @gitlab-org/database-team

    And someone will be by shortly!

    Thanks for your help! :heart:

    This message was generated automatically. You're welcome to improve it.

  • mentioned in commit ebefa8d1

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading