Skip to content

Adjust the correlation id constraint check in abuse trust scores

What does this MR do and why?

Describe in detail what your merge request does and why.

This MR increases the length limit for the correlation_id_value field in the abuse_trust_scores table from 32 to 255 in order to enable tests to pass as they currently create correlation ids that are longer than 32 characters in size as can be seen in this failing job - https://gitlab.com/gitlab-org/gitlab/-/jobs/4308057994

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Database Migrations

> rake db:migrate VERSION=20230516115259
WARNING: This version of GitLab depends on gitlab-shell 14.20.0, but you're running 14.18.0. Please update gitlab-shell.
main: == [advisory_lock_connection] object_id: 275940, pg_backend_pid: 97703
main: == 20230516115259 IncreaseCorrelationIdSizeLimitInAbuseTrustScores: migrating =
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("            ALTER TABLE abuse_trust_scores\n            DROP CONSTRAINT IF EXISTS check_77ca9551db\n")
main:    -> 0.0007s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER TABLE abuse_trust_scores\nADD CONSTRAINT check_77ca9551db\nCHECK ( char_length(correlation_id_value) <= 255 )\nNOT VALID;\n")
main:    -> 0.0009s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0003s
main: -- execute("ALTER TABLE abuse_trust_scores VALIDATE CONSTRAINT check_77ca9551db;")
main:    -> 0.0005s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20230516115259 IncreaseCorrelationIdSizeLimitInAbuseTrustScores: migrated (0.1116s) 

main: == [advisory_lock_connection] object_id: 275940, pg_backend_pid: 97703
ci: == [advisory_lock_connection] object_id: 276220, pg_backend_pid: 97706
ci: == [advisory_lock_connection] object_id: 276220, pg_backend_pid: 97706

> rake db:migrate:down:main VERSION=20230516115259
WARNING: This version of GitLab depends on gitlab-shell 14.20.0, but you're running 14.18.0. Please update gitlab-shell.
main: == [advisory_lock_connection] object_id: 275680, pg_backend_pid: 97041
main: == 20230516115259 IncreaseCorrelationIdSizeLimitInAbuseTrustScores: reverting =
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("            ALTER TABLE abuse_trust_scores\n            DROP CONSTRAINT IF EXISTS check_77ca9551db\n")
main:    -> 0.0011s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- execute("ALTER TABLE abuse_trust_scores\nADD CONSTRAINT check_77ca9551db\nCHECK ( char_length(correlation_id_value) <= 32 )\nNOT VALID;\n")
main:    -> 0.0022s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0005s
main: -- execute("ALTER TABLE abuse_trust_scores VALIDATE CONSTRAINT check_77ca9551db;")
main:    -> 0.0004s
main: -- execute("RESET statement_timeout")
main:    -> 0.0002s
main: == 20230516115259 IncreaseCorrelationIdSizeLimitInAbuseTrustScores: reverted (0.1618s) 

main: == [advisory_lock_connection] object_id: 275680, pg_backend_pid: 97041

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Juliet Wanjohi

Merge request reports