Skip to content

Commit

Permalink
Fix: nil pointer exception while sending the callhome payload for imp…
Browse files Browse the repository at this point in the history
…ort data to source/source-replica
  • Loading branch information
priyanshi-yb committed Mar 3, 2025
1 parent 60435d2 commit 780f73d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 4 additions & 2 deletions yb-voyager/cmd/importDataToSource.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ func packAndSendImportDataToSourcePayload(status string, errorMsg string) {

sourceDBDetails := callhome.SourceDBDetails{
DBType: tconf.TargetDBType,
DBVersion: targetDBDetails.DBVersion,
}
if targetDBDetails != nil {
sourceDBDetails.DBVersion = targetDBDetails.DBVersion
}
payload.SourceDBDetails = callhome.MarshalledJsonString(sourceDBDetails)

Expand All @@ -112,7 +114,7 @@ func packAndSendImportDataToSourcePayload(status string, errorMsg string) {

importDataPayload.Phase = importPhase

if importPhase != dbzm.MODE_SNAPSHOT {
if importPhase != dbzm.MODE_SNAPSHOT && statsReporter != nil {
importDataPayload.EventsImportRate = statsReporter.EventsImportRateLast3Min
importDataPayload.TotalImportedEvents = statsReporter.TotalEventsImported
}
Expand Down
10 changes: 6 additions & 4 deletions yb-voyager/cmd/importDataToSourceReplica.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ func packAndSendImportDataToSrcReplicaPayload(status string, errorMsg string) {
payload.MigrationType = LIVE_MIGRATION

sourceDBDetails := callhome.SourceDBDetails{
DBType: tconf.TargetDBType,
DBVersion: targetDBDetails.DBVersion,
Role: "replica",
DBType: tconf.TargetDBType,
Role: "replica",
}
if targetDBDetails != nil {
sourceDBDetails.DBVersion = targetDBDetails.DBVersion
}
payload.SourceDBDetails = callhome.MarshalledJsonString(sourceDBDetails)

Expand All @@ -128,7 +130,7 @@ func packAndSendImportDataToSrcReplicaPayload(status string, errorMsg string) {

importDataPayload.Phase = importPhase

if importPhase != dbzm.MODE_SNAPSHOT {
if importPhase != dbzm.MODE_SNAPSHOT && statsReporter != nil {
importDataPayload.EventsImportRate = statsReporter.EventsImportRateLast3Min
importDataPayload.TotalImportedEvents = statsReporter.TotalEventsImported
}
Expand Down

0 comments on commit 780f73d

Please sign in to comment.