Fix unique_instance_id uniqueness by using system machine_id with fallback
What does this MR do and why?
Fixes the unique_instance_id
uniqueness issue by implementing system-level identifier generation with fallback logic.
Problem
The current unique_instance_id
implementation is not truly unique across GitLab instances. Analysis shows ~1.25K unique_instance_id
values associated with multiple dim_installation_id
records, indicating the same identifier is being generated by different instances.
Root Cause: Instances sharing the same db_key_base_truncated
configuration (common in cloud deployments using DB snapshots or containerized environments) generate identical unique_instance_id
values.
Solution
This MR implements a new system-level identifier generation approach:
-
Primary: Use
/etc/machine-id
when available (Linux with systemd) -
Secondary: Use
/proc/sys/kernel/random/boot_id
when available. -
Fallback: Use existing
unique_instance_id
logic for non-Linux systems
The new logic ensures better uniqueness by leveraging system-level identifiers that are unique per machine/container, rather than relying solely on database configuration.
References
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Related to #552160