Commit 773a7ec9 authored by dfrazao-gitlab's avatar dfrazao-gitlab

Address the PK Overflow risk for the ci_job_artifacts - Step 3

- Ignore id_convert_to_bigint column
- Ignore job_id_convert_to_bigint column
- Remove trigger_be1804f21693 trigger

Related to https://gitlab.com/gitlab-org/gitlab/-/issues/338068

Changelog: added
parent 83da92d0
......@@ -10,6 +10,9 @@ module Ci
include Artifactable
include FileStoreMounter
include EachBatch
include IgnorableColumns
ignore_columns %i[id_convert_to_bigint job_id_convert_to_bigint], remove_with: '14.4', remove_after: '2021-10-22'
TEST_REPORT_FILE_TYPES = %w[junit].freeze
COVERAGE_REPORT_FILE_TYPES = %w[cobertura].freeze
......
# frozen_string_literal: true
class DropTemporaryTriggerForCiJobArtifacts < ActiveRecord::Migration[6.1]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
TABLE = 'ci_job_artifacts'
TEMPORARY_COLUMNS = %w(id_convert_to_bigint job_id_convert_to_bigint)
MAIN_COLUMNS = %w(id job_id)
TRIGGER = 'trigger_be1804f21693'
# rubocop:disable Migration/WithLockRetriesDisallowedMethod
def up
check_trigger_permissions!(TABLE)
with_lock_retries do
remove_rename_triggers(TABLE, TRIGGER)
end
end
def down
check_trigger_permissions!(TABLE)
with_lock_retries do
install_rename_triggers(TABLE, MAIN_COLUMNS, TEMPORARY_COLUMNS, trigger_name: TRIGGER)
end
end
# rubocop:enable Migration/WithLockRetriesDisallowedMethod
end
874ed71410406d10ade9c834d1374b039effd9e88514d327d04275e11e837ffb
\ No newline at end of file
......@@ -207,16 +207,6 @@ BEGIN
END;
$$;
CREATE FUNCTION trigger_be1804f21693() RETURNS trigger
LANGUAGE plpgsql
AS $$
BEGIN
NEW."id_convert_to_bigint" := NEW."id";
NEW."job_id_convert_to_bigint" := NEW."job_id";
RETURN NEW;
END;
$$;
CREATE FUNCTION trigger_cf2f9e35f002() RETURNS trigger
LANGUAGE plpgsql
AS $$
......@@ -26166,8 +26156,6 @@ CREATE TRIGGER trigger_91dc388a5fe6 BEFORE INSERT OR UPDATE ON dep_ci_build_trac
CREATE TRIGGER trigger_aebe8b822ad3 BEFORE INSERT OR UPDATE ON taggings FOR EACH ROW EXECUTE FUNCTION trigger_aebe8b822ad3();
CREATE TRIGGER trigger_be1804f21693 BEFORE INSERT OR UPDATE ON ci_job_artifacts FOR EACH ROW EXECUTE FUNCTION trigger_be1804f21693();
CREATE TRIGGER trigger_cf2f9e35f002 BEFORE INSERT OR UPDATE ON ci_build_trace_chunks FOR EACH ROW EXECUTE FUNCTION trigger_cf2f9e35f002();
CREATE TRIGGER trigger_f1ca8ec18d78 BEFORE INSERT OR UPDATE ON geo_job_artifact_deleted_events FOR EACH ROW EXECUTE FUNCTION trigger_f1ca8ec18d78();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment