CI Mirrored Tables
The tables gitlab_main tables: namespaces and projects that reside on the main database, are partially
copied to their corresponding gitlab_ci database tables ci_namespace_mirrors and ci_project_mirrors respectively. This even happens on single database mode.
Troubleshooting
Section titled “Troubleshooting”When receiving alerts about inconsistent records errors, we need to investigate the type of the inconsistency. This can be checked from Kibana logs. For example, if it is inconsistent updating of the records, or we have a delayed deletion of the records.
Inconsistent Namespace Records
Section titled “Inconsistent Namespace Records”Investigating the types of inconsistency
Section titled “Investigating the types of inconsistency”- Check the logs attribute
json.extra.database_ci_namespace_mirrors_consistency_check_worker.results.mismatches_details
-
If the
mismatches_detailsfor the mismatchednamespacescontains bothsource_tableandtarget_table, then this means that both source and target records exist in the source table and target table, but syncing is not working as expected. Check the section Wrong update of the mirrored records in this page. -
If the
mismatches_detailsfor the mismatchednamespacescontains only thesource_table, but not thetarget_table, then this means that we are also not updating the records. Also check Wrong update of the mirrored records in this page. -
If the
mismatches_detailsfor the mismatchednamespacescontains only thetarget_table, but not thesource_table, then this means we are not deleting the target objects upon deletion of the source tables. Check Delayed deletion of the mirrored records in this page.
Inconsistent Project Records
Section titled “Inconsistent Project Records”Investigating the types of inconsistency
Section titled “Investigating the types of inconsistency”- Check the logs attribute
json.extra.database_ci_project_mirrors_consistency_check_worker.results.mismatches_details
-
If the
mismatches_detailsfor the mismatchedprojectscontains bothsource_tableandtarget_table, then this means that both source and target records exist in the source table and target table, but syncing is not working as expected. Check the section Wrong update of the mirrored records in this page. -
If the
mismatches_detailsfor the mismatchedprojectscontains only thesource_table, but not theupdate_table, then this means that we are also not updating the records. Check the section Wrong update of the mirrored records in this page. -
If the
mismatches_detailsfor the mismatchedprojectscontains only thetarget_table, but not thesource_table, then this means we are not deleting the target objects upon deletion of the source tables. Check Delayed deletion of the mirrored records in this page.
Delayed deletion of mirrored records
Section titled “Delayed deletion of mirrored records”-
We use
LooseForeignKeysto delete the mirrored tables. See the Troubleshooting section of this topic. -
Check the logs of the job
LooseForeignKeys::CleanupWorkerin Kibana for any hints regarding troubleshooting the problem.
Wrong update of mirrored records
Section titled “Wrong update of mirrored records”- Check recent merged requests affecting these classes, and possibly revert them if necessary:
app/models/namespaces/traversal/linear.rbapp/models/namespace/traversal_hierarchy.rbapp/models/namespace.rbapp/models/project.rbapp/models/namespaces/sync_event.rbapp/models/projects/sync_event.rb
-
If the problem happens on
namespaces, then check the logs of the jobsNamespaces::ProcessSyncEventsWorker. -
If the problem happens on
projects, then check the logs of the jobsProjects::ProcessSyncEventsWorker.
Reach out to the Tenant Scale in case of any extra help needed.