Repository navigation
fix: handle load_balance_hosts null value - #6810
Merged
gbartolini merged 1 commit intoFeb 12, 2025
Merged
Conversation
Contributor
|
❗ By default, the pull request is configured to backport to all release branches.
|
usernamedt
force-pushed
the
fix-metric-collection-cnpg
branch
from
February 10, 2025 16:43
ee710e1 to
b0fb19e
Compare
armru
self-requested a review
February 10, 2025 18:57
Member
|
Hello @usernamedt, thanks for the contribution, I will take a look ASAP. |
load_balance_hosts null value
leonardoce
approved these changes
Feb 11, 2025
armru
approved these changes
Feb 11, 2025
Contributor
|
/test depth=push |
Contributor
|
@sxd, here's the link to the E2E on CNPG workflow run: https://github.com/cloudnative-pg/cloudnative-pg/actions/runs/13259566046 |
Signed-off-by: Daniil Zakhlystov <[email protected]>
sxd
force-pushed
the
fix-metric-collection-cnpg
branch
from
February 12, 2025 16:21
b0fb19e to
7176c52
Compare
cnpg-bot
pushed a commit
that referenced
this pull request
Feb 17, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer, expect NULL as a result and ensure it is handled properly. This issue was introduced in PR #6630. Relates #6566 Signed-off-by: Daniil Zakhlystov <[email protected]> Co-authored-by: Daniil Zakhlystov <[email protected]> (cherry picked from commit d0e8f5f)
cnpg-bot
pushed a commit
that referenced
this pull request
Feb 17, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer, expect NULL as a result and ensure it is handled properly. This issue was introduced in PR #6630. Relates #6566 Signed-off-by: Daniil Zakhlystov <[email protected]> Co-authored-by: Daniil Zakhlystov <[email protected]> (cherry picked from commit d0e8f5f)
cnpg-bot
pushed a commit
that referenced
this pull request
Feb 17, 2025
When using the `SHOW STATS` command to handle metrics for pgBouncer, expect NULL as a result and ensure it is handled properly. This issue was introduced in PR #6630. Relates #6566 Signed-off-by: Daniil Zakhlystov <[email protected]> Co-authored-by: Daniil Zakhlystov <[email protected]> (cherry picked from commit d0e8f5f)
mnencia
pushed a commit
that referenced
this pull request
Sep 14, 2026
`collectShowPools` picks its scan layout from the number of columns `SHOW POOLS` returns. Every layout PgBouncer reports today is covered, but the next release that adds a column falls into the 13 destination fallback, and the scan then fails on every row. It would not read as missing data either: the error branch falls through to the gauge writes, so each pool metric is published as a genuine zero under empty `database` and `user` labels. Bind each column to its gauge by name instead, from one table that `Describe`, `Reset`, `Collect` and the scan derive from, and skip the row when the scan fails. #11366 does the same for `SHOW STATS`, where that switch already broke on 1.24. `load_balance_hosts` comes along. PgBouncer reports it as text holding `disable` or `round-robin`, and null for a single-host pool, while the scan expected an integer; the generated `[databases]` section never configures more than one host, so nothing surfaces today. Encode it the way `pool_mode` already is, correct its help text, which described a count of hosts, and drop the scan error fixed in #6810 from the docs sample. Signed-off-by: Armando Ruocco <[email protected]>
mnencia
pushed a commit
that referenced
this pull request
Sep 14, 2026
`collectShowPools` picks its scan layout from the number of columns `SHOW POOLS` returns. Every layout PgBouncer reports today is covered, but the next release that adds a column falls into the 13 destination fallback, and the scan then fails on every row. It would not read as missing data either: the error branch falls through to the gauge writes, so each pool metric is published as a genuine zero under empty `database` and `user` labels. Bind each column to its gauge by name instead, from one table that `Describe`, `Reset`, `Collect` and the scan derive from, and skip the row when the scan fails. #11366 does the same for `SHOW STATS`, where that switch already broke on 1.24. `load_balance_hosts` comes along. PgBouncer reports it as text holding `disable` or `round-robin`, and null for a single-host pool, while the scan expected an integer; the generated `[databases]` section never configures more than one host, so nothing surfaces today. Encode it the way `pool_mode` already is, correct its help text, which described a count of hosts, and drop the scan error fixed in #6810 from the docs sample. Signed-off-by: Armando Ruocco <[email protected]>
mnencia
added a commit
that referenced
this pull request
Sep 14, 2026
`collectShowPools` picks its scan layout from the number of columns `SHOW POOLS` returns. Every layout PgBouncer reports today is covered, but the next release that adds a column falls into the 13-destination fallback, and the scan fails on every row. The error branch falls through to the gauge writes anyway, so each pool metric ends up published as zero, under empty `database` and `user` labels. Bind each column to its gauge by name instead. One table now drives `Describe`, `Reset`, `Collect`, and the scan, and a row is skipped when its scan fails. #11366 does the same for `SHOW STATS`, where this already broke on 1.24. This PR doesn't depend on it. `load_balance_hosts` also needed a fix. PgBouncer reports it as text: `disable` or `round-robin`, and null for a single-host pool. The scan expected an integer instead. CNPG's generated `[databases]` section never configures more than one host, so this never showed up in practice. It's now encoded the same way `pool_mode` already is. The help text no longer describes a host count, and the docs sample drops the scan error that #6810 fixed. A column PgBouncer renames instead of adds still disappears silently under the by-name bind. Log it as a warning, here and in the already-merged `SHOW STATS` collector from #11366, so a rename shows up in the logs instead of just vanishing. A new test also checks that one pool's row failing to scan doesn't blank out the pools that scan fine right after it. Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]>
cnpg-bot
pushed a commit
that referenced
this pull request
Sep 14, 2026
`collectShowPools` picks its scan layout from the number of columns `SHOW POOLS` returns. Every layout PgBouncer reports today is covered, but the next release that adds a column falls into the 13-destination fallback, and the scan fails on every row. The error branch falls through to the gauge writes anyway, so each pool metric ends up published as zero, under empty `database` and `user` labels. Bind each column to its gauge by name instead. One table now drives `Describe`, `Reset`, `Collect`, and the scan, and a row is skipped when its scan fails. #11366 does the same for `SHOW STATS`, where this already broke on 1.24. This PR doesn't depend on it. `load_balance_hosts` also needed a fix. PgBouncer reports it as text: `disable` or `round-robin`, and null for a single-host pool. The scan expected an integer instead. CNPG's generated `[databases]` section never configures more than one host, so this never showed up in practice. It's now encoded the same way `pool_mode` already is. The help text no longer describes a host count, and the docs sample drops the scan error that #6810 fixed. A column PgBouncer renames instead of adds still disappears silently under the by-name bind. Log it as a warning, here and in the already-merged `SHOW STATS` collector from #11366, so a rename shows up in the logs instead of just vanishing. A new test also checks that one pool's row failing to scan doesn't blank out the pools that scan fine right after it. Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit d2c5ccd)
cnpg-bot
pushed a commit
that referenced
this pull request
Sep 14, 2026
`collectShowPools` picks its scan layout from the number of columns `SHOW POOLS` returns. Every layout PgBouncer reports today is covered, but the next release that adds a column falls into the 13-destination fallback, and the scan fails on every row. The error branch falls through to the gauge writes anyway, so each pool metric ends up published as zero, under empty `database` and `user` labels. Bind each column to its gauge by name instead. One table now drives `Describe`, `Reset`, `Collect`, and the scan, and a row is skipped when its scan fails. #11366 does the same for `SHOW STATS`, where this already broke on 1.24. This PR doesn't depend on it. `load_balance_hosts` also needed a fix. PgBouncer reports it as text: `disable` or `round-robin`, and null for a single-host pool. The scan expected an integer instead. CNPG's generated `[databases]` section never configures more than one host, so this never showed up in practice. It's now encoded the same way `pool_mode` already is. The help text no longer describes a host count, and the docs sample drops the scan error that #6810 fixed. A column PgBouncer renames instead of adds still disappears silently under the by-name bind. Log it as a warning, here and in the already-merged `SHOW STATS` collector from #11366, so a rename shows up in the logs instead of just vanishing. A new test also checks that one pool's row failing to scan doesn't blank out the pools that scan fine right after it. Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit d2c5ccd)
cnpg-bot
pushed a commit
that referenced
this pull request
Sep 14, 2026
`collectShowPools` picks its scan layout from the number of columns `SHOW POOLS` returns. Every layout PgBouncer reports today is covered, but the next release that adds a column falls into the 13-destination fallback, and the scan fails on every row. The error branch falls through to the gauge writes anyway, so each pool metric ends up published as zero, under empty `database` and `user` labels. Bind each column to its gauge by name instead. One table now drives `Describe`, `Reset`, `Collect`, and the scan, and a row is skipped when its scan fails. #11366 does the same for `SHOW STATS`, where this already broke on 1.24. This PR doesn't depend on it. `load_balance_hosts` also needed a fix. PgBouncer reports it as text: `disable` or `round-robin`, and null for a single-host pool. The scan expected an integer instead. CNPG's generated `[databases]` section never configures more than one host, so this never showed up in practice. It's now encoded the same way `pool_mode` already is. The help text no longer describes a host count, and the docs sample drops the scan error that #6810 fixed. A column PgBouncer renames instead of adds still disappears silently under the by-name bind. Log it as a warning, here and in the already-merged `SHOW STATS` collector from #11366, so a rename shows up in the logs instead of just vanishing. A new test also checks that one pool's row failing to scan doesn't blank out the pools that scan fine right after it. Signed-off-by: Armando Ruocco <[email protected]> Signed-off-by: Marco Nenciarini <[email protected]> Co-authored-by: Marco Nenciarini <[email protected]> (cherry picked from commit d2c5ccd)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi, everyone! After testing the PgBouncer 1.24 and CNPG 1.25 with this fix applied I see the following errors in the pooler logs:
Given the fact that I am using more or less standard setup, I propose to ignore the null values here instead of error.