Database load balancing code: WAL control functions cannot be executed during recovery
On GPRD, we're running with load balancing configuration on, but since all the databases are read-only, we see these errors in the PostgreSQL logs:
2018-07-19_23:03:29.28689 2018-07-19 23:03:29 GMT [25471]: [373-1] ERROR: recovery is in progress
2018-07-19_23:03:29.28696 2018-07-19 23:03:29 GMT [25471]: [374-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.28696 2018-07-19 23:03:29 GMT [25471]: [375-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.29170 2018-07-19 23:03:29 GMT [25471]: [376-1] ERROR: recovery is in progress
2018-07-19_23:03:29.29174 2018-07-19 23:03:29 GMT [25471]: [377-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.29174 2018-07-19 23:03:29 GMT [25471]: [378-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.29687 2018-07-19 23:03:29 GMT [25471]: [379-1] ERROR: recovery is in progress
2018-07-19_23:03:29.29692 2018-07-19 23:03:29 GMT [25471]: [380-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.29692 2018-07-19 23:03:29 GMT [25471]: [381-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.35285 2018-07-19 23:03:29 GMT [25471]: [382-1] ERROR: recovery is in progress
2018-07-19_23:03:29.35290 2018-07-19 23:03:29 GMT [25471]: [383-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.35291 2018-07-19 23:03:29 GMT [25471]: [384-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.36650 2018-07-19 23:03:29 GMT [25471]: [385-1] ERROR: recovery is in progress
2018-07-19_23:03:29.36655 2018-07-19 23:03:29 GMT [25471]: [386-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.36656 2018-07-19 23:03:29 GMT [25471]: [387-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.37043 2018-07-19 23:03:29 GMT [25471]: [388-1] ERROR: recovery is in progress
2018-07-19_23:03:29.37047 2018-07-19 23:03:29 GMT [25471]: [389-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.37048 2018-07-19 23:03:29 GMT [25471]: [390-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.69766 2018-07-19 23:03:29 GMT [10608]: [364-1] ERROR: recovery is in progress
2018-07-19_23:03:29.69771 2018-07-19 23:03:29 GMT [10608]: [365-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.69772 2018-07-19 23:03:29 GMT [10608]: [366-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
2018-07-19_23:03:29.71000 2018-07-19 23:03:29 GMT [10608]: [367-1] ERROR: recovery is in progress
2018-07-19_23:03:29.71005 2018-07-19 23:03:29 GMT [10608]: [368-1] HINT: WAL control functions cannot be executed during recovery.
2018-07-19_23:03:29.71005 2018-07-19 23:03:29 GMT [10608]: [369-1] STATEMENT: SELECT pg_current_xlog_insert_location()::text AS location
I think this SELECT call comes from LoadBalancing#primary_write_location
in ee/lib/gitlab/database/load_balancing/load_balancer.rb
.
Since there is no primary, should we just skip this check for the insert location?
/cc: @yorickpeterse