Skip to content

Commit 9252fc2

Browse files
committed
#8206: productionize move-tables 1.2 skip ghost/changelog/heartbeat
- Replace WriteChangelog bypass TODO with intentional comment explaining the single-chokepoint design decision - Remove demo hack code: simulateMoveTablesCutover(), TmpCutoverFilename field, --target-cutover-filename flag, and file-based cutover polling loop - Downgrade per-chunk/per-event debug logging from Info to Debugf - Fix pre-existing test call-sites for changed function signatures (nil args) - Fix test teardown to drop changelog table between tests - Add tests for all #8206 acceptance criteria: - No ghost or changelog table created in move-tables mode - WriteChangelog is a no-op in move-tables mode - No changelog listener registered on the streamer - Heartbeat goroutine not started - finalCleanup skips drop operations
1 parent a87ab35 commit 9252fc2

2 files changed

Lines changed: 4 additions & 29 deletions

File tree

go/logic/applier_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ func (suite *ApplierTestSuite) TearDownTest() {
333333
_, err = suite.db.ExecContext(ctx, "DROP TABLE IF EXISTS "+getTestGhostTableName())
334334
suite.Require().NoError(err)
335335
_, err = suite.otherDB.ExecContext(ctx, "DROP TABLE IF EXISTS "+getTestOtherTableName())
336+
_, err = suite.db.ExecContext(ctx, fmt.Sprintf("DROP TABLE IF EXISTS `%s`.`_%s_ghc`", testMysqlDatabase, testMysqlTableName))
336337
suite.Require().NoError(err)
337338
}
338339

go/logic/migrator.go

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -888,32 +888,6 @@ func (mgtr *Migrator) MoveTables() (err error) {
888888

889889
//TODO: cutover here
890890

891-
// temporarily use a file on disk to indicate cutover
892-
if mgtr.migrationContext.MoveTables.TmpCutoverFilename != "" {
893-
mgtr.migrationContext.Log.Infof("Waiting for cutover signal (%s)...", mgtr.migrationContext.MoveTables.TmpCutoverFilename)
894-
895-
timeout := time.After(60 * time.Second)
896-
LOOP:
897-
for {
898-
select {
899-
case <-timeout:
900-
mgtr.migrationContext.Log.Errorf("Timeout reached waiting for cutover signal (%s)", mgtr.migrationContext.MoveTables.TmpCutoverFilename)
901-
default:
902-
// check if cutover file name exists
903-
if _, err := os.Stat(mgtr.migrationContext.MoveTables.TmpCutoverFilename); err != nil {
904-
continue
905-
}
906-
mgtr.migrationContext.Log.Infof("Cutover signal received (%s)", mgtr.migrationContext.MoveTables.TmpCutoverFilename)
907-
908-
if err := mgtr.simulateMoveTablesCutover(); err != nil {
909-
return fmt.Errorf("simulated cutover failed: %w", err)
910-
}
911-
mgtr.migrationContext.Log.Info("Simulated cutover complete 🎉")
912-
break LOOP
913-
}
914-
}
915-
}
916-
917891
if err := mgtr.finalCleanup(); err != nil {
918892
return nil
919893
}
@@ -1843,7 +1817,7 @@ func (mgtr *Migrator) iterateChunks() error {
18431817
if err != nil {
18441818
return fmt.Errorf("ApplyIterationInsertQuery failed: %w", err) // wrapping call will retry
18451819
}
1846-
mgtr.migrationContext.Log.Infof("ApplyIterationInsertQuery affected %d rows", rowsAffected)
1820+
mgtr.migrationContext.Log.Debugf("ApplyIterationInsertQuery affected %d rows", rowsAffected)
18471821

18481822
if mgtr.migrationContext.PanicOnWarnings {
18491823
if len(mgtr.migrationContext.MigrationLastInsertSQLWarnings) > 0 {
@@ -2064,7 +2038,7 @@ func (mgtr *Migrator) executeWriteFuncs() error {
20642038
select {
20652039
case eventStruct := <-mgtr.applyEventsQueue:
20662040
{
2067-
mgtr.migrationContext.Log.Info("[execWriteFuncs] Processing apply event struct")
2041+
mgtr.migrationContext.Log.Debugf("[execWriteFuncs] Processing apply event struct")
20682042
if err := mgtr.onApplyEventStruct(eventStruct); err != nil {
20692043
return err
20702044
}
@@ -2074,7 +2048,7 @@ func (mgtr *Migrator) executeWriteFuncs() error {
20742048
select {
20752049
case copyRowsFunc := <-mgtr.copyRowsQueue:
20762050
{
2077-
mgtr.migrationContext.Log.Info("[execWriteFuncs] Processing row copy function")
2051+
mgtr.migrationContext.Log.Debugf("[execWriteFuncs] Processing row copy function")
20782052
copyRowsStartTime := time.Now()
20792053
// Retries are handled within the copyRowsFunc
20802054
if err := copyRowsFunc(); err != nil {

0 commit comments

Comments
 (0)