Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add pool name and username to address object #128

Merged
merged 3 commits into from
Aug 17, 2022

Conversation

drdrsh
Copy link
Collaborator

@drdrsh drdrsh commented Aug 17, 2022

Pool name and Username are used as identifiers for individual pools in Pgcat. This data is very difficult to extract from individual Address objects. We need to extract that information to make logs and (in the future, metrics) more useful. Currently banning log messages looks like

Banning Address { id: 7, host: "host_name", port: "5432", shard: 0, database: "db_name", role: Primary, replica_number: 0 }

It would be great if we get information about the pool name and username for the pool this address came from.

@@ -84,11 +89,11 @@ impl Address {
/// Address name (aka database) used in `SHOW STATS`, `SHOW DATABASES`, and `SHOW POOLS`.
pub fn name(&self) -> String {
match self.role {
Role::Primary => format!("{}_shard_{}_primary", self.database, self.shard),
Role::Primary => format!("{}_shard_{}_primary", self.poolname, self.shard),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

self.database will now point to the actual database name on Postgres and not the pool name, so we have to change the names used here

@@ -114,12 +114,14 @@ impl ConnectionPool {

let address = Address {
id: address_id,
database: pool_name.clone(),
database: shard.database.clone(),
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was an oversight in the initial multi-db PR. database should point to the actual database name and not the pool name

@levkk levkk merged commit 790898c into postgresml:main Aug 17, 2022
jmeagher added a commit to jmeagher/pgcat that referenced this pull request Feb 17, 2023
…re-config-generator

Catalog store config generator
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants