Skip to content

Commit

Permalink
fix hanging problem without any output (#429)
Browse files Browse the repository at this point in the history
  • Loading branch information
kutluhanmetin authored Nov 14, 2023
1 parent 2973d5b commit 404e09a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
18 changes: 7 additions & 11 deletions base/commands/migration/migration_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@ func (StartCmd) Init(cc plug.InitContext) error {
}

func (StartCmd) Exec(ctx context.Context, ec plug.ExecContext) (err error) {
ci, err := ec.ClientInternal(ctx)
if err != nil {
return err
}
ec.PrintlnUnnecessary("")
ec.PrintlnUnnecessary(`Hazelcast Data Migration Tool v5.3.0
(c) 2023 Hazelcast, Inc.
Expand All @@ -59,22 +55,22 @@ Selected data structures in the source cluster will be migrated to the target cl
}
ec.PrintlnUnnecessary("")
mID := MigrationIDGeneratorFunc()
sts, err := NewStartStages(ec.Logger(), mID, conf)
if err != nil {
return err
}
defer func() {
maybePrintWarnings(ctx, ec, ci, mID)
finalizeErr := finalizeMigration(ctx, ec, ci, mID, ec.Props().GetString(flagOutputDir))
maybePrintWarnings(ctx, ec, sts.ci, mID)
finalizeErr := finalizeMigration(ctx, ec, sts.ci, mID, ec.Props().GetString(flagOutputDir))
if err == nil {
err = finalizeErr
}
}()
sts, err := NewStartStages(ec.Logger(), mID, conf)
if err != nil {
return err
}
sp := stage.NewFixedProvider(sts.Build(ctx, ec)...)
if _, err = stage.Execute(ctx, ec, any(nil), sp); err != nil {
return err
}
mStages, err := createMigrationStages(ctx, ec, ci, mID)
mStages, err := createMigrationStages(ctx, ec, sts.ci, mID)
if err != nil {
return err
}
Expand Down
10 changes: 3 additions & 7 deletions base/commands/migration/migration_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ func (s StatusCmd) Init(cc plug.InitContext) error {
}

func (s StatusCmd) Exec(ctx context.Context, ec plug.ExecContext) (err error) {
ci, err := ec.ClientInternal(ctx)
if err != nil {
return err
}
ec.PrintlnUnnecessary("")
ec.PrintlnUnnecessary(banner)
sts := NewStatusStages()
Expand All @@ -37,13 +33,13 @@ func (s StatusCmd) Exec(ctx context.Context, ec plug.ExecContext) (err error) {
return err
}
defer func() {
maybePrintWarnings(ctx, ec, ci, mID.(string))
finalizeErr := finalizeMigration(ctx, ec, ci, mID.(string), ec.Props().GetString(flagOutputDir))
maybePrintWarnings(ctx, ec, sts.ci, mID.(string))
finalizeErr := finalizeMigration(ctx, ec, sts.ci, mID.(string), ec.Props().GetString(flagOutputDir))
if err == nil {
err = finalizeErr
}
}()
mStages, err := createMigrationStages(ctx, ec, ci, mID.(string))
mStages, err := createMigrationStages(ctx, ec, sts.ci, mID.(string))
if err != nil {
return err
}
Expand Down

0 comments on commit 404e09a

Please sign in to comment.