Skip to content
代码片段 群组 项目
未验证 提交 20fbbbda 编辑于 作者: Douglas Barbosa Alexandre's avatar Douglas Barbosa Alexandre 提交者: GitLab
浏览文件

Update replication troubleshooting snippets

With the migration of repository data types to the
Geo Self-Service Framework in GitLab 16.3, some
snippets need to be updated.

Changelog: fixed
EE: true
上级 a88c1295
No related branches found
No related tags found
无相关合并请求
...@@ -159,20 +159,25 @@ To solve this: ...@@ -159,20 +159,25 @@ To solve this:
1. Enter the [Rails console](../../../operations/rails_console.md) and run: 1. Enter the [Rails console](../../../operations/rails_console.md) and run:
```ruby ```ruby
failed_geo_syncs = Geo::ProjectRegistry.failed.pluck(:id) failed_project_registries = Geo::ProjectRepositoryRegistry.failed
failed_geo_syncs.each do |fgs|
puts Geo::ProjectRegistry.failed.find(fgs).project_id if failed_project_registries.any?
puts "Found #{failed_project_registries.count} failed project repository registry entries:"
failed_project_registries.each do |registry|
puts "ID: #{registry.id}, Project ID: #{registry.project_id}, Last Sync Failure: '#{registry.last_sync_failure}'"
end
else
puts "No failed project repository registry entries found."
end end
``` ```
1. Run the following commands to reset each project's 1. Run the following commands to execute a new sync for each project:
Geo-related attributes and execute a new sync:
```ruby ```ruby
failed_geo_syncs.each do |fgs| failed_project_registries.each do |registry|
registry = Geo::ProjectRegistry.failed.find(fgs) registry.replicator.sync_repository
registry.update(resync_repository: true, force_to_redownload_repository: false, repository_retry_count: 0) puts "Sync initiated for registry ID: #{registry.id}, Project ID: #{registry.project_id}"
Geo::RepositorySyncService.new(registry.project).execute
end end
``` ```
...@@ -215,19 +220,19 @@ Commands that change data can cause damage if not run correctly or under the rig ...@@ -215,19 +220,19 @@ Commands that change data can cause damage if not run correctly or under the rig
#### Get the number of verification failed repositories #### Get the number of verification failed repositories
```ruby ```ruby
Geo::ProjectRegistry.verification_failed('repository').count Geo::ProjectRepositoryRegistry.verification_failed.count
``` ```
#### Find the verification failed repositories #### Find the verification failed repositories
```ruby ```ruby
Geo::ProjectRegistry.verification_failed('repository') Geo::ProjectRepositoryRegistry.verification_failed
``` ```
#### Find repositories that failed to sync #### Find repositories that failed to sync
```ruby ```ruby
Geo::ProjectRegistry.sync_failed('repository') Geo::ProjectRepositoryRegistry.failed
``` ```
### Resync project and project wiki repositories ### Resync project and project wiki repositories
...@@ -251,7 +256,7 @@ Geo::ProjectRegistry.update_all(resync_repository: true, resync_wiki: true) ...@@ -251,7 +256,7 @@ Geo::ProjectRegistry.update_all(resync_repository: true, resync_wiki: true)
```ruby ```ruby
project = Project.find_by_full_path('<group/project>') project = Project.find_by_full_path('<group/project>')
Geo::RepositorySyncService.new(project).execute project.replicator.sync_repository
``` ```
#### Sync all failed repositories now #### Sync all failed repositories now
...@@ -269,19 +274,24 @@ The following script: ...@@ -269,19 +274,24 @@ The following script:
and `nohup`. and `nohup`.
```ruby ```ruby
Geo::ProjectRegistry.sync_failed('repository').find_each do |p| Geo::ProjectRepositoryRegistry.failed.find_each do |registry|
begin begin
project = p.project puts "ID: #{registry.id}, Project ID: #{registry.project_id}, Last Sync Failure: '#{registry.last_sync_failure}'"
puts "#{project.full_path} | id: #{p.project_id} | last error: '#{p.last_repository_sync_failure}'" registry.replicator.sync_repository
Geo::RepositorySyncService.new(project).execute puts "Sync initiated for registry ID: #{id}"
rescue => e rescue => e
puts "ID: #{p.project_id} failed: '#{e}'", e.backtrace.join("\n") puts "ID: #{registry.id}, Project ID: #{registry.project_id}, Failed: '#{e}'", e.backtrace.join("\n")
end end
end ; nil end ; nil
``` ```
## Find repository check failures in a Geo secondary site ## Find repository check failures in a Geo secondary site
NOTE:
All repositories data types have been migrated to the Geo Self-Service Framework in GitLab 16.3. There is an [issue to implement this functionality back in the Geo Self-Service Framework](https://gitlab.com/gitlab-org/gitlab/-/issues/364729).
For GitLab 16.2 and earlier:
When [enabled for all projects](../../../repository_checks.md#enable-repository-checks-for-all-projects), [Repository checks](../../../repository_checks.md) are also performed on Geo secondary sites. The metadata is stored in the Geo tracking database. When [enabled for all projects](../../../repository_checks.md#enable-repository-checks-for-all-projects), [Repository checks](../../../repository_checks.md) are also performed on Geo secondary sites. The metadata is stored in the Geo tracking database.
Repository check failures on a Geo secondary site do not necessarily imply a replication problem. Here is a general approach to resolve these failures. Repository check failures on a Geo secondary site do not necessarily imply a replication problem. Here is a general approach to resolve these failures.
...@@ -319,6 +329,6 @@ The [`fsck` Rake command](../../../raketasks/check.md#check-project-code-reposit ...@@ -319,6 +329,6 @@ The [`fsck` Rake command](../../../raketasks/check.md#check-project-code-reposit
```ruby ```ruby
Geo::ProjectRegistry.where(last_repository_check_failed: true).each do |pr| Geo::ProjectRegistry.where(last_repository_check_failed: true).each do |pr|
RepositoryCheck::SingleRepositoryWorker.new.perform(pr.project_id) RepositoryCheck::SingleRepositoryWorker.new.perform(pr.project_id)
end end
``` ```
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册