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

Send error messages to callhome #2160

Merged
merged 8 commits into from
Jan 9, 2025
Merged

Send error messages to callhome #2160

merged 8 commits into from
Jan 9, 2025

Conversation

makalaaneesh
Copy link
Collaborator

@makalaaneesh makalaaneesh commented Jan 8, 2025

Describe the changes in this pull request

Send error messages in each phase to callhome as part of phase payload.

callhome=# select * from diagnostics  where migration_uuid='70c74cb8-0c8a-42cc-86d0-10d5e39a4cb8';
-[ RECORD 1 ]------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
migration_uuid     | 70c74cb8-0c8a-42cc-86d0-10d5e39a4cb8
phase_start_time   | 2025-01-08 08:04:45.790466+00
collected_at       | 2025-01-08 08:04:45.904148+00
source_db_details  | {"host": "", "db_type": "postgresql", "db_version": "", "total_db_size_bytes": 0}
target_db_details  |
yb_voyager_version | main
migration_phase    | export-schema
phase_payload      | {"error": "run query \"SELECT setting from pg_settings where name = server_version\" on source", "use_orafce": true, "start_clean": true, "comments_on_objects": false, "applied_recommendations": false}
migration_type     |
time_taken_sec     | 1
status             | ERROR
host_ip            | 100.76.18.48

Describe if there are any user-facing changes

How was this pull request tested?

Manual testing against local callhome server.

Does your PR have changes that can cause upgrade issues?

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

@makalaaneesh makalaaneesh marked this pull request as ready for review January 8, 2025 14:42
@@ -57,14 +57,14 @@ var assessMigrationBulkCmd = &cobra.Command{
Run: func(cmd *cobra.Command, args []string) {
err := assessMigrationBulk()
if err != nil {
packAndSendAssessMigrationBulkPayload(ERROR)
// packAndSendAssessMigrationBulkPayload(ERROR)
Copy link
Contributor

Choose a reason for hiding this comment

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

remove comment

@@ -1046,7 +1047,7 @@ func extractTableListFromString(fullTableList []sqlname.NameTuple, flagTableList
result := lo.Filter(fullTableList, func(tableName sqlname.NameTuple, _ int) bool {
ok, err := tableName.MatchesPattern(pattern)
if err != nil {
utils.ErrExit("Invalid table name pattern %q: %s", err)
utils.ErrExit("Invalid table name pattern %q: %s", pattern, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

just confirm if we have fixed it in modify error strings PR.

utils.ErrExit("Invalid table name pattern: %q: %s", pattern, err)

@@ -262,7 +262,7 @@ func startExportPB(progressContainer *mpb.Progress, mapKey string, quitChan chan
time.Sleep(100 * time.Millisecond)
break
} else if err != nil { //error other than EOF
utils.ErrExit("Error while reading file %s: %v", tableDataFile, err)
utils.ErrExit("Error while reading file %s: %v", tableDataFile.Name(), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

same for this as above
utils.ErrExit("Error while reading file: %s: %v", tableDataFile.Name(), err)

@@ -785,7 +785,7 @@ WHERE parent.relname='%s' AND nmsp_parent.nspname = '%s' `, tname, sname)
rows, err := pg.db.Query(query)
if err != nil {
log.Errorf("failed to list partitions of table %s: query = [ %s ], error = %s", tableName, query, err)
utils.ErrExit("failed to find the partitions for table %s:", tableName, err)
utils.ErrExit("failed to find the partitions for table %s: %v", tableName, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

utils.ErrExit("failed to find the partitions for table: %s: %v", tableName, err)

@@ -756,7 +756,7 @@ WHERE parent.relname='%s' AND nmsp_parent.nspname = '%s' `, tname, sname)
rows, err := yb.db.Query(query)
if err != nil {
log.Errorf("failed to list partitions of table %s: query = [ %s ], error = %s", tableName, query, err)
utils.ErrExit("failed to find the partitions for table %s:", tableName, err)
utils.ErrExit("failed to find the partitions for table %s: %v", tableName, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

utils.ErrExit("failed to find the partitions for table: %s: %v", tableName, err)

if len(errorsList) > 0 && status != EXIT {
payload.Status = COMPLETE_WITH_ERRORS
}
// if status == ERROR {
Copy link
Contributor

Choose a reason for hiding this comment

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

remove comments

@@ -299,7 +299,7 @@ func validateSSLMode() {
if source.DBType == ORACLE || slices.Contains(validSSLModes[source.DBType], source.SSLMode) {
return
} else {
utils.ErrExit("Error: Invalid sslmode: %q. Valid SSL modes are %v", validSSLModes[source.DBType])
utils.ErrExit("Error: Invalid sslmode: %q. Valid SSL modes are %v", source.SSLMode, validSSLModes[source.DBType])
Copy link
Contributor

Choose a reason for hiding this comment

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

utils.ErrExit("Invalid sslmode: %q. Valid SSL modes are %v", source.SSLMode, validSSLModes[source.DBType])

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!

@makalaaneesh makalaaneesh merged commit b9e614d into main Jan 9, 2025
67 checks passed
@makalaaneesh makalaaneesh deleted the aneesh/callhome-error branch January 9, 2025 09:10
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.

2 participants