Commit 22972dfd authored by Kerri Miller's avatar Kerri Miller Committed by Sean McGivern

Update diff_max_patch_bytes from 100kb -> 200kb

parent ce9225c0
---
title: Update diff_max_patch_bytes from 100kb -> 200kb
merge_request: 46276
author:
type: changed
# frozen_string_literal: true
class IncreaseDefaultDiffMaxPatchBytes < ActiveRecord::Migration[6.0]
DOWNTIME = false
def change
change_column_default(:application_settings, :diff_max_patch_bytes, from: 102400, to: 204800)
end
end
# frozen_string_literal: true
class MigrateDefaultDiffMaxPatchBytesToMinimum200kb < ActiveRecord::Migration[6.0]
DOWNTIME = false
MAX_SIZE = 200.kilobytes
class ApplicationSetting < ActiveRecord::Base
self.table_name = 'application_settings'
end
def up
table = ApplicationSetting.arel_table
ApplicationSetting.where(table[:diff_max_patch_bytes].lt(MAX_SIZE)).update_all(diff_max_patch_bytes: MAX_SIZE)
end
def down
table = ApplicationSetting.arel_table
ApplicationSetting.where(table[:diff_max_patch_bytes].eq(MAX_SIZE)).update_all(diff_max_patch_bytes: 100.kilobytes)
end
end
402e9a6e92802888ba01ee216850ab5b0fe9997a84415c9ffe8d5d37a9823220
\ No newline at end of file
ec5bab20a1b591b77b48b85dc0b871e88a41891d256201b7d8eb86195ef1c4ad
\ No newline at end of file
......@@ -9171,7 +9171,7 @@ CREATE TABLE application_settings (
custom_project_templates_group_id integer,
usage_stats_set_by_user_id integer,
receive_max_input_size integer,
diff_max_patch_bytes integer DEFAULT 102400 NOT NULL,
diff_max_patch_bytes integer DEFAULT 204800 NOT NULL,
archive_builds_in_seconds integer,
commit_email_hostname character varying,
protected_ci_variables boolean DEFAULT true NOT NULL,
......
......@@ -25,7 +25,7 @@ module Gitlab
#
# If this value ever changes, make sure to create a migration to update
# current records, and default of `ApplicationSettings#diff_max_patch_bytes`.
DEFAULT_MAX_PATCH_BYTES = 100.kilobytes
DEFAULT_MAX_PATCH_BYTES = 200.kilobytes
# This is a limitation applied on the source (Gitaly), therefore we don't allow
# persisting limits over that.
......
......@@ -8,6 +8,8 @@ RSpec.describe 'Expand and collapse diffs', :js do
before do
stub_feature_flags(increased_diff_limits: false)
allow(Gitlab::CurrentSettings).to receive(:diff_max_patch_bytes).and_return(100.kilobytes)
sign_in(create(:admin))
# Ensure that undiffable.md is in .gitattributes
......
......@@ -8,6 +8,8 @@ RSpec.describe 'User expands diff', :js do
before do
stub_feature_flags(increased_diff_limits: false)
allow(Gitlab::CurrentSettings).to receive(:diff_max_patch_bytes).and_return(100.kilobytes)
visit(diffs_project_merge_request_path(project, merge_request))
wait_for_requests
......
......@@ -32,7 +32,7 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
safe_max_files: 100,
safe_max_lines: 5000,
safe_max_bytes: 512000,
max_patch_bytes: 102400
max_patch_bytes: 204800
)
expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_diff).with(request, kind_of(Hash))
......@@ -57,7 +57,7 @@ RSpec.describe Gitlab::GitalyClient::CommitService do
safe_max_files: 100,
safe_max_lines: 5000,
safe_max_bytes: 512000,
max_patch_bytes: 102400
max_patch_bytes: 204800
)
expect_any_instance_of(Gitaly::DiffService::Stub).to receive(:commit_diff).with(request, kind_of(Hash))
......
......@@ -105,7 +105,7 @@ RSpec.describe API::Settings, 'Settings' do
enforce_terms: true,
terms: 'Hello world!',
performance_bar_allowed_group_path: group.full_path,
diff_max_patch_bytes: 150_000,
diff_max_patch_bytes: 300_000,
default_branch_protection: ::Gitlab::Access::PROTECTION_DEV_CAN_MERGE,
local_markdown_version: 3,
allow_local_requests_from_web_hooks_and_services: true,
......@@ -148,7 +148,7 @@ RSpec.describe API::Settings, 'Settings' do
expect(json_response['enforce_terms']).to be(true)
expect(json_response['terms']).to eq('Hello world!')
expect(json_response['performance_bar_allowed_group_id']).to eq(group.id)
expect(json_response['diff_max_patch_bytes']).to eq(150_000)
expect(json_response['diff_max_patch_bytes']).to eq(300_000)
expect(json_response['default_branch_protection']).to eq(Gitlab::Access::PROTECTION_DEV_CAN_MERGE)
expect(json_response['local_markdown_version']).to eq(3)
expect(json_response['allow_local_requests_from_web_hooks_and_services']).to eq(true)
......
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