Commit 10bfa997 authored by Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre

Merge branch 'mk/update-sync-capacity' into 'master'

Geo: Update usages of files_max_capacity

See merge request gitlab-org/gitlab!50190
parents b81f9157 7fdd6403
......@@ -20,7 +20,9 @@ module Geo
end
def max_capacity
current_node.files_max_capacity
# Transition-period-solution.
# Explained in https://gitlab.com/gitlab-org/gitlab/-/issues/213872#note_336828581
[current_node.files_max_capacity / 2, 1].max
end
def schedule_job(object_type, object_db_id)
......
......@@ -19,7 +19,7 @@ module Geo
def max_capacity
# Transition-period-solution.
# Explained in https://gitlab.com/gitlab-org/gitlab/-/issues/213872#note_336828581
[current_node.files_max_capacity / 4, 1].max
[current_node.files_max_capacity / 2, 1].max
end
def schedule_job(replicable_name, model_record_id)
......
---
title: 'Geo: Update usages of files_max_capacity'
merge_request: 50190
author:
type: changed
......@@ -51,7 +51,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
create(:geo_lfs_object_registry, :failed, lfs_object: lfs_object_2)
stub_const('Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE', 5)
secondary.update!(files_max_capacity: 2)
secondary.update!(files_max_capacity: 4)
allow(Gitlab::SidekiqStatus).to receive(:job_status).with([]).and_return([]).twice
allow(Gitlab::SidekiqStatus).to receive(:job_status).with(%w[123 456]).and_return([true, true], [true, true], [false, false])
......@@ -70,7 +70,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
create(:geo_lfs_object_registry, :never_synced, lfs_object: lfs_object_3)
stub_const('Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE', 3)
secondary.update!(files_max_capacity: 3)
secondary.update!(files_max_capacity: 6)
expect(Geo::FileDownloadWorker).to receive(:perform_async).with('lfs', lfs_object_1.id).once do
Thread.new do
......@@ -368,7 +368,7 @@ RSpec.describe Geo::FileDownloadDispatchWorker, :geo, :use_sql_query_cache_for_t
# 2. We send 2, wait for 1 to finish, and then send again.
it 'attempts to load a new batch without pending downloads' do
stub_const('Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE', 5)
secondary.update!(files_max_capacity: 2)
secondary.update!(files_max_capacity: 4)
result_object = double(:result, success: true, bytes_downloaded: 100, primary_missing_file: false)
allow_any_instance_of(::Gitlab::Geo::Replication::BaseTransfer).to receive(:download_from_primary).and_return(result_object)
......
......@@ -44,7 +44,7 @@ RSpec.describe Geo::RegistrySyncWorker, :geo, :use_sql_query_cache_for_tracking_
package_file_2 = create(:geo_package_file_registry)
stub_const('Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE', 5)
secondary.update!(files_max_capacity: 8)
secondary.update!(files_max_capacity: 4)
allow(Gitlab::SidekiqStatus).to receive(:job_status).with([]).and_return([]).twice
allow(Gitlab::SidekiqStatus).to receive(:job_status).with(array_including('123', '456')).and_return([true, true], [true, true], [false, false])
......@@ -69,7 +69,7 @@ RSpec.describe Geo::RegistrySyncWorker, :geo, :use_sql_query_cache_for_tracking_
# We retrieve all the items in a single batch
stub_const('Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE', 2)
# 8 / 4 = 2 We use one quarter of common files_max_capacity in the Geo::RegistrySyncWorker
secondary.update!(files_max_capacity: 8)
secondary.update!(files_max_capacity: 4)
expect(Geo::EventWorker).to receive(:perform_async).with('package_file', :created, { model_record_id: package_file_1.package_file.id }).once do
Thread.new do
......@@ -92,7 +92,7 @@ RSpec.describe Geo::RegistrySyncWorker, :geo, :use_sql_query_cache_for_tracking_
it 'attempts to load a new batch without pending downloads' do
stub_const('Geo::Scheduler::SchedulerWorker::DB_RETRIEVE_BATCH_SIZE', 5)
# 8 / 4 = 2 We use one quarter of common files_max_capacity in the Geo::RegistrySyncWorker
secondary.update!(files_max_capacity: 8)
secondary.update!(files_max_capacity: 4)
result_object = double(
:result,
......
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