Skip to content

Conversation

ShivanshGahlot
Copy link
Collaborator

@ShivanshGahlot ShivanshGahlot commented Aug 25, 2025

Describe the changes in this pull request

This PR enhances the call home by adding two new diagnostic fields:

  • PostgreSQL System Identifier for source databases
  • YugabyteDB Cluster UUID for target databases

Callhome data contains db_system_identifier field which contains these values.
These additions provide better identification and tracking capabilities for migration operations.

Describe if there are any user-facing changes

None

How was this pull request tested?

Manually

Does your PR have changes in callhome/yugabyted payloads? If so, is the payload version incremented?

Yes the two new fields that have been added.

"source_db_details":"{\"host\":\"\",\"db_type\":\"postgresql\",\"db_version\":\"17.2 (Ubuntu 17.2-1.pgdg22.04+1)\",\"total_db_size_bytes\":466944,\"db_system_identifier\":7449834921171374629}"

"target_db_details":"{\"host\":\"\",\"db_version\":\"15.12-YB-2025.1.0.1-b0\",\"node_count\":1,\"total_cores\":8,\"db_system_identifier\":\"d74f0c96-2474-4e63-b290-bdc29527a3d9\"}"

Does your PR have changes that can cause upgrade issues?

Component Breaking changes?
MetaDB No
Name registry json No
Data File Descriptor Json No
Export Snapshot Status Json No
Import Data State No
Export Status Json No
Data .sql files of tables No
Export and import data queue No
Schema Dump No
AssessmentDB No
Sizing DB No
Migration Assessment Report Json No
Callhome Json No
YugabyteD Tables No
TargetDB Metadata Tables No

@ShivanshGahlot ShivanshGahlot changed the title Shivansh/database identifier Add PostgreSQL system identifier and YugabyteDB cluster UUID to callhome Aug 26, 2025
@ShivanshGahlot ShivanshGahlot marked this pull request as ready for review August 26, 2025 15:48
Comment on lines 96 to 105
if s.DBType == "postgresql" {
if pgDB, ok := s.DB().(*PostgreSQL); ok {
if systemIdentifier, err := pgDB.GetSystemIdentifier(); err == nil {
s.PostgresSystemIdentifier = systemIdentifier
} else {
log.Infof("callhome: failed to get PostgreSQL system identifier: %v", err)
}
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use the Query / QueryRow function of srcdb.go to run the system query directly in source commands.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done. Remove the function and instead doing that directly here.

Comment on lines +243 to +245
yb.EnsureConnected()
yb.Lock()
defer yb.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need to use locks? I think we are fetching this information only once at the start, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We were using the same pattern in GetVersion so I just followed that. If you feel I should remove the locks here then I can do that here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, yeah, I think EnsureConnected is okay, lock is not required here we can remove it from GetVersion also. But lets skip for now

Comment on lines 252 to 253
if strings.Contains(err.Error(), "column") && strings.Contains(err.Error(), "does not exist") {
log.Infof("YugabyteDB cluster UUID not available (version < v2024.2.3.0)")
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the error msg here?

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 have added it as a comment too:
ERROR: column "universe_uuid" does not exist

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can check the complete error message, right?

@ShivanshGahlot ShivanshGahlot force-pushed the shivansh/database-identifier branch from b0d8c8c to cd5d600 Compare August 28, 2025 09:40
DBType: source.DBType,
DBVersion: source.DBVersion,
DBSize: source.DBSize,
PostgresSystemIdentifier: source.PostgresSystemIdentifier,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would recommend not using "Postgres" in the key/field name. This should be source-agnostic, and re-usable in the future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Hmm I was confused about this. But yeah I'll make it source agnostic

Copy link
Contributor

@priyanshi-yb priyanshi-yb left a comment

Choose a reason for hiding this comment

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

LGTM with some comments

// FetchDBSystemIdentifier fetches and stores the database system identifier
// Currently only implemented for PostgreSQL
func (s *Source) FetchDBSystemIdentifier() {
if s.DBType == "postgresql" {
Copy link
Contributor

Choose a reason for hiding this comment

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

early return

Comment on lines +243 to +245
yb.EnsureConnected()
yb.Lock()
defer yb.Unlock()
Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, yeah, I think EnsureConnected is okay, lock is not required here we can remove it from GetVersion also. But lets skip for now

Comment on lines 252 to 253
if strings.Contains(err.Error(), "column") && strings.Contains(err.Error(), "does not exist") {
log.Infof("YugabyteDB cluster UUID not available (version < v2024.2.3.0)")
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can check the complete error message, right?

@ShivanshGahlot ShivanshGahlot merged commit 76082c6 into main Aug 28, 2025
78 checks passed
@ShivanshGahlot ShivanshGahlot deleted the shivansh/database-identifier branch August 28, 2025 12:46
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.

3 participants