Skip to content
代码片段 群组 项目
提交 1db7c581 编辑于 作者: Siddharth Dungarwal's avatar Siddharth Dungarwal 提交者: Madelein van Niekerk
浏览文件

Send archived flag to indexer

上级 c0e6e162
No related branches found
No related tags found
无相关合并请求
4.3.7
4.3.8
......@@ -28,8 +28,8 @@ def maintain_elasticsearch_update(updated_attributes: previous_changes.keys)
# So we have to check the previous_changes on project_feature
updated_attributes.concat(project_feature.previous_changes.keys.map(&:to_sym))
if (updated_attributes & %i[visibility_level repository_access_level wiki_access_level]).any?
maintain_elasticsearch_permissions
if (updated_attributes & %i[visibility_level repository_access_level wiki_access_level archived]).any?
maintain_elasticsearch_values
end
super
......@@ -46,7 +46,7 @@ def invalidate_elasticsearch_indexes_cache!
private
def maintain_elasticsearch_permissions
def maintain_elasticsearch_values
::Elastic::ProcessInitialBookkeepingService.backfill_projects!(self)
end
end
......
......@@ -189,6 +189,11 @@ def build_command(base_sha, to_sha)
"--traversal-ids=#{group.elastic_namespace_ancestry}"
end
if ::Elastic::DataMigrationService.migration_has_finished?(:add_archived_to_commits) &&
::Elastic::DataMigrationService.migration_has_finished?(:add_archived_to_main_index) && !index_wiki?
command << "--archived=#{project.archived}"
end
command << repository_path
end
......
......@@ -182,6 +182,47 @@
"--hashed-root-namespace-id=#{project.namespace.hashed_root_namespace_id}",
"--schema-version-commits=true",
"--traversal-ids=#{project.namespace_ancestry}",
"--archived=#{project.archived}",
"#{project.repository.disk_path}.git"
],
nil,
hash_including(
'GITALY_CONNECTION_INFO' => gitaly_connection_data.to_json,
'ELASTIC_CONNECTION_INFO' => elasticsearch_config.to_json,
'RAILS_ENV' => Rails.env,
'CORRELATION_ID' => Labkit::Correlation::CorrelationId.current_id
)
).and_return(popen_success)
indexer.run
end
end
context 'when add_archived_to_commits migration is not complete' do
before do
set_elasticsearch_migration_to(:add_archived_to_commits, including: false)
end
it 'runs the indexer without --archived flag' do
gitaly_connection_data = {
storage: project.repository_storage,
limit_file_size: Gitlab::CurrentSettings.elasticsearch_indexed_file_size_limit_kb.kilobytes
}.merge(Gitlab::GitalyClient.connection_data(project.repository_storage))
expect_popen.with(
[
TestEnv.indexer_bin_path,
"--timeout=#{described_class.timeout}s",
"--visibility-level=#{project.visibility_level}",
"--project-id=#{project.id}",
'--search-curation',
"--from-sha=#{expected_from_sha}",
"--to-sha=#{to_sha}",
"--full-path=#{project.full_path}",
"--repository-access-level=#{project.repository_access_level}",
"--hashed-root-namespace-id=#{project.namespace.hashed_root_namespace_id}",
"--schema-version-commits=true",
"--traversal-ids=#{project.namespace_ancestry}",
"#{project.repository.disk_path}.git"
],
nil,
......@@ -294,6 +335,7 @@
"--hashed-root-namespace-id=#{project.namespace.hashed_root_namespace_id}",
"--schema-version-commits=true",
"--traversal-ids=#{project.namespace_ancestry}",
"--archived=#{project.archived}",
"#{project.repository.disk_path}.git"
],
nil,
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册