Skip to content

Commit

Permalink
[DB-14479] In assess-migration payload, send sizing and estimation in…
Browse files Browse the repository at this point in the history
…formation (#2282)

* Modified callhome to include sizing in assess migration payload

* Made the suggested naming changes and removed FailureReasoning

* Modified the diagnostics_test.go and added the newly created struct.
  • Loading branch information
atharva-kurhade-yb authored Feb 4, 2025
1 parent 628403f commit f4a3acc
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
14 changes: 14 additions & 0 deletions yb-voyager/cmd/assessMigrationCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,23 @@ func packAndSendAssessMigrationPayload(status string, errMsg string) {
obfuscatedIssues = append(obfuscatedIssues, obfuscatedIssue)
}

sizingAssessmentReport := callhome.SizingCallhome{
NumColocatedTables: len(assessmentReport.Sizing.SizingRecommendation.ColocatedTables),
ColocatedReasoning: assessmentReport.Sizing.SizingRecommendation.ColocatedReasoning,
NumShardedTables: len(assessmentReport.Sizing.SizingRecommendation.ShardedTables),
NumNodes: assessmentReport.Sizing.SizingRecommendation.NumNodes,
VCPUsPerInstance: assessmentReport.Sizing.SizingRecommendation.VCPUsPerInstance,
MemoryPerInstance: assessmentReport.Sizing.SizingRecommendation.MemoryPerInstance,
OptimalSelectConnectionsPerNode: assessmentReport.Sizing.SizingRecommendation.OptimalSelectConnectionsPerNode,
OptimalInsertConnectionsPerNode: assessmentReport.Sizing.SizingRecommendation.OptimalInsertConnectionsPerNode,
EstimatedTimeInMinForImport: assessmentReport.Sizing.SizingRecommendation.EstimatedTimeInMinForImport,
ParallelVoyagerJobs: assessmentReport.Sizing.SizingRecommendation.ParallelVoyagerJobs,
}

assessPayload := callhome.AssessMigrationPhasePayload{
PayloadVersion: callhome.ASSESS_MIGRATION_CALLHOME_PAYLOAD_VERSION,
TargetDBVersion: assessmentReport.TargetDBVersion,
Sizing: &sizingAssessmentReport,
MigrationComplexity: assessmentReport.MigrationComplexity,
MigrationComplexityExplanation: assessmentReport.MigrationComplexityExplanation,
SchemaSummary: callhome.MarshalledJsonString(schemaSummaryCopy),
Expand Down
14 changes: 14 additions & 0 deletions yb-voyager/src/callhome/diagnostics.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ var ASSESS_MIGRATION_CALLHOME_PAYLOAD_VERSION = "1.0"
type AssessMigrationPhasePayload struct {
PayloadVersion string `json:"payload_version"`
TargetDBVersion *ybversion.YBVersion `json:"target_db_version"`
Sizing *SizingCallhome `json:"sizing"`
MigrationComplexity string `json:"migration_complexity"`
MigrationComplexityExplanation string `json:"migration_complexity_explanation"`
SchemaSummary string `json:"schema_summary"`
Expand All @@ -121,6 +122,19 @@ type AssessmentIssueCallhome struct {
ObjectType string `json:"object_type"`
}

type SizingCallhome struct {
NumColocatedTables int `json:"num_colocated_tables"`
ColocatedReasoning string `json:"colocated_reasoning"`
NumShardedTables int `json:"num_sharded_tables"`
NumNodes float64 `json:"num_nodes"`
VCPUsPerInstance int `json:"vcpus_per_instance"`
MemoryPerInstance int `json:"memory_per_instance"`
OptimalSelectConnectionsPerNode int64 `json:"optimial_select_connections_per_node"`
OptimalInsertConnectionsPerNode int64 `json:"optimial_insert_connections_per_node"`
EstimatedTimeInMinForImport float64 `json:"estimated_time_in_min_for_import"`
ParallelVoyagerJobs float64 `json:"parallel_voyager_jobs"`
}

type ObjectSizingStats struct {
SchemaName string `json:"schema_name,omitempty"`
ObjectName string `json:"object_name"`
Expand Down
17 changes: 17 additions & 0 deletions yb-voyager/src/callhome/diagnostics_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ func TestCallhomeStructs(t *testing.T) {
expectedType: struct {
PayloadVersion string `json:"payload_version"`
TargetDBVersion *ybversion.YBVersion `json:"target_db_version"`
Sizing *SizingCallhome `json:"sizing"`
MigrationComplexity string `json:"migration_complexity"`
MigrationComplexityExplanation string `json:"migration_complexity_explanation"`
SchemaSummary string `json:"schema_summary"`
Expand All @@ -100,6 +101,22 @@ func TestCallhomeStructs(t *testing.T) {
ObjectType string `json:"object_type"`
}{},
},
{
name: "Validate SizingCallhome Struct Definition",
actualType: reflect.TypeOf(SizingCallhome{}),
expectedType: struct {
NumColocatedTables int `json:"num_colocated_tables"`
ColocatedReasoning string `json:"colocated_reasoning"`
NumShardedTables int `json:"num_sharded_tables"`
NumNodes float64 `json:"num_nodes"`
VCPUsPerInstance int `json:"vcpus_per_instance"`
MemoryPerInstance int `json:"memory_per_instance"`
OptimalSelectConnectionsPerNode int64 `json:"optimial_select_connections_per_node"`
OptimalInsertConnectionsPerNode int64 `json:"optimial_insert_connections_per_node"`
EstimatedTimeInMinForImport float64 `json:"estimated_time_in_min_for_import"`
ParallelVoyagerJobs float64 `json:"parallel_voyager_jobs"`
}{},
},
{
name: "Validate AssessMigrationBulkPhasePayload Struct Definition",
actualType: reflect.TypeOf(AssessMigrationBulkPhasePayload{}),
Expand Down

0 comments on commit f4a3acc

Please sign in to comment.