Skip to content
Snippets Groups Projects
Commit e85cd164 authored by Laura Montemayor's avatar Laura Montemayor :zero:
Browse files

Merge branch '416455-cleanup' into 'master'

Use partitioned table for CommitStatus

See merge request !134489



Merged-by: Laura Montemayor's avatarLaura Montemayor <lmontemayor@gitlab.com>
Approved-by: Laura Montemayor's avatarLaura Montemayor <lmontemayor@gitlab.com>
Approved-by: default avatarTianwen Chen <tchen@gitlab.com>
Co-authored-by: default avatarMarius Bobin <mbobin@gitlab.com>
parents b8bc261b 063826e0
No related branches found
No related tags found
1 merge request!134489Use partitioned table for CommitStatus
Pipeline #1043701584 passed
......@@ -9,19 +9,11 @@ class CommitStatus < Ci::ApplicationRecord
include BulkInsertableAssociations
include TaggableQueries
def self.switch_table_names
if Gitlab::Utils.to_boolean(ENV['USE_CI_BUILDS_ROUTING_TABLE'])
:p_ci_builds
else
:ci_builds
end
end
self.table_name = self.switch_table_names
self.table_name = :p_ci_builds
self.sequence_name = :ci_builds_id_seq
self.primary_key = :id
partitionable scope: :pipeline
partitionable scope: :pipeline, partitioned: true
belongs_to :user
belongs_to :project
......
......@@ -44,24 +44,6 @@ def create_status(**opts)
it { is_expected.not_to be_retried }
it { expect(described_class.primary_key).to eq('id') }
describe '.switch_table_names' do
before do
stub_env('USE_CI_BUILDS_ROUTING_TABLE', flag_value)
end
context 'with the env flag disabled' do
let(:flag_value) { 'false' }
it { expect(described_class.switch_table_names).to eq(:ci_builds) }
end
context 'with the env flag enabled' do
let(:flag_value) { 'true' }
it { expect(described_class.switch_table_names).to eq(:p_ci_builds) }
end
end
describe '#author' do
subject { commit_status.author }
......
......@@ -24,7 +24,6 @@
ENV["RAILS_ENV"] = 'test'
ENV["IN_MEMORY_APPLICATION_SETTINGS"] = 'true'
ENV["RSPEC_ALLOW_INVALID_URLS"] = 'true'
ENV['USE_CI_BUILDS_ROUTING_TABLE'] = 'true'
require_relative '../config/environment'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment