diff --git a/yb-voyager/cmd/exportDataStatusCommand.go b/yb-voyager/cmd/exportDataStatusCommand.go index af948a0cf..78c9697b5 100644 --- a/yb-voyager/cmd/exportDataStatusCommand.go +++ b/yb-voyager/cmd/exportDataStatusCommand.go @@ -55,7 +55,7 @@ var exportDataStatusCmd = &cobra.Command{ utils.ErrExit("\nNote: Run the following command to get the current report of live migration:\n" + color.CyanString("yb-voyager get data-migration-report --export-dir %q\n", exportDir)) } - err = InitNameRegistry(exportDir, SOURCE_DB_EXPORTER_ROLE, nil, nil, nil, nil, false) + err = InitNameRegistry(exportDir, namereg.SOURCE_DB_EXPORTER_STATUS_ROLE, nil, nil, nil, nil, false) if err != nil { utils.ErrExit("initializing name registry: %v", err) } @@ -69,7 +69,9 @@ var exportDataStatusCmd = &cobra.Command{ } useDebezium = msr.IsSnapshotExportedViaDebezium() - + if msr.SourceDBConf == nil { + utils.ErrExit("export data has not started yet. Try running after export has started") + } source = *msr.SourceDBConf sqlname.SourceDBType = source.DBType leafPartitions := getLeafPartitionsFromRootTable() @@ -162,7 +164,7 @@ func getSnapshotExportStatusRow(tableStatus *dbzm.TableExportStatus, leafPartiti func getDisplayName(nt sqlname.NameTuple, partitions []string, isTableListSet bool) string { displayTableName := nt.ForMinOutput() //Changing the display of the partition tables in case table-list is set because there can be case where user has passed a subset of leaft tables in the list - if source.DBType == POSTGRESQL && partitions != nil && isTableListSet { + if source.DBType == POSTGRESQL && partitions != nil && isTableListSet { slices.Sort(partitions) partitions := strings.Join(partitions, ", ") displayTableName = fmt.Sprintf("%s (%s)", displayTableName, partitions) diff --git a/yb-voyager/src/namereg/namereg.go b/yb-voyager/src/namereg/namereg.go index 12ff9045c..5aebe6380 100644 --- a/yb-voyager/src/namereg/namereg.go +++ b/yb-voyager/src/namereg/namereg.go @@ -25,6 +25,7 @@ const ( SOURCE_DB_IMPORTER_ROLE = "source_db_importer" // Fallback. SOURCE_REPLICA_DB_IMPORTER_ROLE = "source_replica_db_importer" // Fall-forward. SOURCE_DB_EXPORTER_ROLE = "source_db_exporter" + SOURCE_DB_EXPORTER_STATUS_ROLE = "source_db_exporter_status" TARGET_DB_EXPORTER_FF_ROLE = "target_db_exporter_ff" TARGET_DB_EXPORTER_FB_ROLE = "target_db_exporter_fb" IMPORT_FILE_ROLE = "import_file" @@ -147,6 +148,9 @@ func (reg *NameRegistry) UnRegisterYBNames() error { } func (reg *NameRegistry) registerSourceNames() (bool, error) { + if reg.params.SDB == nil { + return false, fmt.Errorf("source db connection is not available") + } reg.SourceDBType = reg.params.SourceDBType reg.initSourceDBSchemaNames() m := make(map[string][]string) @@ -403,7 +407,7 @@ func NewNameTuple(role string, sourceName *sqlname.ObjectName, targetName *sqlna t.CurrentName = t.SourceName case SOURCE_REPLICA_DB_IMPORTER_ROLE: t.CurrentName = t.SourceName - case SOURCE_DB_EXPORTER_ROLE: + case SOURCE_DB_EXPORTER_ROLE, SOURCE_DB_EXPORTER_STATUS_ROLE: t.CurrentName = t.SourceName case TARGET_DB_EXPORTER_FF_ROLE, TARGET_DB_EXPORTER_FB_ROLE: t.CurrentName = t.TargetName