Redis database number is ignored with unix socket

Summary

Redis database number 'redis_database' is ignored when you use socket instead of TCP, alway 0. Fix : Uncomment redis_host and redis_post + comment redis_socket, and it's ok But unix socket are faster than TCP.

Steps to reproduce

Use this config with a redis server (redis 6+) on the system :

### GitLab Redis settings
###! Connect to your own Redis instance
###! Docs: https://docs.gitlab.com/omnibus/settings/redis.html
# Disable the bundled Redis
redis['enable'] = false
#### Redis TCP connection
#gitlab_rails['redis_host'] = "127.0.0.1"
#gitlab_rails['redis_port'] = 6379
gitlab_rails['redis_ssl'] = false

gitlab_rails['redis_socket'] = '/run/redis/redis.sock' # defaults to /var/opt/gitlab/redis/redis.socket
gitlab_rails['redis_database'] = '12'

What is the current bug behavior?

Database 0° (default) is selected instead of the value of "gitlab_rails['redis_database']" in gitlab.rb config

What is the expected correct behavior?

Select the correct database number with socket connexion

Gitlab version

14.10

Hardware Config

Ubuntu server 21.10 on Ryzen 5900X with 64Go ECC ram, nvme disks

Possible fixes

Don't use socket, but not really a fix

Edited by Pierre21