diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-08-19 12:08:42 +0300 |
commit | b76ae638462ab0f673e5915986070518dd3f9ad3 (patch) | |
tree | bdab0533383b52873be0ec0eb4d3c66598ff8b91 /lib/gitlab/import_export | |
parent | 434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff) |
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'lib/gitlab/import_export')
-rw-r--r-- | lib/gitlab/import_export/json/legacy_reader.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/json/ndjson_reader.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/import_export/json/streaming_serializer.rb | 15 | ||||
-rw-r--r-- | lib/gitlab/import_export/lfs_restorer.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/project/import_export.yml | 3 | ||||
-rw-r--r-- | lib/gitlab/import_export/project/object_builder.rb | 2 |
6 files changed, 20 insertions, 8 deletions
diff --git a/lib/gitlab/import_export/json/legacy_reader.rb b/lib/gitlab/import_export/json/legacy_reader.rb index 97b34088e3e..dc80c92f507 100644 --- a/lib/gitlab/import_export/json/legacy_reader.rb +++ b/lib/gitlab/import_export/json/legacy_reader.rb @@ -27,7 +27,7 @@ module Gitlab end def read_hash - ActiveSupport::JSON.decode(IO.read(@path)) + Gitlab::Json.parse(IO.read(@path)) rescue StandardError => e Gitlab::ErrorTracking.log_exception(e) raise Gitlab::ImportExport::Error, 'Incorrect JSON format' diff --git a/lib/gitlab/import_export/json/ndjson_reader.rb b/lib/gitlab/import_export/json/ndjson_reader.rb index 4899bd3b0ee..510da61d3ab 100644 --- a/lib/gitlab/import_export/json/ndjson_reader.rb +++ b/lib/gitlab/import_export/json/ndjson_reader.rb @@ -47,8 +47,8 @@ module Gitlab private def json_decode(string) - ActiveSupport::JSON.decode(string) - rescue ActiveSupport::JSON.parse_error => e + Gitlab::Json.parse(string) + rescue JSON::ParserError => e Gitlab::ErrorTracking.log_exception(e) raise Gitlab::ImportExport::Error, 'Incorrect JSON format' end diff --git a/lib/gitlab/import_export/json/streaming_serializer.rb b/lib/gitlab/import_export/json/streaming_serializer.rb index d1e013a151c..9d28e1abeab 100644 --- a/lib/gitlab/import_export/json/streaming_serializer.rb +++ b/lib/gitlab/import_export/json/streaming_serializer.rb @@ -31,10 +31,12 @@ module Gitlab end def execute - serialize_root + read_from_replica_if_available do + serialize_root - includes.each do |relation_definition| - serialize_relation(relation_definition) + includes.each do |relation_definition| + serialize_relation(relation_definition) + end end end @@ -166,6 +168,13 @@ module Gitlab ) ]) end + + def read_from_replica_if_available(&block) + return yield unless ::Feature.enabled?(:load_balancing_for_export_workers, type: :development, default_enabled: :yaml) + return yield unless ::Gitlab::Database::LoadBalancing.enable? + + ::Gitlab::Database::LoadBalancing::Session.current.use_replicas_for_read_queries(&block) + end end end end diff --git a/lib/gitlab/import_export/lfs_restorer.rb b/lib/gitlab/import_export/lfs_restorer.rb index d73ae1410a3..9931b09e9ca 100644 --- a/lib/gitlab/import_export/lfs_restorer.rb +++ b/lib/gitlab/import_export/lfs_restorer.rb @@ -72,7 +72,7 @@ module Gitlab @lfs_json ||= begin json = IO.read(lfs_json_path) - ActiveSupport::JSON.decode(json) + Gitlab::Json.parse(json) rescue StandardError raise Gitlab::ImportExport::Error, 'Incorrect JSON format' end diff --git a/lib/gitlab/import_export/project/import_export.yml b/lib/gitlab/import_export/project/import_export.yml index a84978a2a80..5633194a8f8 100644 --- a/lib/gitlab/import_export/project/import_export.yml +++ b/lib/gitlab/import_export/project/import_export.yml @@ -230,6 +230,7 @@ excluded_attributes: - :blocking_issues_count - :service_desk_reply_to - :upvotes_count + - :work_item_type_id merge_request: - :milestone_id - :sprint_id @@ -293,6 +294,7 @@ excluded_attributes: - :encrypted_token - :encrypted_token_iv - :enabled + - :integrated service_desk_setting: - :outgoing_name priorities: @@ -328,6 +330,7 @@ excluded_attributes: - :release_id project_members: - :source_id + - :invite_email_success metrics: - :merge_request_id - :pipeline_id diff --git a/lib/gitlab/import_export/project/object_builder.rb b/lib/gitlab/import_export/project/object_builder.rb index 0753625b978..b03dceba303 100644 --- a/lib/gitlab/import_export/project/object_builder.rb +++ b/lib/gitlab/import_export/project/object_builder.rb @@ -106,7 +106,7 @@ module Gitlab end def design? - klass == DesignManagement::Design + klass == ::DesignManagement::Design end def diff_commit_user? |