Skip to content

Prepare ci_build_trace_sections for int8 migration

Andreas Brandl requested to merge ab/int8_ci_build_trace_sections into master

What does this MR do?

This prepares to migrate ci_build_trace_sections.build_id to int8. See #328432 (closed).

The caveat here is that we cannot batch on id but only on build_id. This means we're going to see a varying amount of records per update, which may lead to inconsistent timings along the way.

Migrations: up

== 20210430121522 InitializeConversionOfCiBuildTraceSectionsToBigint: migrating 
-- table_exists?(:ci_build_trace_sections)
   -> 0.0010s
-- column_exists?(:ci_build_trace_sections, :build_id)
   -> 0.0008s
-- column_exists?(:ci_build_trace_sections, :build_id)
   -> 0.0006s
-- columns(:ci_build_trace_sections)
   -> 0.0006s
-- add_column(:ci_build_trace_sections, "build_id_convert_to_bigint", :bigint, {:default=>0, :null=>false})
   -> 0.0012s
== 20210430121522 InitializeConversionOfCiBuildTraceSectionsToBigint: migrated (0.0120s) 

== 20210430121542 BackfillCiBuildTraceSectionsForBigintConversion: migrating ==
-- table_exists?(:ci_build_trace_sections)
   -> 0.0011s
-- column_exists?(:ci_build_trace_sections, :build_id)
   -> 0.0009s
-- column_exists?(:ci_build_trace_sections, :build_id)
   -> 0.0007s
-- column_exists?(:ci_build_trace_sections, "build_id_convert_to_bigint")
   -> 0.0007s
unknown OID 28: failed to recognize type of 'relfrozenxid'. It will be treated as String.
unknown OID 1034: failed to recognize type of 'relacl'. It will be treated as String.
unknown OID 194: failed to recognize type of 'relpartbound'. It will be treated as String.
== 20210430121542 BackfillCiBuildTraceSectionsForBigintConversion: migrated (0.0417s) 

Migrations: down

== 20210430121542 BackfillCiBuildTraceSectionsForBigintConversion: reverting ==
-- execute("DELETE FROM batched_background_migrations WHERE job_class_name = 'CopyColumnUsingBackgroundMigrationJob' AND table_name = 'ci_build_trace_sections' AND column_name = 'build_id' AND job_arguments = '[[\"build_id\"],[\"build_id_convert_to_bigint\"]]'")
   -> 0.0017s
== 20210430121542 BackfillCiBuildTraceSectionsForBigintConversion: reverted (0.0018s) 

== 20210430121522 InitializeConversionOfCiBuildTraceSectionsToBigint: reverting 
-- remove_column(:ci_build_trace_sections, "build_id_convert_to_bigint")
   -> 0.0007s
== 20210430121522 InitializeConversionOfCiBuildTraceSectionsToBigint: reverted (0.0030s) 

Does this MR meet the acceptance criteria?

Conformity

Edited by Andreas Brandl

Merge request reports

Loading