Skip to content

Commit

Permalink
fix retrieve uuid should called once we basic structure of export-dir…
Browse files Browse the repository at this point in the history
… exists
  • Loading branch information
priyanshi-yb committed Jan 8, 2025
1 parent 99e04e0 commit e12e605
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
3 changes: 1 addition & 2 deletions yb-voyager/cmd/assessMigrationCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ var assessMigrationCmd = &cobra.Command{
Long: fmt.Sprintf("Assess the migration from source (%s) database to YugabyteDB.", strings.Join(assessMigrationSupportedDBTypes, ", ")),

PreRun: func(cmd *cobra.Command, args []string) {
CreateMigrationProjectIfNotExists(source.DBType, exportDir)
err := retrieveMigrationUUID()
if err != nil {
utils.ErrExit("failed to get migration UUID: %w", err)
Expand Down Expand Up @@ -323,8 +324,6 @@ func assessMigration() (err error) {
schemaDir = filepath.Join(assessmentMetadataDir, "schema")

checkStartCleanForAssessMigration(assessmentMetadataDirFlag != "")
CreateMigrationProjectIfNotExists(source.DBType, exportDir)

utils.PrintAndLog("Assessing for migration to target YugabyteDB version %s\n", targetDbVersion)

assessmentDir := filepath.Join(exportDir, "assessment")
Expand Down
12 changes: 6 additions & 6 deletions yb-voyager/cmd/endMigrationCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ var endMigrationCmd = &cobra.Command{
Long: "End the current migration and cleanup all metadata stored in databases(Target, Source-Replica and Source) and export-dir",

PreRun: func(cmd *cobra.Command, args []string) {
err := validateEndMigrationFlags(cmd)
if err != nil {
utils.ErrExit(err.Error())
}

if utils.IsDirectoryEmpty(exportDir) {
utils.ErrExit("export directory is empty, nothing to end")
}

err = retrieveMigrationUUID()
err := retrieveMigrationUUID()
if err != nil {
utils.ErrExit("failed to get migration UUID: %w", err)
}
err = validateEndMigrationFlags(cmd)
if err != nil {
utils.ErrExit(err.Error())
}

},

Run: endMigrationCommandFn,
Expand Down

0 comments on commit e12e605

Please sign in to comment.