Skip to content
This repository was archived by the owner on Aug 22, 2024. It is now read-only.
This repository was archived by the owner on Aug 22, 2024. It is now read-only.

Troubles with logical replication #15

@dan-aksenov

Description

@dan-aksenov

Describe the bug
We are using PostgreSQL logical replication (with debezium). And there are multiple logical replication processes per cluster.
This is what pg_stat_replication shows:

database=# select pid,usename,application_name,client_addr,state from pg_stat_replication ;
  pid  |       usename       |    application_name    | client_addr |   state
-------+---------------------+------------------------+-------------+-----------
 11090 | replication         | pg_slave_server       | 10.75.3.202 | streaming
 30410 | debezium_replicator | PostgreSQL JDBC Driver | 10.75.3.105 | streaming
 30411 | debezium_replicator | PostgreSQL JDBC Driver | 10.75.3.105 | streaming

pgscv does not work in such setup.
Errors looks like this:

curl -s localhost:9890/metrics
An error has occurred while serving metrics:

6 error(s) occurred:
* collected metric "postgres_replication_lag_bytes" { label:<name:"application_name" value:"PostgreSQL JDBC Driver" > label:<name:"client_addr" value:"10.75.3.105/32" > label:<name:"lag" value:"pending" > label:<name:"service_id" value:"postgres:5432" > label:<name:"state" value:"streaming" > label:<name:"user" value:"debezium_replicator" > gauge:<value:0 > } was collected before with the same name and label values
* collected metric "postgres_replication_lag_bytes" { label:<name:"application_name" value:"PostgreSQL JDBC Driver" > label:<name:"client_addr" value:"10.75.3.105/32" > label:<name:"lag" value:"write" > label:<name:"service_id" value:"postgres:5432" > label:<name:"state" value:"streaming" > label:<name:"user" value:"debezium_replicator" > gauge:<value:-4.11433728e+08 > } was collected before with the same name and label values
* collected metric "postgres_replication_lag_seconds" { label:<name:"application_name" value:"PostgreSQL JDBC Driver" > label:<name:"client_addr" value:"10.75.3.105/32" > label:<name:"lag" value:"write" > label:<name:"service_id" value:"postgres:5432" > label:<name:"state" value:"streaming" > label:<name:"user" value:"debezium_replicator" > gauge:<value:0 > } was collected before with the same name and label values
* collected metric "postgres_replication_lag_seconds" { label:<name:"application_name" value:"PostgreSQL JDBC Driver" > label:<name:"client_addr" value:"10.75.3.105/32" > label:<name:"lag" value:"flush" > label:<name:"service_id" value:"postgres:5432" > label:<name:"state" value:"streaming" > label:<name:"user" value:"debezium_replicator" > gauge:<value:0 > } was collected before with the same name and label values
* collected metric "postgres_replication_lag_seconds" { label:<name:"application_name" value:"PostgreSQL JDBC Driver" > label:<name:"client_addr" value:"10.75.3.105/32" > label:<name:"lag" value:"replay" > label:<name:"service_id" value:"postgres:5432" > label:<name:"state" value:"streaming" > label:<name:"user" value:"debezium_replicator" > gauge:<value:0 > } was collected before with the same name and label values
* collected metric "postgres_replication_lag_all_seconds" { label:<name:"application_name" value:"PostgreSQL JDBC Driver" > label:<name:"client_addr" value:"10.75.3.105/32" > label:<name:"service_id" value:"postgres:5432" > label:<name:"state" value:"streaming" > label:<name:"user" value:"debezium_replicator" > gauge:<value:0 > } was collected before with the same name and label values

And its seems to be truly that data was collected before with the same name and label values

Steps to reproduce
Use postgresql 11 with multiple logical replication walsenders.

Expected behavior
There should be no errors and exporter mast work correctly.

pgSCV startup options

services:
  "postgres:5432":
    service_type: "postgres"
    conninfo: "postgres://postgres@127.0.0.1:5432/postgres"
defaults:
    postgres_username: "pgscv"
    postgres_password: "XXX"

Errors and Logs
All are in Describe the bug section

Environment (please complete the following information):

  • Used OS (or Containers): [output of cat /etc/os-release]
NAME="Ubuntu"
VERSION="18.04.5 LTS (Bionic Beaver)"
  • pgSCV Version [output of pgscv --version]
    pgscv 0.7.5 d52f09925a44a67493bd8c598a42c7455e182d5e-release
  • PostgreSQL Version [output of psql -c 'select version()']
PostgreSQL 11.8 on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, 64-bit
patroni 2.0.2
  • Do PostgreSQL and pgSCV are running on the same host?
    Yes

Additional context
None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions