Skip to content

DB load balancing: Use string instead of IPAddr

Thong Kuah requested to merge use_string_host_for_db_load_balancing into master

What does this MR do?

Use string instead of IPAddr

There's a small inconsistency with the logging, arising from https://gitlab.com/gitlab-org/gitlab-ee/issues/13858

  • Staging: "db_host":{"family":2,"addr":182459753,"mask_addr":4294967295},"db_port":6432
  • Production: "db_host":"10.220.16.105","db_port":null

It appears that this is because we now dealing with IPAddr objects vs previously we had strings. The fix is to add to_s in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15691/diffs#397f1a3280081aad2c8927a8adb81428e5ab6d3b_171_177 (like we had for https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/15691/diffs#397f1a3280081aad2c8927a8adb81428e5ab6d3b_170_170)

https://gitlab.com/gitlab-org/gitlab-ce/issues/66074#note_203827468 shows that we support IP address strings fine.


Thanks @tigerwnz for investigating this!

IPAddr.new("1.1.1.1").to_json
=> "{\"family\":2,\"addr\":16843009,\"mask_addr\":4294967295}"

Does this MR meet the acceptance criteria?

Conformity

Performance and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Merge request reports