fix: show rule identity instead of backend identity in SHOW POOLS#1292
Open
douyux wants to merge 1 commit intoyandex:masterfrom
Open
fix: show rule identity instead of backend identity in SHOW POOLS#1292douyux wants to merge 1 commit intoyandex:masterfrom
douyux wants to merge 1 commit intoyandex:masterfrom
Conversation
SHOW POOLS and SHOW POOLS_EXTENDED were reporting route->id.database and route->id.user, which reflect backend credentials (potentially overridden by storage_db/storage_user). When multiple routing rules map to the same backend credentials, this produced duplicate rows with identical (database, user) pairs, breaking observability and causing Prometheus metric label collisions. Fix by using route->rule->db_name and route->rule->user_name, which always reflect the frontend routing rule identity. Fixes yandex#1279
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.
Problem
SHOW POOLSandSHOW POOLS_EXTENDEDreportroute->id.databaseandroute->id.userin thedatabaseandusercolumns. These fieldsrepresent the backend connection identity — they are overridden by
storage_db/storage_userdirectives during routing.When multiple frontend routing rules map to the same backend credentials,
all affected routes produce rows with identical
(database, user)values,making them indistinguishable. This causes two concrete problems:
specific routing rules.
series and break scraping.
Fix
Replace
route->id.database/route->id.userwithroute->rule->db_name/route->rule->user_nameinod_console_show_pools_add_cb()(sources/console.c).These fields always hold the frontend rule identity (the name as
written in the config file), which is unique per route. For
defaultrules they resolve to the literal strings
"default_db"/"default_user".The length fields are updated accordingly:
rule->db_name_lenandrule->user_name_lenare assigned viastrlen()and do not include thenull terminator, so the previous
- 1adjustment is dropped.Behaviour change
storage_db/storage_userstorage_user = backend_userconfiguredbackend_userOperators who relied on
SHOW POOLSto inspect the actual backendcredentials should use
SHOW SERVERSinstead, which continues to reflectthe real backend connection identity.
Fixes #1279.