Skip to content

Conversation

@morgo
Copy link
Collaborator

@morgo morgo commented Sep 29, 2025

A Pull Request should be associated with an Issue.

We wish to have discussions in Issues. A single issue may be targeted by multiple PRs.
If you're offering a new feature or fixing anything, we'd like to know beforehand in Issues,
and potentially we'll be able to point development in a particular direction.
Further notes in https://github.com/block/spirit/blob/main/.github/CONTRIBUTING.md

Fixes #463

What's missing:

  • Checkpoint / resume
  • Defer secondary index creation
  • Pluggable cutover
  • Does not support schema changes / new tables introduced mid flight

@morgo morgo force-pushed the mtocker-move-command branch from 5b83241 to 8e5abce Compare September 29, 2025 16:43
@aparajon aparajon self-assigned this Oct 15, 2025
Comment on lines +45 to +47
func (r *Runner) Close() error {
return nil
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any clean-up or logging we need to do here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likely yes in future. Currently because most code is in Run() I am able to do cleanups in defers.

Comment on lines +213 to +215
if err := r.copier.Run(ctx); err != nil {
return err
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we log status / progress per table?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not yet. The copier does have a logger in its struct, but (comparing to table migration) the 30s log prints are external. This has not been implemented for move yet.


// getSourceTables connects to r.source and fetches the list of tables
// to populate r.sourceTables.
func (r *Runner) getSourceTables(ctx context.Context) error {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose a future enhancement could be to provide an explicit list of tables to operate on from the source. This idea is inspired by the Vitess MoveTables --tables option, which I've seen used in practice to omit some tables from being moved

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, for future improvement. Could we use two regexes? (include and ignore list).

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah that would be nice

Comment on lines +223 to +224
r.logger.Infof("All tables copied successfully.")

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If any of the table moves were to fail mid-flight, would the entire command / process stop? Or can there be a partial success state where some tables succeed and others fail?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no checkpointing, and it doesn't currently support that there could be a schema change mid-flight either (I will add this one to the list of restrictions).

"github.com/go-sql-driver/mysql"
"github.com/stretchr/testify/assert"
)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there any failure scenarios that are worth testing here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes (in future). This is experimental to start with, so I can start work planning how to integrate this with our orchestrator (tern) in parallel.

@morgo morgo enabled auto-merge October 16, 2025 17:12
@morgo morgo merged commit a80ade8 into block:main Oct 16, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement Move command based off buffered algorithm

2 participants