Skip to content

Automatically detect changes in postgres collation

Several self-managed instances have seen index corruption when upgrading their postgresql database to a new operating system, changing the underlying index collation provided by libc. This can happen even when the name of the collation stays the same. These instances see incorrect results from queries involving text-based indexes, and possibly silent corruption of unique index constraints.

As a part of Database index corruption caused by a change in... (&8573), we want to detect this error automatically and prevent the app from writing bad data.

Deliverables

  • Create a rake tasks to detect collation mismatch
    • Add documentation regarding rake task
  • Add simple collation mismatch check and spot duplicate entries check to gitlabsos.rb
  • Show information about collation mismatch. Some options,
    • Note: this will be done after we have some confirmation that collation checker is working as expected based on gitlabsos.rb usage
    • We added a database diagnostics admin page to show the information on collation mismatch
      • And, spot checks curated list of corrupted indexes
    • Either in gitlab-ctl reconfigure
    • Or, in admin panel somewhere when admin log-in
Edited by Bishwa Hang Rai