yandex / odyssey

Scalable PostgreSQL connection pooler
BSD 3-Clause "New" or "Revised" License
3.21k stars 165 forks source link

Duplicate rows returned when execute SHOW DATABASES #610

Open flant-team-zulu opened 6 months ago

flant-team-zulu commented 6 months ago

image

https://github.com/prometheus-community/postgres_exporter/issues/732

x4m commented 6 months ago

That's a bug. Thanks for letting us know! I think I saw it before, but it's not fixed yet. Some locking issue in a console command.

x4m commented 6 months ago

Do you observe it as a stable result or it was one-time issue?

flant-team-zulu commented 6 months ago

This is reproducible PG has one db mydatabase with 3 users - mydatabase, kafka_connect_analytic and kafka_connect Here is config example:

` daemonize no log_to_stdout yes pid_file "/pid/odyssey.pid" log_format "%p %l %c %i %s %h %d %m\n" log_debug no log_config yes log_session yes log_query no log_stats yes stats_interval 60 readahead 4096 nodelay yes keepalive 7200 client_max 5000 cache 300 cache_chunk 16384 resolvers 1 workers 1

listen {
    host "*"
    port 6432
    tls "disable"
}
storage "local" {
    type "local"
}
database "console" {
    user "odyssey" {
        authentication "clear_text"
        password "zzzzzzzzzzzzzzz"
        pool "session"
        storage "local"
    }
}
database default {
    user default {
        # none, block, clear_text, md5, scram-sha-256
        authentication "block"
        storage "local"
        pool "session"
    }
}

storage "mydatabase" {
  type "remote"
  host "10.3.11.11"
  port 5432
}
database "mydatabase" {
  user "mydatabase" {
    authentication "md5"
    password "md5zzzzzzzzzzzzzzzzzz"
    pool "session"
    pool_size 500
    pool_discard no
    pool_ttl 60
    storage "mydatabase"
    client_fwd_error yes
  }
  user "kafka_connect_analytic" {
    authentication "md5"
    password "md5zzzzzzzzzzzzzzzz"
    pool "session"
    pool_size 500
    pool_discard yes
    pool_ttl 60
    storage "mydatabase"
    client_fwd_error yes
  }
  user "kafka_connect" {
    authentication "md5"
    password "md5zzzzzzzzzzzzzzzzzzz"
    pool "session"
    pool_size 500
    pool_discard yes
    pool_ttl 60
    storage "mydatabase"
    client_fwd_error yes
  }
}

`

result

console=> show databases;
   name    |    host    | port | database   |       force_user       | pool_size | reserve_pool | pool_mode | max_connections | current_connections | paused | disabled 
-----------+------------+------+------------+------------------------+-----------+--------------+-----------+-----------------+---------------------+--------+----------
 console   |            |    0 | console    | odyssey                |         0 |            0 | session   |               0 |                   2 |      0 |        0
mydatabase | 10.3.11.11 | 5432 | mydatabase | mydatabase             |       500 |            0 | session   |               0 |                  95 |      0 |        0
mydatabase | 10.3.11.11 | 5432 | mydatabase | kafka_connect_analytic |       500 |            0 | session   |               0 |                   0 |      0 |        0
mydatabase | 10.3.11.11 | 5432 | mydatabase | kafka_connect          |       500 |            0 | session   |               0 |                   0 |      0 |        0
mydatabase | 10.3.11.11 | 5432 | mydatabase | kafka_connect          |       500 |            0 | session   |               0 |                   1 |      0 |        0
(5 rows)
Mrazish commented 5 months ago

any ETA/workaround for this issue? It breaks up monitoring :(

yuniyakim commented 21 hours ago

We're experiencing the same problem, it also causes trouble with our monitoring :(